summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDon Anderson <dda@mongodb.com>2016-05-19 14:48:16 -0400
committerKeith Bostic <keith.bostic@mongodb.com>2016-05-19 14:48:16 -0400
commitdf54fd30bd12cd5a8bf6ab817ed3fac877f4833a (patch)
tree801ff2cca0312ab79aa77a7f1844de8d45b2b72f
parent9a6329b560e707c51a9018f2e07913e3fcd02e3b (diff)
downloadmongo-df54fd30bd12cd5a8bf6ab817ed3fac877f4833a.tar.gz
WT-2644 Fix 'wt load -r' (rename) with LSM (#2735)
* WT-2644 recognize lsm: URLs in the list of items to be renamed. * Add a test to load a dump file, renaming the url. Fix other dump/load tests, as the populate_check methods always use self.session. Up to now they were only confirming that tables in the current directory were correct, not tables in the dump.dir directory.
-rw-r--r--src/utilities/util_load.c1
-rw-r--r--test/suite/test_dump.py23
-rw-r--r--test/suite/wttest.py8
3 files changed, 20 insertions, 12 deletions
diff --git a/src/utilities/util_load.c b/src/utilities/util_load.c
index 696dc68630a..a81d06c6866 100644
--- a/src/utilities/util_load.c
+++ b/src/utilities/util_load.c
@@ -366,6 +366,7 @@ config_update(WT_SESSION *session, char **list)
if (WT_PREFIX_MATCH(*listp, "colgroup:") ||
WT_PREFIX_MATCH(*listp, "file:") ||
WT_PREFIX_MATCH(*listp, "index:") ||
+ WT_PREFIX_MATCH(*listp, "lsm:") ||
WT_PREFIX_MATCH(*listp, "table:"))
if (config_rename(session, listp, cmdname))
return (1);
diff --git a/test/suite/test_dump.py b/test/suite/test_dump.py
index fc1422155e2..d0163066639 100644
--- a/test/suite/test_dump.py
+++ b/test/suite/test_dump.py
@@ -26,7 +26,7 @@
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
-import os
+import os, shutil
import wiredtiger, wttest
from helper import \
complex_populate, complex_populate_check, \
@@ -42,6 +42,7 @@ class test_dump(wttest.WiredTigerTestCase, suite_subprocess):
dir='dump.dir' # Backup directory name
name = 'test_dump'
+ name2 = 'test_dumpb'
nentries = 2500
dumpfmt = [
@@ -109,6 +110,7 @@ class test_dump(wttest.WiredTigerTestCase, suite_subprocess):
# Create the object.
uri = self.uri + self.name
+ uri2 = self.uri + self.name2
self.populate(self, uri,
self.config + ',key_format=' + self.keyfmt, self.nentries)
@@ -130,19 +132,15 @@ class test_dump(wttest.WiredTigerTestCase, suite_subprocess):
self.assertEqual(not s1.symmetric_difference(s2), True)
# Check the object's contents
- conn = self.wiredtiger_open(self.dir)
- session = conn.open_session()
+ self.reopen_conn(self.dir)
self.populate_check(self, uri, self.nentries)
- conn.close()
- # Re-load the object again.
+ # Re-load the object again in the original directory.
+ self.reopen_conn('.')
self.runWt(['-h', self.dir, 'load', '-f', 'dump.out'])
# Check the contents, they shouldn't have changed.
- conn = self.wiredtiger_open(self.dir)
- session = conn.open_session()
self.populate_check(self, uri, self.nentries)
- conn.close()
# Re-load the object again, but confirm -n (no overwrite) fails.
self.runWt(['-h', self.dir,
@@ -158,5 +156,14 @@ class test_dump(wttest.WiredTigerTestCase, suite_subprocess):
self.check_non_empty_file('dumpidx.out')
self.compare_dump_values('dump.out', 'dumpidx.out')
+ # Re-load the object into a different table uri
+ shutil.rmtree(self.dir)
+ os.mkdir(self.dir)
+ self.runWt(['-h', self.dir, 'load', '-r', self.name2, '-f', 'dump.out'])
+
+ # Check the contents in the new table.
+ self.reopen_conn(self.dir)
+ self.populate_check(self, uri2, self.nentries)
+
if __name__ == '__main__':
wttest.run()
diff --git a/test/suite/wttest.py b/test/suite/wttest.py
index a1945b4325d..f7a2a5c8890 100644
--- a/test/suite/wttest.py
+++ b/test/suite/wttest.py
@@ -259,20 +259,20 @@ class WiredTigerTestCase(unittest.TestCase):
self.conn.close()
self.conn = None
- def open_conn(self):
+ def open_conn(self, directory="."):
"""
Open the connection if already closed.
"""
if self.conn == None:
- self.conn = self.setUpConnectionOpen(".")
+ self.conn = self.setUpConnectionOpen(directory)
self.session = self.setUpSessionOpen(self.conn)
- def reopen_conn(self):
+ def reopen_conn(self, directory="."):
"""
Reopen the connection.
"""
self.close_conn()
- self.open_conn()
+ self.open_conn(directory)
def setUp(self):
if not hasattr(self.__class__, 'wt_ntests'):