Skip to content

Commit

Permalink
fix(rocksdb): turn off write_global_seqno by default (#1563)
Browse files Browse the repository at this point in the history
#1562

Add this option to turn off rocksdb modifying `rocksdb.external_sst_file.global_seqno`
field of external sst file during ingest process. This is used to address a coredump
caused by incorrect field value in RocksDB. This pull request fixs the bug above.
Rocksdb 6.6.4 no longer recommends using this field.

```diff
[pegasus.server]
+ rocksdb_write_global_seqno = false
```
  • Loading branch information
ruojieranyishen authored Jul 11, 2023
1 parent 6146233 commit 99456f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/server/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ stateful = true
rocksdb_block_cache_capacity = 10737418240
rocksdb_block_cache_num_shard_bits = -1
rocksdb_disable_bloom_filter = false
rocksdb_write_global_seqno = false
# Bloom filter type, should be either 'common' or 'prefix'
rocksdb_filter_type = prefix
# rocksdb_bloom_filter_bits_per_key | false positive rate
Expand Down
7 changes: 7 additions & 0 deletions src/server/rocksdb_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ DSN_DEFINE_int32(pegasus.server,
0,
"Which error code to inject in write path, 0 means no error. Only for test.");
DSN_TAG_VARIABLE(inject_write_error_for_test, FT_MUTABLE);
DSN_DEFINE_bool(pegasus.server,
rocksdb_write_global_seqno,
false,
"If write_global_seqno is true, rocksdb will modify "
"'rocksdb.external_sst_file.global_seqno' of ssttable file during ingest process. "
"If false, it will not be modified.");

rocksdb_wrapper::rocksdb_wrapper(pegasus_server_impl *server)
: replica_base(server),
Expand Down Expand Up @@ -212,6 +218,7 @@ int rocksdb_wrapper::ingest_files(int64_t decree,
rocksdb::IngestExternalFileOptions ifo;
ifo.move_files = true;
ifo.ingest_behind = ingest_behind;
ifo.write_global_seqno = FLAGS_rocksdb_write_global_seqno;
rocksdb::Status s = _db->IngestExternalFile(sst_file_list, ifo);
if (dsn_unlikely(!s.ok())) {
LOG_ERROR_ROCKSDB("IngestExternalFile",
Expand Down

0 comments on commit 99456f4

Please sign in to comment.