diff --git a/build.sh b/build.sh index 35ac226..ba932c0 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.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 \ diff --git a/c.h b/c.h index 9f91f76..ed403a6 100644 --- a/c.h +++ b/c.h @@ -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*); diff --git a/options.go b/options.go index 5cdf245..c5aa0ad 100644 --- a/options.go +++ b/options.go @@ -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 diff --git a/options_test.go b/options_test.go index f18f4b5..bc5c72d 100644 --- a/options_test.go +++ b/options_test.go @@ -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) @@ -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")