mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-26 07:30:54 +00:00
Add WAL flush API to C client (#8226)
Summary: The C client is missing the`manual_wal_flush` option and the `flush_wal` API. Pull Request resolved: https://github.com/facebook/rocksdb/pull/8226 Reviewed By: ajkr Differential Revision: D28000869 Pulled By: jay-zhuang fbshipit-source-id: ed44937e7e7e75bc0dfa870a14147fbeef0c38f8
This commit is contained in:
parent
65abb0cf71
commit
3949731de3
13
db/c.cc
13
db/c.cc
|
@ -1512,6 +1512,10 @@ void rocksdb_flush_cf(
|
|||
SaveError(errptr, db->rep->Flush(options->rep, column_family->rep));
|
||||
}
|
||||
|
||||
void rocksdb_flush_wal(rocksdb_t* db, unsigned char sync, char** errptr) {
|
||||
SaveError(errptr, db->rep->FlushWAL(sync));
|
||||
}
|
||||
|
||||
void rocksdb_disable_file_deletions(
|
||||
rocksdb_t* db,
|
||||
char** errptr) {
|
||||
|
@ -3479,6 +3483,15 @@ unsigned char rocksdb_options_get_atomic_flush(rocksdb_options_t* opt) {
|
|||
return opt->rep.atomic_flush;
|
||||
}
|
||||
|
||||
void rocksdb_options_set_manual_wal_flush(rocksdb_options_t* opt,
|
||||
unsigned char manual_wal_flush) {
|
||||
opt->rep.manual_wal_flush = manual_wal_flush;
|
||||
}
|
||||
|
||||
unsigned char rocksdb_options_get_manual_wal_flush(rocksdb_options_t* opt) {
|
||||
return opt->rep.manual_wal_flush;
|
||||
}
|
||||
|
||||
rocksdb_ratelimiter_t* rocksdb_ratelimiter_create(
|
||||
int64_t rate_bytes_per_sec,
|
||||
int64_t refill_period_us,
|
||||
|
|
|
@ -1279,6 +1279,9 @@ int main(int argc, char** argv) {
|
|||
CheckPinGetCF(db, roptions, handles[1], "box", "c");
|
||||
rocksdb_writebatch_destroy(wb);
|
||||
|
||||
rocksdb_flush_wal(db, 1, &err);
|
||||
CheckNoError(err);
|
||||
|
||||
const char* keys[3] = { "box", "box", "barfooxx" };
|
||||
const rocksdb_column_family_handle_t* get_handles[3] = { handles[0], handles[1], handles[1] };
|
||||
const size_t keys_sizes[3] = { 3, 3, 8 };
|
||||
|
@ -1762,6 +1765,9 @@ int main(int argc, char** argv) {
|
|||
rocksdb_options_set_atomic_flush(o, 1);
|
||||
CheckCondition(1 == rocksdb_options_get_atomic_flush(o));
|
||||
|
||||
rocksdb_options_set_manual_wal_flush(o, 1);
|
||||
CheckCondition(1 == rocksdb_options_get_manual_wal_flush(o));
|
||||
|
||||
/* Blob Options */
|
||||
rocksdb_options_set_enable_blob_files(o, 1);
|
||||
CheckCondition(1 == rocksdb_options_get_enable_blob_files(o));
|
||||
|
|
|
@ -539,6 +539,10 @@ 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_wal(rocksdb_t* db,
|
||||
unsigned char sync,
|
||||
char** errptr);
|
||||
|
||||
extern ROCKSDB_LIBRARY_API void rocksdb_disable_file_deletions(rocksdb_t* db,
|
||||
char** errptr);
|
||||
|
||||
|
@ -1417,6 +1421,10 @@ extern ROCKSDB_LIBRARY_API void rocksdb_options_set_row_cache(
|
|||
extern ROCKSDB_LIBRARY_API void
|
||||
rocksdb_options_add_compact_on_deletion_collector_factory(
|
||||
rocksdb_options_t*, size_t window_size, size_t num_dels_trigger);
|
||||
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_manual_wal_flush(
|
||||
rocksdb_options_t* opt, unsigned char);
|
||||
extern ROCKSDB_LIBRARY_API unsigned char rocksdb_options_get_manual_wal_flush(
|
||||
rocksdb_options_t* opt);
|
||||
|
||||
/* RateLimiter */
|
||||
extern ROCKSDB_LIBRARY_API rocksdb_ratelimiter_t* rocksdb_ratelimiter_create(
|
||||
|
|
Loading…
Reference in a new issue