summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDon Anderson <dda@ddanderson.com>2015-02-04 22:05:19 -0500
committerDon Anderson <dda@ddanderson.com>2015-02-04 22:05:19 -0500
commit1d9198072faa07ecba2ef8a0fb8312c2a58e6730 (patch)
treef0e6e2f486c71cb81ff4ac62e2fee9cd9f08db93 /test
parent2f95ff08a58a937db469bb40fe4434409e240512 (diff)
downloadmongo-1d9198072faa07ecba2ef8a0fb8312c2a58e6730.tar.gz
Add a test for log cursor. Refs #1530
Diffstat (limited to 'test')
-rw-r--r--test/suite/test_txn08.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/suite/test_txn08.py b/test/suite/test_txn08.py
index f8abd52ca47..cdafe2f3386 100644
--- a/test/suite/test_txn08.py
+++ b/test/suite/test_txn08.py
@@ -40,6 +40,7 @@ class test_txn08(wttest.WiredTigerTestCase, suite_subprocess):
logmax = "100K"
tablename = 'test_txn08'
uri = 'table:' + tablename
+ nkeys = 5
# Overrides WiredTigerTestCase
def setUpConnectionOpen(self, dir):
@@ -60,6 +61,22 @@ class test_txn08(wttest.WiredTigerTestCase, suite_subprocess):
self.session2 = conn.open_session()
return conn
+ def walk_log(self, match):
+ cursor = self.session.open_cursor("log:", None);
+ count = 0
+ while cursor.next() == 0:
+ # lsn.file, lsn.offset, opcount
+ keys = cursor.get_key()
+ # txnid, rectype, optype, fileid, logrec_key, logrec_value
+ values = cursor.get_value()
+ try:
+ if match in str(values[5]): # logrec_value
+ count += 1
+ except:
+ pass
+ cursor.close()
+ self.assertEqual(count, self.nkeys)
+
def test_printlog_unicode(self):
# print "Creating %s with config '%s'" % (self.uri, self.create_params)
create_params = 'key_format=i,value_format=S'
@@ -71,7 +88,7 @@ class test_txn08(wttest.WiredTigerTestCase, suite_subprocess):
value = u'\u0001\u0002abcd\u0003\u0004'
self.session.begin_transaction()
- for k in range(5):
+ for k in range(self.nkeys):
c.set_key(k)
c.set_value(value)
c.insert()
@@ -85,5 +102,10 @@ class test_txn08(wttest.WiredTigerTestCase, suite_subprocess):
self.check_file_contains('printlog.out',
'\\u0001\\u0002abcd\\u0003\\u0004')
+ #
+ # Check the log for these values via a log cursor
+ #
+ self.walk_log(value)
+
if __name__ == '__main__':
wttest.run()