Skip to content

Commit

Permalink
Adapt RocksDB 9.7.3 (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
linxGnu authored Oct 21, 2024
1 parent 4987dab commit c81ab26
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.6.1"
rocksdb_version="9.7.3"
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 \
Expand Down
4 changes: 4 additions & 0 deletions c.h
Original file line number Diff line number Diff line change
Expand Up @@ -1644,6 +1644,10 @@ extern ROCKSDB_LIBRARY_API unsigned char
rocksdb_options_get_write_dbid_to_manifest(rocksdb_options_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_write_dbid_to_manifest(
rocksdb_options_t*, unsigned char);
extern ROCKSDB_LIBRARY_API unsigned char
rocksdb_options_get_write_identity_file(rocksdb_options_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_write_identity_file(
rocksdb_options_t*, unsigned char);

extern ROCKSDB_LIBRARY_API unsigned char
rocksdb_options_get_track_and_verify_wals_in_manifest(rocksdb_options_t*);
Expand Down
15 changes: 15 additions & 0 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -2064,6 +2064,21 @@ func (opts *Options) IsDBIDWrittenToManifest() bool {
return charToBool(C.rocksdb_options_get_write_dbid_to_manifest(opts.c))
}

// WriteIdentityFile toggles identity file writting.
// It is expected that the Identity file will be obsoleted by recording
// DB ID in the manifest (see write_dbid_to_manifest). Setting this to true
// maintains the historical behavior of writing an Identity file, while
// setting to false is expected to be the future default. This option might
// eventually be obsolete and removed as Identity files are phased out.
func (opts *Options) WriteIdentityFile(v bool) {
C.rocksdb_options_set_write_identity_file(opts.c, boolToChar(v))
}

// IsIdentityFileWritten checks if identity file written.
func (opts *Options) IsIdentityFileWritten() bool {
return charToBool(C.rocksdb_options_get_write_identity_file(opts.c))
}

// ToggleTrackAndVerifyWALsInManifestFlag if true, the log numbers and sizes of the synced WALs are tracked
// in MANIFEST. During DB recovery, if a synced WAL is missing
// from disk, or the WAL's size does not match the recorded size in
Expand Down
8 changes: 6 additions & 2 deletions options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,9 @@ func TestOptions(t *testing.T) {
opts.SetMaxSubcompactions(3)
require.EqualValues(t, 3, opts.GetMaxSubcompactions())

require.False(t, opts.IsDBIDWrittenToManifest())
opts.WriteDBIDToManifest(true)
require.True(t, opts.IsDBIDWrittenToManifest())
opts.WriteDBIDToManifest(false)
require.False(t, opts.IsDBIDWrittenToManifest())

require.False(t, opts.TrackAndVerifyWALsInManifestFlag())
opts.ToggleTrackAndVerifyWALsInManifestFlag(true)
Expand Down Expand Up @@ -411,6 +411,10 @@ func TestOptions(t *testing.T) {
opts.SetTTL(123)
require.EqualValues(t, uint64(123), opts.GetTTL())

require.True(t, opts.IsIdentityFileWritten())
opts.WriteIdentityFile(false)
require.False(t, opts.IsIdentityFileWritten())

opts.SetWriteBufferManager(wbm)

lg := NewStderrLogger(InfoInfoLogLevel, "prefix")
Expand Down

0 comments on commit c81ab26

Please sign in to comment.