Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYS-6306] Add sequence number logging to RocksDb-Cloud #289

Merged
merged 1 commit into from
Oct 10, 2023
Merged
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
6 changes: 6 additions & 0 deletions db/db_impl/db_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6559,4 +6559,10 @@ ColumnFamilyData* DBImpl::GetAnyCFWithAutoFlushDisabled() const {
return nullptr;
}

namespace {
thread_local bool threadLogging{false};
}
void SetThreadLogging(bool v) { threadLogging = v; }
bool GetThreadLogging() { return threadLogging; }

} // namespace ROCKSDB_NAMESPACE
9 changes: 9 additions & 0 deletions db/memtable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,15 @@ static bool SaveValue(void* arg, const char* entry) {
ValueType type;
SequenceNumber seq;
UnPackSequenceAndType(tag, &seq, &type);

if (GetThreadLogging()) {
ROCKS_LOG_INFO(
s->logger,
"In SaveValue, memtable %p, found key at sequence number: %" PRIu64
", type: %d",
s->mem, seq, int(type));
}

// If the value is not in the snapshot, skip it
if (!s->CheckCallback(seq)) {
return true; // to continue to the next seq
Expand Down
3 changes: 3 additions & 0 deletions include/rocksdb/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -1957,4 +1957,7 @@ Status RepairDB(const std::string& dbname, const DBOptions& db_options,
Status RepairDB(const std::string& dbname, const Options& options);
#endif

void SetThreadLogging(bool v);
bool GetThreadLogging();

} // namespace ROCKSDB_NAMESPACE
9 changes: 9 additions & 0 deletions table/block_based/block_based_table_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2178,6 +2178,15 @@ Status BlockBasedTable::Get(const ReadOptions& read_options, const Slice& key,
s = pik_status;
}

if (GetThreadLogging()) {
ROCKS_LOG_INFO(rep_->ioptions.logger,
"In BlockBasedTable::Get, file %" PRIu64
", found key at sequence number: %" PRIu64
", type: %d",
rep_->sst_number_for_tracing(), parsed_key.sequence,
int(parsed_key.type));
}

if (!get_context->SaveValue(
parsed_key, biter.value(), &matched,
biter.IsValuePinned() ? &biter : nullptr)) {
Expand Down