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

!fix: Ensure default column family uses specified open options #882

Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## [Unreleased]
* Document that `default` column family doesn't inherit open options of db (
0xdeafbeef)

## 0.22.0 (2024-02-13)

Expand Down
14 changes: 14 additions & 0 deletions src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,8 @@ impl<T: ThreadMode> DBWithThreadMode<T> {

/// Opens a database with the given database with a Time to Live compaction filter and
/// column family descriptors.
/// *NOTE*: `default` column family is opened with `Options::default()`.
/// If you want to open `default` cf with different options, set them explicitly in `cfs`.
pub fn open_cf_descriptors_with_ttl<P, I>(
opts: &Options,
path: P,
Expand Down Expand Up @@ -454,6 +456,8 @@ impl<T: ThreadMode> DBWithThreadMode<T> {
}

/// Opens a database for read only with the given database options and column family names.
/// *NOTE*: `default` column family is opened with `Options::default()`.
/// If you want to open `default` cf with different options, set them explicitly in `cfs`.
pub fn open_cf_for_read_only<P, I, N>(
opts: &Options,
path: P,
Expand All @@ -480,6 +484,8 @@ impl<T: ThreadMode> DBWithThreadMode<T> {
}

/// Opens a database for read only with the given database options and column family names.
/// *NOTE*: `default` column family is opened with `Options::default()`.
/// If you want to open `default` cf with different options, set them explicitly in `cfs`.
pub fn open_cf_with_opts_for_read_only<P, I, N>(
db_opts: &Options,
path: P,
Expand Down Expand Up @@ -507,6 +513,8 @@ impl<T: ThreadMode> DBWithThreadMode<T> {

/// Opens a database for ready only with the given database options and
/// column family descriptors.
/// *NOTE*: `default` column family is opened with `Options::default()`.
/// If you want to open `default` cf with different options, set them explicitly in `cfs`.
pub fn open_cf_descriptors_read_only<P, I>(
opts: &Options,
path: P,
Expand All @@ -528,6 +536,8 @@ impl<T: ThreadMode> DBWithThreadMode<T> {
}

/// Opens the database as a secondary with the given database options and column family names.
/// *NOTE*: `default` column family is opened with `Options::default()`.
/// If you want to open `default` cf with different options, set them explicitly in `cfs`.
pub fn open_cf_as_secondary<P, I, N>(
opts: &Options,
primary_path: P,
Expand Down Expand Up @@ -555,6 +565,8 @@ impl<T: ThreadMode> DBWithThreadMode<T> {

/// Opens the database as a secondary with the given database options and
/// column family descriptors.
/// *NOTE*: `default` column family is opened with `Options::default()`.
/// If you want to open `default` cf with different options, set them explicitly in `cfs`.
pub fn open_cf_descriptors_as_secondary<P, I>(
opts: &Options,
path: P,
Expand All @@ -576,6 +588,8 @@ impl<T: ThreadMode> DBWithThreadMode<T> {
}

/// Opens a database with the given database options and column family descriptors.
/// *NOTE*: `default` column family is opened with `Options::default()`.
/// If you want to open `default` cf with different options, set them explicitly in `cfs`.
pub fn open_cf_descriptors<P, I>(opts: &Options, path: P, cfs: I) -> Result<Self, Error>
where
P: AsRef<Path>,
Expand Down
3 changes: 3 additions & 0 deletions src/transactions/optimistic_transaction_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ impl<T: ThreadMode> OptimisticTransactionDB<T> {
/// Opens a database with the given database options and column family names.
///
/// Column families opened using this function will be created with default `Options`.
/// *NOTE*: `default` column family will be opened with the `Options::default()`.
/// If you want to open `default` column family with custom options, use `open_cf_descriptors` and
/// provide a `ColumnFamilyDescriptor` with the desired options.
pub fn open_cf<P, I, N>(opts: &Options, path: P, cfs: I) -> Result<Self, Error>
where
P: AsRef<Path>,
Expand Down
Loading