From 3130eb49151c823e9d2c63d6f8f34db13db8d52a Mon Sep 17 00:00:00 2001 From: linxGnu Date: Sat, 7 Sep 2024 10:47:33 +0700 Subject: [PATCH] Adapt RocksDB 9.5.2 --- README.md | 4 +++- build.sh | 2 +- c.h | 25 +++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0c2e317..cbaec87 100644 --- a/README.md +++ b/README.md @@ -73,5 +73,7 @@ Almost C API, excepts: - [ ] compaction_filter/compaction_filter_factory/compaction_filter_context - [ ] transactiondb_property_value/transactiondb_property_int - [ ] optimistictransactiondb_property_value/optimistictransactiondb_property_int -- [ ] writebatch_update_timestamps/writebatch_wi_update_timestamps +- [ ] writebatch_update_timestamps/writebatch_wi_update_timestamps/writebatch_iterate_cf +- [ ] approximate_sizes_cf_with_flags +- [ ] logger_create_callback_logger diff --git a/build.sh b/build.sh index ab75730..2f8cdfd 100755 --- a/build.sh +++ b/build.sh @@ -37,7 +37,7 @@ cd $BUILD_PATH && wget https://github.com/facebook/zstd/archive/v${zstd_version} # Note: if you don't have a good reason, please do not set -DPORTABLE=ON # This one is set here on purpose of compatibility with github action runtime processor -rocksdb_version="9.4.0" +rocksdb_version="9.5.2" cd $BUILD_PATH && wget https://github.com/facebook/rocksdb/archive/v${rocksdb_version}.tar.gz && tar xzf v${rocksdb_version}.tar.gz && cd rocksdb-${rocksdb_version}/ && \ mkdir -p build_place && cd build_place && cmake -DCMAKE_BUILD_TYPE=Release $CMAKE_REQUIRED_PARAMS -DCMAKE_PREFIX_PATH=$INSTALL_PREFIX -DWITH_TESTS=OFF -DWITH_GFLAGS=OFF \ -DWITH_BENCHMARK_TOOLS=OFF -DWITH_TOOLS=OFF -DWITH_MD_LIBRARY=OFF -DWITH_RUNTIME_DEBUG=OFF -DROCKSDB_BUILD_SHARED=OFF -DWITH_SNAPPY=ON -DWITH_LZ4=ON -DWITH_ZLIB=ON -DWITH_LIBURING=OFF \ diff --git a/c.h b/c.h index 99d55a6..9f91f76 100644 --- a/c.h +++ b/c.h @@ -650,6 +650,19 @@ extern ROCKSDB_LIBRARY_API void rocksdb_approximate_sizes_cf( const size_t* range_start_key_len, const char* const* range_limit_key, const size_t* range_limit_key_len, uint64_t* sizes, char** errptr); +enum { + rocksdb_size_approximation_flags_none = 0, + rocksdb_size_approximation_flags_include_memtable = 1 << 0, + rocksdb_size_approximation_flags_include_files = 1 << 1, +}; + +extern ROCKSDB_LIBRARY_API void rocksdb_approximate_sizes_cf_with_flags( + rocksdb_t* db, rocksdb_column_family_handle_t* column_family, + int num_ranges, const char* const* range_start_key, + const size_t* range_start_key_len, const char* const* range_limit_key, + const size_t* range_limit_key_len, uint8_t include_flags, uint64_t* sizes, + char** errptr); + extern ROCKSDB_LIBRARY_API void rocksdb_compact_range(rocksdb_t* db, const char* start_key, size_t start_key_len, @@ -850,6 +863,13 @@ extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_iterate( rocksdb_writebatch_t*, void* state, void (*put)(void*, const char* k, size_t klen, const char* v, size_t vlen), void (*deleted)(void*, const char* k, size_t klen)); +extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_iterate_cf( + rocksdb_writebatch_t*, void* state, + void (*put_cf)(void*, uint32_t cfid, const char* k, size_t klen, + const char* v, size_t vlen), + void (*deleted_cf)(void*, uint32_t cfid, const char* k, size_t klen), + void (*merge_cf)(void*, uint32_t cfid, const char* k, size_t klen, + const char* v, size_t vlen)); extern ROCKSDB_LIBRARY_API const char* rocksdb_writebatch_data( rocksdb_writebatch_t*, size_t* size); extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_set_save_point( @@ -1205,6 +1225,11 @@ extern ROCKSDB_LIBRARY_API int rocksdb_options_get_info_log_level( rocksdb_options_t*); extern ROCKSDB_LIBRARY_API rocksdb_logger_t* rocksdb_logger_create_stderr_logger(int log_level, const char* prefix); +extern ROCKSDB_LIBRARY_API rocksdb_logger_t* +rocksdb_logger_create_callback_logger(int log_level, + void (*)(void* priv, unsigned lev, + char* msg, size_t len), + void* priv); extern ROCKSDB_LIBRARY_API void rocksdb_logger_destroy( rocksdb_logger_t* logger); extern ROCKSDB_LIBRARY_API void rocksdb_options_set_write_buffer_size(