rocksdb/db/db_impl
Zichen Zhu 65893ad959 Explicitly closing all directory file descriptors (#10049)
Summary:
Currently, the DB directory file descriptor is left open until the deconstruction process (`DB::Close()` does not close the file descriptor). To verify this, comment out the lines between `db_ = nullptr` and `db_->Close()` (line 512, 513, 514, 515 in ldb_cmd.cc) to leak the ``db_'' object, build `ldb` tool and run
```
strace --trace=open,openat,close ./ldb --db=$TEST_TMPDIR --ignore_unknown_options put K1 V1 --create_if_missing
```
There is one directory file descriptor that is not closed in the strace log.

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

Test Plan: Add a new unit test DBBasicTest.DBCloseAllDirectoryFDs: Open a database with different WAL directory and three different data directories, and all directory file descriptors should be closed after calling Close(). Explicitly call Close() after a directory file descriptor is not used so that the counter of directory open and close should be equivalent.

Reviewed By: ajkr, hx235

Differential Revision: D36722135

Pulled By: littlepig2013

fbshipit-source-id: 07bdc2abc417c6b30997b9bbef1f79aa757b21ff
2022-06-01 18:03:34 -07:00
..
compacted_db_impl.cc Add timestamp support to CompactedDBImpl (#10030) 2022-05-24 12:14:10 -07:00
compacted_db_impl.h Add timestamp support to CompactedDBImpl (#10030) 2022-05-24 12:14:10 -07:00
db_impl.cc Explicitly closing all directory file descriptors (#10049) 2022-06-01 18:03:34 -07:00
db_impl.h Explicitly closing all directory file descriptors (#10049) 2022-06-01 18:03:34 -07:00
db_impl_compaction_flush.cc Move three info logging within DB Mutex to use log buffer (#10029) 2022-05-23 10:09:37 -07:00
db_impl_debug.cc Use std::numeric_limits<> (#9954) 2022-05-05 13:08:21 -07:00
db_impl_experimental.cc Track SST unique id in MANIFEST and verify (#9990) 2022-05-19 11:04:21 -07:00
db_impl_files.cc Persist the new MANIFEST after successfully syncing the new WAL during recovery (#9922) 2022-06-01 10:52:26 -07:00
db_impl_open.cc Get current LogFileNumberSize the same as log_writer (#10086) 2022-06-01 15:33:22 -07:00
db_impl_readonly.cc Add timestamp support to DBImplReadOnly (#10004) 2022-05-19 18:39:41 -07:00
db_impl_readonly.h Add timestamp support to DBImplReadOnly (#10004) 2022-05-19 18:39:41 -07:00
db_impl_secondary.cc Persist the new MANIFEST after successfully syncing the new WAL during recovery (#9922) 2022-06-01 10:52:26 -07:00
db_impl_secondary.h Persist the new MANIFEST after successfully syncing the new WAL during recovery (#9922) 2022-06-01 10:52:26 -07:00
db_impl_write.cc Get current LogFileNumberSize the same as log_writer (#10086) 2022-06-01 15:33:22 -07:00