summaryrefslogtreecommitdiff
path: root/test/suite/test_checkpoint01.py
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2012-08-16 16:14:27 +0000
committerKeith Bostic <keith@wiredtiger.com>2012-08-16 16:14:27 +0000
commitdc08180becbeae6e775e5a76b9c0039219f1ff9d (patch)
tree906ae18bafdb4b8a24516b0ecbdba7c7c4b9b37b /test/suite/test_checkpoint01.py
parent188e056b75aae253f3511c69d4c7954b9a020bd0 (diff)
downloadmongo-dc08180becbeae6e775e5a76b9c0039219f1ff9d.tar.gz
If the application does a checkpoint (regardless whether it's named or
internal), a checkpoint by the name must exist. This is complicated by the fact that this applies to empty row-store files as well which we go to some effort to avoid writing. Ref #301. Re-work the checkpoint code to skip unmodified objects when closing a file (whatever checkpoints we have at that point are sufficient), and to skip unmodified objects when the checkpoint we're taking is named the same as the last checkpoint we have and we're not deleting other checkpoints (which might free up space). Remove the recent change that made the __wt_page_modify_set function also mark the tree dirty: this is incorrect because the "dirty page" flag climbs the tree during reconciliation: that doesn't mean the tree is no longer "clean", the process of checkpointing is what cleans the tree. Change the btree handle create functions, and the btree salvage functions, to set the tree and page dirty flags when instantiating new pages (it doesn't matter whether we do or not, because currently the tree flag only matters to the checkpoint function, but it's no longer a problem either, and it's consistent with the way we handle other "dirty" operations).
Diffstat (limited to 'test/suite/test_checkpoint01.py')
-rw-r--r--test/suite/test_checkpoint01.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/suite/test_checkpoint01.py b/test/suite/test_checkpoint01.py
index 4596ae8e971..a279ce937d9 100644
--- a/test/suite/test_checkpoint01.py
+++ b/test/suite/test_checkpoint01.py
@@ -328,6 +328,48 @@ class test_checkpoint_last_name(wttest.WiredTigerTestCase):
self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
lambda: self.session.checkpoint(conf), msg)
+class test_checkpoint_empty(wttest.WiredTigerTestCase):
+ scenarios = [
+ ('file', dict(uri='file:checkpoint')),
+ ('table', dict(uri='table:checkpoint')),
+ ]
+
+ # Create an empty file, do one of 4 cases of checkpoint, then verify the
+ # checkpoints exist. The reason for the 4 cases is we must create all
+ # checkpoints an application can explicitly reference using a cursor, and
+ # I want to test when other types of checkpoints are created before the
+ # checkpoint we really need.
+ # Case 1: a named checkpoint
+ def test_checkpoint_empty_one(self):
+ self.session.create(self.uri, "key_format=S,value_format=S")
+ self.session.checkpoint('name=ckpt')
+ cursor = self.session.open_cursor(self.uri, None, "checkpoint=ckpt")
+
+ # Case 2: an internal checkpoint
+ def test_checkpoint_empty_two(self):
+ self.session.create(self.uri, "key_format=S,value_format=S")
+ self.session.checkpoint()
+ cursor = self.session.open_cursor(
+ self.uri, None, "checkpoint=WiredTigerCheckpoint")
+
+ # Case 3: a named checkpoint, then an internal checkpoint
+ def test_checkpoint_empty_three(self):
+ self.session.create(self.uri, "key_format=S,value_format=S")
+ self.session.checkpoint('name=ckpt')
+ self.session.checkpoint()
+ cursor = self.session.open_cursor(self.uri, None, "checkpoint=ckpt")
+ cursor = self.session.open_cursor(
+ self.uri, None, "checkpoint=WiredTigerCheckpoint")
+
+ # Case 4: an internal checkpoint, then a named checkpoint
+ def test_checkpoint_empty_four(self):
+ self.session.create(self.uri, "key_format=S,value_format=S")
+ self.session.checkpoint()
+ self.session.checkpoint('name=ckpt')
+ cursor = self.session.open_cursor(self.uri, None, "checkpoint=ckpt")
+ cursor = self.session.open_cursor(
+ self.uri, None, "checkpoint=WiredTigerCheckpoint")
+
if __name__ == '__main__':
wttest.run()