mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
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:
@@ -2750,7 +2750,9 @@ Iterator* DBImpl::TEST_NewInternalIterator(ColumnFamilyHandle* column_family) {
|
|||||||
mutex_.Lock();
|
mutex_.Lock();
|
||||||
SuperVersion* super_version = cfd->GetSuperVersion()->Ref();
|
SuperVersion* super_version = cfd->GetSuperVersion()->Ref();
|
||||||
mutex_.Unlock();
|
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(
|
std::pair<Iterator*, Iterator*> DBImpl::GetTailingIteratorPair(
|
||||||
@@ -3604,10 +3606,14 @@ Status DBImpl::MakeRoomForWrite(ColumnFamilyData* cfd, bool force) {
|
|||||||
return s;
|
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
|
// Increment the ref count
|
||||||
mutex_.Lock();
|
mutex_.Lock();
|
||||||
auto version = versions_->current();
|
auto version = cfd->current();
|
||||||
version->Ref();
|
version->Ref();
|
||||||
mutex_.Unlock();
|
mutex_.Unlock();
|
||||||
|
|
||||||
|
|||||||
@@ -494,7 +494,9 @@ class DBImpl : public DB {
|
|||||||
void InstallSuperVersion(ColumnFamilyData* cfd,
|
void InstallSuperVersion(ColumnFamilyData* cfd,
|
||||||
DeletionState& deletion_state);
|
DeletionState& deletion_state);
|
||||||
|
|
||||||
virtual Status GetPropertiesOfAllTables(TablePropertiesCollection* props)
|
using DB::GetPropertiesOfAllTables;
|
||||||
|
virtual Status GetPropertiesOfAllTables(ColumnFamilyHandle* column_family,
|
||||||
|
TablePropertiesCollection* props)
|
||||||
override;
|
override;
|
||||||
|
|
||||||
// Function that Get and KeyMayExist call with no_io true or false
|
// Function that Get and KeyMayExist call with no_io true or false
|
||||||
|
|||||||
@@ -5133,7 +5133,9 @@ class ModelDB: public DB {
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Status GetPropertiesOfAllTables(TablePropertiesCollection* props) {
|
using DB::GetPropertiesOfAllTables;
|
||||||
|
virtual Status GetPropertiesOfAllTables(ColumnFamilyHandle* column_family,
|
||||||
|
TablePropertiesCollection* props) {
|
||||||
return Status();
|
return Status();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -244,8 +244,8 @@ bool Version::PrefixMayMatch(const ReadOptions& options,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Status Version::GetPropertiesOfAllTables(TablePropertiesCollection* props) {
|
Status Version::GetPropertiesOfAllTables(TablePropertiesCollection* props) {
|
||||||
auto table_cache = vset_->table_cache_;
|
auto table_cache = cfd_->table_cache();
|
||||||
auto options = vset_->options_;
|
auto options = cfd_->full_options();
|
||||||
for (int level = 0; level < num_levels_; level++) {
|
for (int level = 0; level < num_levels_; level++) {
|
||||||
for (const auto& file_meta : files_[level]) {
|
for (const auto& file_meta : files_[level]) {
|
||||||
auto fname = TableFileName(vset_->dbname_, file_meta->number);
|
auto fname = TableFileName(vset_->dbname_, file_meta->number);
|
||||||
@@ -253,8 +253,8 @@ Status Version::GetPropertiesOfAllTables(TablePropertiesCollection* props) {
|
|||||||
// properties from there.
|
// properties from there.
|
||||||
std::shared_ptr<const TableProperties> table_properties;
|
std::shared_ptr<const TableProperties> table_properties;
|
||||||
Status s = table_cache->GetTableProperties(
|
Status s = table_cache->GetTableProperties(
|
||||||
vset_->storage_options_, vset_->icmp_, *file_meta, &table_properties,
|
vset_->storage_options_, cfd_->internal_comparator(), *file_meta,
|
||||||
true /* no io */);
|
&table_properties, true /* no io */);
|
||||||
if (s.ok()) {
|
if (s.ok()) {
|
||||||
props->insert({fname, table_properties});
|
props->insert({fname, table_properties});
|
||||||
continue;
|
continue;
|
||||||
@@ -269,8 +269,8 @@ Status Version::GetPropertiesOfAllTables(TablePropertiesCollection* props) {
|
|||||||
// 2. Table is not present in table cache, we'll read the table properties
|
// 2. Table is not present in table cache, we'll read the table properties
|
||||||
// directly from the properties block in the file.
|
// directly from the properties block in the file.
|
||||||
std::unique_ptr<RandomAccessFile> file;
|
std::unique_ptr<RandomAccessFile> file;
|
||||||
s = vset_->env_->NewRandomAccessFile(fname, &file,
|
s = options->env->NewRandomAccessFile(fname, &file,
|
||||||
vset_->storage_options_);
|
vset_->storage_options_);
|
||||||
if (!s.ok()) {
|
if (!s.ok()) {
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -435,7 +435,11 @@ class DB {
|
|||||||
// Returns default column family handle
|
// Returns default column family handle
|
||||||
virtual ColumnFamilyHandle* DefaultColumnFamily() const = 0;
|
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:
|
private:
|
||||||
// No copying allowed
|
// No copying allowed
|
||||||
|
|||||||
@@ -182,8 +182,10 @@ class StackableDB : public DB {
|
|||||||
return db_->GetDbIdentity(identity);
|
return db_->GetDbIdentity(identity);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Status GetPropertiesOfAllTables(TablePropertiesCollection* props) {
|
using DB::GetPropertiesOfAllTables;
|
||||||
return db_->GetPropertiesOfAllTables(props);
|
virtual Status GetPropertiesOfAllTables(ColumnFamilyHandle* column_family,
|
||||||
|
TablePropertiesCollection* props) {
|
||||||
|
return db_->GetPropertiesOfAllTables(column_family, props);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Status GetUpdatesSince(SequenceNumber seq_number,
|
virtual Status GetUpdatesSince(SequenceNumber seq_number,
|
||||||
|
|||||||
Reference in New Issue
Block a user