Skip to content

Conversation

@virajthakur
Copy link
Contributor

@virajthakur virajthakur commented Oct 16, 2025

this PR adds a new option for "transient" column families, for which data/metadata should not be persisted in the db long term.

Expected behavior for transient cfs:

  1. cf is dropped upon db reopen.

The client cannot reopen a db with the transient cfs included. They will silently be dropped after recovery completes. First, during manifest replay, we distinguish between regular cfs that are not included (error) and transient cfs that are expected to be excluded (no error). After recovery, all transient cfs are dropped.

  1. Backup/snapshot exclude transient cf data.

GetLiveFilesStorageInfo and GetLiveFilesMetadata exclude transient cfs, so they will not be included in backup or checkpoints.

  1. WAL contains transient CF writes, as it would for normal writes.

During WAL recovery, ignore_missing_column families is always set to true, so no special handling for transient cfs is required.

  1. Before the db is restarted, transient cf data is flushed/compact normally

Viraj Thakur added 5 commits October 15, 2025 12:34
…mn_family_test that currently fails since transient CFs are not dropped
…he version_edit so that transient cfs can be skipped during the manifest replay (no access to cf options yet), add unittests for version_edit_test and column_family_test
…e version_edit_handler to track transient cfs and other missing cfs separately - distinguish between CFs that are skipped due to user error vs transient, avoiding corruption false alarm
@meta-cla meta-cla bot added the CLA Signed label Oct 16, 2025
@meta-codesync
Copy link

meta-codesync bot commented Oct 16, 2025

@virajthakur has imported this pull request. If you are a Meta employee, you can view this in D84785372.

@hx235
Copy link
Contributor

hx235 commented Oct 17, 2025

@virajthakur is this a prototype or a working progress? If the latter, you may want to consider adding stress test support for feature that has non-trivial interaction with others like this one.

cc @cbi42

@virajthakur virajthakur changed the title [testing] transient cf implementation transient cf implementation Oct 21, 2025
@virajthakur virajthakur requested a review from cbi42 October 21, 2025 02:56
@virajthakur virajthakur marked this pull request as ready for review October 21, 2025 19:08
memtable_avg_op_scan_flush_trigger(
options.memtable_avg_op_scan_flush_trigger) {
options.memtable_avg_op_scan_flush_trigger),
is_transient(options.is_transient) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should only add it to ImmutableCFOptions since it's an immutable option.

edit.SetComparatorName(cf_options.comparator->Name());
edit.SetPersistUserDefinedTimestamps(
cf_options.persist_user_defined_timestamps);
edit.SetIsTransientColumnFamily(cf_options.is_transient);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a couple other places where this needs to be set. E.g.

cfd->ioptions().persist_user_defined_timestamps);
. You can probably search for where AddColumnFamily() is called.

// Create ColumnFamilyOptions from Options
explicit ColumnFamilyOptions(const Options& options);

bool is_transient = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add comment to explain what the option is for? Maybe include that opening a DB will fail if user passes in a transient CF, and mention forward/backward compatibility.


// Validate that no transient CFs are requested
for (const auto& cf : column_families) {
if (cf.options.is_transient) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the CF was created as transient, but the user now opens it as non transient (cf.options.is_transient is false)?

moptions.memtable_op_scan_flush_trigger;
cf_opts->memtable_avg_op_scan_flush_trigger =
moptions.memtable_avg_op_scan_flush_trigger;
cf_opts->is_transient = moptions.is_transient;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The option should not be mutable.

if (s.ok()) {
impl->mutex_.AssertHeld();

for (auto cfd : *impl->versions_->GetColumnFamilySet()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the transient CF is in the column family set, since its creation is skipped here: https://github.com/facebook/rocksdb/pull/14052/files#diff-18d1efc35e2c8fdc81a58b43fb821c003eee1a9fe5f212e82df18e99e8357945R262-R276

// Create ColumnFamilyOptions from Options
explicit ColumnFamilyOptions(const Options& options);

bool is_transient = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also write this option to the logs?

@cbi42
Copy link
Member

cbi42 commented Oct 22, 2025

@virajthakur is this a prototype or a working progress? If the latter, you may want to consider adding stress test support for feature that has non-trivial interaction with others like this one.

cc @cbi42

We've discussed about stress test coverage. Since this change would drop the CF upon re-open, which is not something stress test easily covers, we can add that support later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants