diff options
author | Don Anderson <dda@mongodb.com> | 2017-06-14 11:29:28 -0400 |
---|---|---|
committer | Alex Gorrod <alexander.gorrod@mongodb.com> | 2017-06-19 15:23:54 +0000 |
commit | ef9d122dd17b40e04dd98c7cf97932deb7a1b76e (patch) | |
tree | a1b5a770d79d75ea6623590cef07cee91d7cb0d4 | |
parent | 04a157830061d57309a2f8fe99e9979203ac71bf (diff) | |
download | mongo-ef9d122dd17b40e04dd98c7cf97932deb7a1b76e.tar.gz |
WT-3369 WT_CURSOR->uri should always match the URI used to open the cursor (#3464)
-rw-r--r-- | src/cursor/cur_table.c | 6 | ||||
-rw-r--r-- | src/lsm/lsm_cursor.c | 4 | ||||
-rw-r--r-- | test/suite/test_cursor01.py | 1 |
3 files changed, 8 insertions, 3 deletions
diff --git a/src/cursor/cur_table.c b/src/cursor/cur_table.c index 3b72bb0730f..f6855172e90 100644 --- a/src/cursor/cur_table.c +++ b/src/cursor/cur_table.c @@ -943,6 +943,12 @@ __wt_curtable_open(WT_SESSION_IMPL *session, table->cgroups[0]->source, NULL, cfg, cursorp); __wt_schema_release_table(session, table); + if (ret == 0) { + /* Fix up the public URI to match what was passed in. */ + cursor = *cursorp; + __wt_free(session, cursor->uri); + WT_TRET(__wt_strdup(session, uri, &cursor->uri)); + } return (ret); } diff --git a/src/lsm/lsm_cursor.c b/src/lsm/lsm_cursor.c index 52265f02e62..4d00143b28f 100644 --- a/src/lsm/lsm_cursor.c +++ b/src/lsm/lsm_cursor.c @@ -1661,8 +1661,6 @@ __wt_clsm_close(WT_CURSOR *cursor) /* In case we were somehow left positioned, clear that. */ __clsm_leave(clsm); - /* The WT_LSM_TREE owns the URI. */ - cursor->uri = NULL; if (clsm->lsm_tree != NULL) __wt_lsm_tree_release(session, clsm->lsm_tree); WT_TRET(__wt_cursor_close(cursor)); @@ -1744,7 +1742,7 @@ __wt_clsm_open(WT_SESSION_IMPL *session, cursor = &clsm->iface; *cursor = iface; cursor->session = &session->iface; - cursor->uri = lsm_tree->name; + WT_ERR(__wt_strdup(session, lsm_tree->name, &cursor->uri)); cursor->key_format = lsm_tree->key_format; cursor->value_format = lsm_tree->value_format; diff --git a/test/suite/test_cursor01.py b/test/suite/test_cursor01.py index 8c66042eec0..2a33b15dccc 100644 --- a/test/suite/test_cursor01.py +++ b/test/suite/test_cursor01.py @@ -99,6 +99,7 @@ class test_cursor01(wttest.WiredTigerTestCase): self.pr('creating cursor') cursor = self.session.open_cursor(tablearg, None, None) self.assertCursorHasNoKeyValue(cursor) + self.assertEqual(cursor.uri, tablearg) for i in range(0, self.nentries): cursor[self.genkey(i)] = self.genvalue(i) |