summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/test/suite/test_bug019.py
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2018-03-27 10:29:16 +1100
committerLuke Chen <luke.chen@mongodb.com>2018-03-27 10:29:16 +1100
commite93e3e7930f844bf830715dfecbb602eefe48b8e (patch)
treedf168729a1b9906fb1f0f03fe0352ad5c39c84d0 /src/third_party/wiredtiger/test/suite/test_bug019.py
parent152885358a4ecab312c690b2ffee5dfb7c37311a (diff)
downloadmongo-e93e3e7930f844bf830715dfecbb602eefe48b8e.tar.gz
Import wiredtiger: 875e91581c63e1e4d47c547291f0a582f30eddae from branch mongodb-3.8
ref: cce16aa64e..875e91581c for: 3.7.4 WT-3869 Bi-weekly WT codebase lint WT-3979 Fix warnings generated with newer Doxygen releases WT-3982 Fix transaction visibility bugs related to lookaside usage. WT-3985 Pre-allocated log files accumulate on Windows WT-3987 Avoid reading lookaside pages in truncate fast path WT-3990 Fix Coverity tickets
Diffstat (limited to 'src/third_party/wiredtiger/test/suite/test_bug019.py')
-rw-r--r--src/third_party/wiredtiger/test/suite/test_bug019.py82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/third_party/wiredtiger/test/suite/test_bug019.py b/src/third_party/wiredtiger/test/suite/test_bug019.py
new file mode 100644
index 00000000000..202ca6b6b60
--- /dev/null
+++ b/src/third_party/wiredtiger/test/suite/test_bug019.py
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+#
+# Public Domain 2014-2018 MongoDB, Inc.
+# Public Domain 2008-2014 WiredTiger, Inc.
+#
+# This is free and unencumbered software released into the public domain.
+#
+# Anyone is free to copy, modify, publish, use, compile, sell, or
+# distribute this software, either in source code form or as a compiled
+# binary, for any purpose, commercial or non-commercial, and by any
+# means.
+#
+# In jurisdictions that recognize copyright laws, the author or authors
+# of this software dedicate any and all copyright interest in the
+# software to the public domain. We make this dedication for the benefit
+# of the public at large and to the detriment of our heirs and
+# successors. We intend this dedication to be an overt act of
+# relinquishment in perpetuity of all present and future rights to this
+# software under copyright law.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+
+import fnmatch, os, time
+import wiredtiger, wttest
+from wtdataset import SimpleDataSet
+
+# test_bug019.py
+# Test that pre-allocating log files only pre-allocates a small number.
+class test_bug019(wttest.WiredTigerTestCase):
+ conn_config = 'log=(enabled,file_max=100K)'
+ uri = "table:bug019"
+ entries = 100000
+
+ # Modify rows so we write log records. We're writing a lot more than a
+ # single log file, so we know the underlying library will churn through
+ # log files.
+ def populate(self, nentries):
+ c = self.session.open_cursor(self.uri, None, None)
+ for i in range(0, nentries):
+ c[i] = i
+ c.close()
+
+ # Wait for a log file to be pre-allocated. Avoid timing problems, but
+ # assert a file is created within 30 seconds.
+ def prepfiles(self):
+ for i in range(1,30):
+ f = fnmatch.filter(os.listdir('.'), "*Prep*")
+ if f:
+ return f
+ time.sleep(1)
+ self.assertFalse(not f)
+
+ # There was a bug where pre-allocated log files accumulated on
+ # Windows systems due to an issue with the directory list code.
+ def test_bug019(self):
+ # Create a table just to write something into the log.
+ self.session.create(self.uri, 'key_format=i,value_format=i')
+ self.populate(self.entries)
+ self.session.checkpoint()
+
+ # Loop, making sure pre-allocation is working and the range is moving.
+ older = self.prepfiles()
+ for i in range(1, 10):
+ self.populate(self.entries)
+ newer = self.prepfiles()
+
+ # Files can be returned in any order when reading a directory, older
+ # pre-allocated files can persist longer than newer files when newer
+ # files are returned first. Confirm files are being consumed.
+ self.assertFalse(set(older) < set(newer))
+
+ older = newer
+ self.session.checkpoint()
+
+if __name__ == '__main__':
+ wttest.run()