All of these are in the new code added past 3.10

1) Crash in env_win.cc that prevented db_test run to completion and some new tests
     2) Fix new corruption tests in DBTest by allowing a shared trunction of files. Note that this is generally needed ONLY for tests.
     3) Close database so WAL is closed prior to inducing corruption similar to what we did within Corruption tests.
This commit is contained in:
Dmitri Smirnov 2015-07-08 16:56:31 -07:00
parent 5219226d3d
commit d8586ab22b
3 changed files with 11 additions and 2 deletions

View File

@ -8725,6 +8725,15 @@ class RecoveryTestHelper {
test->dbname_ + "/" + wal_files.front()->PathName();
auto size = wal_files.front()->SizeFileBytes();
#ifdef OS_WIN
// Windows disk cache behaves differently. When we truncate
// the original content is still in the cache due to the original
// handle is still open. Generally, in Windows, one prohibits
// shared access to files and it is not needed for WAL but we allow
// it to induce corruption at various tests.
test->Close();
#endif
if (trunc) {
ASSERT_EQ(0, truncate(logfile_path.c_str(), size * off));
} else {

View File

@ -2405,7 +2405,7 @@ public:
queue_.push_back(BGItem());
queue_.back().function = function;
queue_.back().arg = arg;
queue_.back().arg = tag;
queue_.back().tag = tag;
queue_len_.store(queue_.size(), std::memory_order_relaxed);
if (!HasExcessiveThread()) {

View File

@ -215,7 +215,7 @@ int truncate(const char* path, int64_t len) {
HANDLE hFile = CreateFile(path,
GENERIC_READ | GENERIC_WRITE,
0, // No sharing while truncating
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
NULL, // Security attrs
OPEN_EXISTING, // Truncate existing file only
FILE_ATTRIBUTE_NORMAL,