Fix table properties
Summary: Adapt table properties to column family world Test Plan: make check Reviewers: kailiu CC: leveldb Differential Revision: https://reviews.facebook.net/D16161
This commit is contained in:
parent
76c048183c
commit
422bb09cb0
@ -2750,7 +2750,9 @@ Iterator* DBImpl::TEST_NewInternalIterator(ColumnFamilyHandle* column_family) {
|
||||
mutex_.Lock();
|
||||
SuperVersion* super_version = cfd->GetSuperVersion()->Ref();
|
||||
mutex_.Unlock();
|
||||
return NewInternalIterator(ReadOptions(), cfd, super_version);
|
||||
ReadOptions roptions;
|
||||
roptions.prefix_seek = true;
|
||||
return NewInternalIterator(roptions, cfd, super_version);
|
||||
}
|
||||
|
||||
std::pair<Iterator*, Iterator*> DBImpl::GetTailingIteratorPair(
|
||||
@ -3604,10 +3606,14 @@ Status DBImpl::MakeRoomForWrite(ColumnFamilyData* cfd, bool force) {
|
||||
return s;
|
||||
}
|
||||
|
||||
Status DBImpl::GetPropertiesOfAllTables(TablePropertiesCollection* props) {
|
||||
Status DBImpl::GetPropertiesOfAllTables(ColumnFamilyHandle* column_family,
|
||||
TablePropertiesCollection* props) {
|
||||
auto cfh = reinterpret_cast<ColumnFamilyHandleImpl*>(column_family);
|
||||
auto cfd = cfh->cfd();
|
||||
|
||||
// Increment the ref count
|
||||
mutex_.Lock();
|
||||
auto version = versions_->current();
|
||||
auto version = cfd->current();
|
||||
version->Ref();
|
||||
mutex_.Unlock();
|
||||
|
||||
|
@ -494,7 +494,9 @@ class DBImpl : public DB {
|
||||
void InstallSuperVersion(ColumnFamilyData* cfd,
|
||||
DeletionState& deletion_state);
|
||||
|
||||
virtual Status GetPropertiesOfAllTables(TablePropertiesCollection* props)
|
||||
using DB::GetPropertiesOfAllTables;
|
||||
virtual Status GetPropertiesOfAllTables(ColumnFamilyHandle* column_family,
|
||||
TablePropertiesCollection* props)
|
||||
override;
|
||||
|
||||
// Function that Get and KeyMayExist call with no_io true or false
|
||||
|
@ -5133,7 +5133,9 @@ class ModelDB: public DB {
|
||||
return s;
|
||||
}
|
||||
|
||||
virtual Status GetPropertiesOfAllTables(TablePropertiesCollection* props) {
|
||||
using DB::GetPropertiesOfAllTables;
|
||||
virtual Status GetPropertiesOfAllTables(ColumnFamilyHandle* column_family,
|
||||
TablePropertiesCollection* props) {
|
||||
return Status();
|
||||
}
|
||||
|
||||
|
@ -244,8 +244,8 @@ bool Version::PrefixMayMatch(const ReadOptions& options,
|
||||
}
|
||||
|
||||
Status Version::GetPropertiesOfAllTables(TablePropertiesCollection* props) {
|
||||
auto table_cache = vset_->table_cache_;
|
||||
auto options = vset_->options_;
|
||||
auto table_cache = cfd_->table_cache();
|
||||
auto options = cfd_->full_options();
|
||||
for (int level = 0; level < num_levels_; level++) {
|
||||
for (const auto& file_meta : files_[level]) {
|
||||
auto fname = TableFileName(vset_->dbname_, file_meta->number);
|
||||
@ -253,8 +253,8 @@ Status Version::GetPropertiesOfAllTables(TablePropertiesCollection* props) {
|
||||
// properties from there.
|
||||
std::shared_ptr<const TableProperties> table_properties;
|
||||
Status s = table_cache->GetTableProperties(
|
||||
vset_->storage_options_, vset_->icmp_, *file_meta, &table_properties,
|
||||
true /* no io */);
|
||||
vset_->storage_options_, cfd_->internal_comparator(), *file_meta,
|
||||
&table_properties, true /* no io */);
|
||||
if (s.ok()) {
|
||||
props->insert({fname, table_properties});
|
||||
continue;
|
||||
@ -269,7 +269,7 @@ Status Version::GetPropertiesOfAllTables(TablePropertiesCollection* props) {
|
||||
// 2. Table is not present in table cache, we'll read the table properties
|
||||
// directly from the properties block in the file.
|
||||
std::unique_ptr<RandomAccessFile> file;
|
||||
s = vset_->env_->NewRandomAccessFile(fname, &file,
|
||||
s = options->env->NewRandomAccessFile(fname, &file,
|
||||
vset_->storage_options_);
|
||||
if (!s.ok()) {
|
||||
return s;
|
||||
|
@ -435,7 +435,11 @@ class DB {
|
||||
// Returns default column family handle
|
||||
virtual ColumnFamilyHandle* DefaultColumnFamily() const = 0;
|
||||
|
||||
virtual Status GetPropertiesOfAllTables(TablePropertiesCollection* props) = 0;
|
||||
virtual Status GetPropertiesOfAllTables(ColumnFamilyHandle* column_family,
|
||||
TablePropertiesCollection* props) = 0;
|
||||
virtual Status GetPropertiesOfAllTables(TablePropertiesCollection* props) {
|
||||
return GetPropertiesOfAllTables(DefaultColumnFamily(), props);
|
||||
}
|
||||
|
||||
private:
|
||||
// No copying allowed
|
||||
|
@ -182,8 +182,10 @@ class StackableDB : public DB {
|
||||
return db_->GetDbIdentity(identity);
|
||||
}
|
||||
|
||||
virtual Status GetPropertiesOfAllTables(TablePropertiesCollection* props) {
|
||||
return db_->GetPropertiesOfAllTables(props);
|
||||
using DB::GetPropertiesOfAllTables;
|
||||
virtual Status GetPropertiesOfAllTables(ColumnFamilyHandle* column_family,
|
||||
TablePropertiesCollection* props) {
|
||||
return db_->GetPropertiesOfAllTables(column_family, props);
|
||||
}
|
||||
|
||||
virtual Status GetUpdatesSince(SequenceNumber seq_number,
|
||||
|
Loading…
Reference in New Issue
Block a user