rocksdb/db/db_impl
Yi Wu 2730fe693e Fix ingested file and direcotry not being sync (#5435)
Summary:
It it not safe to assume application had sync the SST file before ingest it into DB. Also the directory to put the ingested file needs to be fsync, otherwise the file can be lost. For integrity of RocksDB we need to sync the ingested file and directory before apply the change to manifest.

Also syncing after writing global sequence when write_global_seqno=true was removed in https://github.com/facebook/rocksdb/issues/4172. Adding it back.

Fixes https://github.com/facebook/rocksdb/issues/5287.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5435

Test Plan:
Test ingest file with ldb command and observe fsync/fdatasync in strace output. Tried both move_files=true and move_files=false.
https://gist.github.com/yiwu-arbug/650a4023f57979056d83485fa863bef9

More test suggestions are welcome.

Differential Revision: D15941675

Pulled By: riversand963

fbshipit-source-id: 389533f3923065a96df2cdde23ff4724a1810d78
2019-06-21 10:15:38 -07:00
..
db_impl_compaction_flush.cc Potential fix for stress test failure due to "SST file ahead of WAL" error (#5412) 2019-06-07 15:35:47 -07:00
db_impl_debug.cc Persistent Stats: persist stats history to disk (#5046) 2019-06-17 15:21:50 -07:00
db_impl_experimental.cc simplify include directive involving inttypes (#5402) 2019-06-06 13:56:07 -07:00
db_impl_files.cc simplify include directive involving inttypes (#5402) 2019-06-06 13:56:07 -07:00
db_impl_open.cc Fix ingested file and direcotry not being sync (#5435) 2019-06-21 10:15:38 -07:00
db_impl_readonly.cc Make format 2019-05-31 15:24:43 -07:00
db_impl_readonly.h Organizing rocksdb/db directory 2019-05-31 11:57:01 -07:00
db_impl_secondary.cc Override check consistency for DBImplSecondary (#5469) 2019-06-17 15:39:55 -07:00
db_impl_secondary.h Override check consistency for DBImplSecondary (#5469) 2019-06-17 15:39:55 -07:00
db_impl_write.cc WritePrepared: reduce prepared_mutex_ overhead (#5420) 2019-06-10 11:53:31 -07:00
db_impl.cc Fix ingested file and direcotry not being sync (#5435) 2019-06-21 10:15:38 -07:00
db_impl.h Fix ingested file and direcotry not being sync (#5435) 2019-06-21 10:15:38 -07:00
db_secondary_test.cc Fix a bug caused by secondary not skipping the beginning of new MANIFEST (#5472) 2019-06-18 11:21:37 -07:00