From 084a3c697c86d0075eae01226beb55612822da42 Mon Sep 17 00:00:00 2001 From: niukuo Date: Thu, 25 Apr 2019 11:20:01 -0700 Subject: [PATCH] add missing rocksdb_flush_cf in c (#5243) Summary: same to #5229 Pull Request resolved: https://github.com/facebook/rocksdb/pull/5243 Differential Revision: D15082800 Pulled By: siying fbshipit-source-id: f4a68a480db0e40e1ba7cf37e18b88e43dff7c08 --- db/c.cc | 8 ++++++++ db/c_test.c | 6 ++++++ include/rocksdb/c.h | 4 ++++ 3 files changed, 18 insertions(+) diff --git a/db/c.cc b/db/c.cc index 8610871ab..e135c5bf8 100644 --- a/db/c.cc +++ b/db/c.cc @@ -1183,6 +1183,14 @@ void rocksdb_flush( SaveError(errptr, db->rep->Flush(options->rep)); } +void rocksdb_flush_cf( + rocksdb_t* db, + const rocksdb_flushoptions_t* options, + rocksdb_column_family_handle_t* column_family, + char** errptr) { + SaveError(errptr, db->rep->Flush(options->rep, column_family->rep)); +} + void rocksdb_disable_file_deletions( rocksdb_t* db, char** errptr) { diff --git a/db/c_test.c b/db/c_test.c index e403ce572..64241df28 100644 --- a/db/c_test.c +++ b/db/c_test.c @@ -1188,6 +1188,12 @@ int main(int argc, char** argv) { rocksdb_put_cf(db, woptions, handles[1], "foo", 3, "hello", 5, &err); CheckNoError(err); + rocksdb_flushoptions_t *flush_options = rocksdb_flushoptions_create(); + rocksdb_flushoptions_set_wait(flush_options, 1); + rocksdb_flush_cf(db, flush_options, handles[1], &err); + CheckNoError(err) + rocksdb_flushoptions_destroy(flush_options); + CheckGetCF(db, roptions, handles[1], "foo", "hello"); CheckPinGetCF(db, roptions, handles[1], "foo", "hello"); diff --git a/include/rocksdb/c.h b/include/rocksdb/c.h index 05699492c..0e335c8d1 100644 --- a/include/rocksdb/c.h +++ b/include/rocksdb/c.h @@ -380,6 +380,10 @@ extern ROCKSDB_LIBRARY_API const rocksdb_livefiles_t* rocksdb_livefiles( extern ROCKSDB_LIBRARY_API void rocksdb_flush( rocksdb_t* db, const rocksdb_flushoptions_t* options, char** errptr); +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_disable_file_deletions(rocksdb_t* db, char** errptr);