]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commit
Rely on PurgeObsoleteFiles Only for Options file clean up when remote compaction...
authorJay Huh <jewoongh@meta.com>
Fri, 15 Nov 2024 22:21:32 +0000 (14:21 -0800)
committerJay Huh <jewoongh@meta.com>
Mon, 18 Nov 2024 15:55:39 +0000 (07:55 -0800)
commit778f25fbbde773bf63c49033362aacd967d1d33f
tree2b0a610f1a321124c7c7d5cf4f42118f02f158a9
parent1b497c95b3d7c672b8082671abd8fdb1fcea2526
Rely on PurgeObsoleteFiles Only for Options file clean up when remote compaction is enabled (#13139)

Summary:
In PR https://github.com/facebook/rocksdb/issues/13074 , we added a logic to prevent stale OPTIONS file from getting deleted by `PurgeObsoleteFiles()` if the OPTIONS file is being referenced by any of the scheduled the remote compactions.

`PurgeObsoleteFiles()` was not the only place that we were cleaning up the old OPTIONS file. We've been also directly cleaning up the old OPTIONS file as part of `SetOptions()`: `RenameTempFileToOptionsFile()` -> `DeleteObsoleteOptionsFiles()` unless FileDeletion is disabled.

This was not caught by the UnitTest because we always preserve the last two OPTIONS file. A single call of `SetOptions()` was not enough to surface this issue in the previous PR.

To keep things simple, we are just skipping the old OPTIONS file clean up in `RenameTempFileToOptionsFile()` if remote compaction is enabled. We let `PurgeObsoleteFiles()` clean up the old options file later after the compaction is done.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/13139

Test Plan:
Updated UnitTest to reproduce the scenario. It's now passing with the fix.

```
./compaction_service_test --gtest_filter="*PreservedOptionsRemoteCompaction*"
```

Reviewed By: cbi42

Differential Revision: D65974726

Pulled By: jaykorean

fbshipit-source-id: 1907e8450d2ccbb42a93084f275e666648ef5b8c
db/compaction/compaction_service_test.cc
db/db_impl/db_impl.cc
db/db_impl/db_impl.h
db/db_impl/db_impl_secondary.cc
options/options_helper.cc