C-API: Support multi-CF flush (#11112)

Summary:
This PR adds support to the c-api bindings for calling `Flush()` with multiple column families, which is useful for performing atomic flushes (assuming also that the db has been opened with `atomic_flush = true`).

Pull Request resolved: https://github.com/facebook/rocksdb/pull/11112

Reviewed By: cbi42

Differential Revision: D42666382

Pulled By: ajkr

fbshipit-source-id: 82f05bf32d28452d85c79ea42411c8fea961fd87
oxigraph-8.1.1
Matt Jurik 2 years ago committed by Facebook GitHub Bot
parent fcd816d534
commit 142b18d00b
  1. 23
      db/c.cc
  2. 10
      include/rocksdb/c.h

@ -1805,6 +1805,17 @@ void rocksdb_flush_cf(rocksdb_t* db, const rocksdb_flushoptions_t* options,
SaveError(errptr, db->rep->Flush(options->rep, column_family->rep));
}
void rocksdb_flush_cfs(rocksdb_t* db, const rocksdb_flushoptions_t* options,
rocksdb_column_family_handle_t** column_families,
int num_column_families, char** errptr) {
std::vector<ColumnFamilyHandle*> column_family_handles;
for (int i = 0; i < num_column_families; i++) {
column_family_handles.push_back(column_families[i]->rep);
}
SaveError(errptr, db->rep->Flush(options->rep, column_family_handles));
}
void rocksdb_flush_wal(rocksdb_t* db, unsigned char sync, char** errptr) {
SaveError(errptr, db->rep->FlushWAL(sync));
}
@ -6109,6 +6120,18 @@ void rocksdb_transactiondb_flush_cf(
SaveError(errptr, txn_db->rep->Flush(options->rep, column_family->rep));
}
void rocksdb_transactiondb_flush_cfs(
rocksdb_transactiondb_t* txn_db, const rocksdb_flushoptions_t* options,
rocksdb_column_family_handle_t** column_families, int num_column_families,
char** errptr) {
std::vector<ColumnFamilyHandle*> column_family_handles;
for (int i = 0; i < num_column_families; i++) {
column_family_handles.push_back(column_families[i]->rep);
}
SaveError(errptr, txn_db->rep->Flush(options->rep, column_family_handles));
}
rocksdb_checkpoint_t* rocksdb_transactiondb_checkpoint_object_create(
rocksdb_transactiondb_t* txn_db, char** errptr) {
Checkpoint* checkpoint;

@ -662,6 +662,11 @@ extern ROCKSDB_LIBRARY_API void rocksdb_flush_cf(
rocksdb_t* db, const rocksdb_flushoptions_t* options,
rocksdb_column_family_handle_t* column_family, char** errptr);
extern ROCKSDB_LIBRARY_API void rocksdb_flush_cfs(
rocksdb_t* db, const rocksdb_flushoptions_t* options,
rocksdb_column_family_handle_t** column_family, int num_column_families,
char** errptr);
extern ROCKSDB_LIBRARY_API void rocksdb_flush_wal(rocksdb_t* db,
unsigned char sync,
char** errptr);
@ -2622,6 +2627,11 @@ extern ROCKSDB_LIBRARY_API void rocksdb_transactiondb_flush_cf(
rocksdb_transactiondb_t* txn_db, const rocksdb_flushoptions_t* options,
rocksdb_column_family_handle_t* column_family, char** errptr);
extern ROCKSDB_LIBRARY_API void rocksdb_transactiondb_flush_cfs(
rocksdb_transactiondb_t* txn_db, const rocksdb_flushoptions_t* options,
rocksdb_column_family_handle_t** column_families, int num_column_families,
char** errptr);
extern ROCKSDB_LIBRARY_API void rocksdb_transactiondb_flush_wal(
rocksdb_transactiondb_t* txn_db, unsigned char sync, char** errptr);

Loading…
Cancel
Save