-
Notifications
You must be signed in to change notification settings - Fork 704
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
!fix: Ensure default column family uses specified open options #882
!fix: Ensure default column family uses specified open options #882
Conversation
I'm hesitant to make this change. The existing api clearly states that the cfs provided will get the provided options applied so if the user doesn't provide the default cf then the default cf will get the default settings which makes sense to me. The issue here is that this change is a breaking change that will change behaviour for users that have not set anything for the default cf which may break people... It might be better to document the functions to state that the default cf will get the default options if it's not included/not specifically configured. |
I also thought that it is breaking change and with current |
#[test]
fn test_default_cf_compaction() {
use rocksdb::{CompactionDecision, Options, DB};
let mut cf_opts = Options::default();
cf_opts.set_compaction_filter("test", |_, _, _| {
println!("compaction_filter in cf");
CompactionDecision::Keep
});
let descriptor = rocksdb::ColumnFamilyDescriptor::new("test", cf_opts);
let mut opts = Options::default();
opts.create_if_missing(true);
opts.create_missing_column_families(true);
opts.set_compaction_filter("test", |_, _, _| {
println!("compaction_filter in DEFAULT");
CompactionDecision::Keep
});
let db = DB::open_cf_descriptors(&opts, "test", vec![descriptor]).unwrap();
let cf = db.cf_handle("test").unwrap();
db.put_cf(cf, b"1", b"").unwrap();
db.compact_range_cf(cf, None::<&[u8]>, None::<&[u8]>);
db.put(b"key", "").unwrap();
db.compact_range(None::<&[u8]>, None::<&[u8]>);
drop(db);
DB::destroy(&opts, "test").unwrap();
} In this case,
Thus, when you call put on the database, you expect that the options set for the database will be applied. So if a change breaks backward compatibility, I think we should at least update the docs to make this behavior more clear. |
I agree, if you can update the pr, that would be great |
8890da6
to
9f43f16
Compare
done |
Previously, the default column family was initialized with default settings if not explicitly included in the column family descriptors. This commit ensures that the default column family inherits the open options