Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions db/table_properties_collector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ Status UserKeyTablePropertiesCollector::InternalAdd(const Slice& key,
if (!ParseInternalKey(key, &ikey)) {
return Status::InvalidArgument("Invalid internal key");
}

return collector_->AddUserKey(ikey.user_key, value, GetEntryType(ikey.type),
ikey.sequence, file_size);
Slice value_or_meta = value;
if (ikey.type == kEntryMergeIndex || ikey.type == kEntryValueIndex) {
value_or_meta = SeparateHelper::DecodeValueMeta(value);
}
return collector_->AddUserKey(ikey.user_key, value_or_meta,
GetEntryType(ikey.type), ikey.sequence,
file_size);
}

Status UserKeyTablePropertiesCollector::Finish(
Expand Down
15 changes: 10 additions & 5 deletions include/rocksdb/table_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,18 @@ class TablePropertiesCollector {

// AddUserKey() will be called when a new key/value pair is inserted into the
// table.
// @params key the user key that is inserted into the table.
// @params value the value that is inserted into the table.
virtual Status AddUserKey(const Slice& key, const Slice& value,
EntryType /*type*/, SequenceNumber /*seq*/,
// @params key the user key that is inserted into the table.
// @params value_or_meta the value that is inserted into the table.
virtual Status AddUserKey(const Slice& key, const Slice& value_or_meta,
EntryType type, SequenceNumber /*seq*/,
uint64_t /*file_size*/) {
if (type == kEntryMergeIndex || type == kEntryValueIndex) {
return Status::NotSupported(
"TablePropertiesCollector::AddUserKey() need key value separation "
"support.");
}
// For backwards-compatibility.
return Add(key, value);
return Add(key, value_or_meta);
}

// Finish() will be called when a table has already been built and is ready
Expand Down