Beispiel #1
0
    def test_open_index_and_drop(self):
        # We should also be able to detect cached cursors
        # for indices
        session = self.session
        uri = 'table:test_cursor13_drops'
        ds = ComplexDataSet(self, uri, 100)
        ds.create()
        indexname = ds.index_name(0)
        c = session.open_cursor(indexname)
        # The index is really open, so we cannot drop the main table.
        self.assertRaises(wiredtiger.WiredTigerError,
            lambda: session.drop(uri))
        c.close()
        session.drop(uri)
        confirm_does_not_exist(self, uri)

        # Same test for indices, but with cursor held by another session.
        # TODO: try with session that DOES have cache_cursors and another
        # that does not.
        session2 = self.conn.open_session(None)
        ds = ComplexDataSet(self, uri, 100)
        ds.create()
        indexname = ds.index_name(0)
        c = session2.open_cursor(indexname)
        self.assertRaises(wiredtiger.WiredTigerError,
            lambda: session.drop(uri))
        c.close()
        session.drop(uri)
        confirm_does_not_exist(self, uri)
        session2.close()
Beispiel #2
0
    def test_open_index_and_drop(self):
        # We should also be able to detect cached cursors
        # for indices
        session = self.session
        uri = 'table:test_cursor13_drops'
        ds = ComplexDataSet(self, uri, 100)
        ds.create()
        indexname = ds.index_name(0)
        c = session.open_cursor(indexname)
        # The index is really open, so we cannot drop the main table.
        self.assertRaises(wiredtiger.WiredTigerError,
                          lambda: session.drop(uri))
        c.close()
        session.drop(uri)
        confirm_does_not_exist(self, uri)

        # Same test for indices, but with cursor held by another session.
        # TODO: try with session that DOES have cache_cursors and another
        # that does not.
        session2 = self.conn.open_session(None)
        ds = ComplexDataSet(self, uri, 100)
        ds.create()
        indexname = ds.index_name(0)
        c = session2.open_cursor(indexname)
        self.assertRaises(wiredtiger.WiredTigerError,
                          lambda: session.drop(uri))
        c.close()
        session.drop(uri)
        confirm_does_not_exist(self, uri)
        session2.close()
Beispiel #3
0
 def open_and_drop(self, uri, cursor_session, drop_session, nopens, ntrials):
     for i in range(0, ntrials):
         cursor_session.create(uri, 'key_format=S,value_format=S')
         for i in range(0, nopens):
             c = cursor_session.open_cursor(uri)
             c.close()
         # The cursor cache is unaffected by the drop, and nothing
         # in the cache should prevent the drop from occurring.
         drop_session.drop(uri)
         confirm_does_not_exist(self, uri)
Beispiel #4
0
 def open_and_drop(self, uri, cursor_session, drop_session, nopens, ntrials):
     for i in range(0, ntrials):
         cursor_session.create(uri, 'key_format=S,value_format=S')
         for i in range(0, nopens):
             c = cursor_session.open_cursor(uri)
             c.close()
         # The cursor cache is unaffected by the drop, and nothing
         # in the cache should prevent the drop from occurring.
         drop_session.drop(uri)
         confirm_does_not_exist(self, uri)
Beispiel #5
0
    def drop(self, populate, with_cursor):
        uri = self.uri + self.name
        populate(self, uri, "key_format=S" + self.extra_config, 10)

        # Open cursors should cause failure.
        if with_cursor:
            cursor = self.session.open_cursor(uri, None, None)
            self.assertRaises(wiredtiger.WiredTigerError, lambda: self.session.drop(uri, None))
            cursor.close()

        self.session.drop(uri, None)
        confirm_does_not_exist(self, uri)
Beispiel #6
0
    def drop(self, populate, with_cursor):
        uri = self.uri + self.name
        populate(self, uri, 'key_format=S' + self.extra_config, 10)

        # Open cursors should cause failure.
        if with_cursor:
            cursor = self.session.open_cursor(uri, None, None)
            self.assertRaises(wiredtiger.WiredTigerError,
                              lambda: self.session.drop(uri, None))
            cursor.close()

        self.session.drop(uri, None)
        confirm_does_not_exist(self, uri)
Beispiel #7
0
 def test_drop_dne(self):
     uri = self.uri + self.name
     cguri = 'colgroup:' + self.name
     idxuri = 'index:' + self.name + ':indexname'
     lsmuri = 'lsm:' + self.name
     confirm_does_not_exist(self, uri)
     self.session.drop(uri, 'force')
     self.assertRaises(wiredtiger.WiredTigerError,
                       lambda: self.session.drop(uri, None))
     self.session.drop(cguri, 'force')
     self.assertRaises(wiredtiger.WiredTigerError,
                       lambda: self.session.drop(cguri, None))
     self.session.drop(idxuri, 'force')
     self.assertRaises(wiredtiger.WiredTigerError,
                       lambda: self.session.drop(idxuri, None))
     self.session.drop(lsmuri, 'force')
     self.assertRaises(wiredtiger.WiredTigerError,
                       lambda: self.session.drop(lsmuri, None))
Beispiel #8
0
 def test_drop_dne(self):
     uri = self.uri + self.name
     cguri = 'colgroup:' + self.name
     idxuri = 'index:' + self.name + ':indexname'
     lsmuri = 'lsm:' + self.name
     confirm_does_not_exist(self, uri)
     self.session.drop(uri, 'force')
     self.assertRaises(
         wiredtiger.WiredTigerError, lambda: self.session.drop(uri, None))
     self.session.drop(cguri, 'force')
     self.assertRaises(
         wiredtiger.WiredTigerError, lambda: self.session.drop(cguri, None))
     self.session.drop(idxuri, 'force')
     self.assertRaises(
         wiredtiger.WiredTigerError, lambda: self.session.drop(idxuri, None))
     self.session.drop(lsmuri, 'force')
     self.assertRaises(
         wiredtiger.WiredTigerError, lambda: self.session.drop(lsmuri, None))
Beispiel #9
0
    def rename(self, populate, check, with_cursor):
        uri1 = self.uri + self.name1
        uri2 = self.uri + self.name2
        populate(self, uri1, "key_format=S", 10)

        # Open cursors should cause failure.
        if with_cursor:
            cursor = self.session.open_cursor(uri1, None, None)
            self.assertRaises(wiredtiger.WiredTigerError, lambda: self.session.rename(uri1, uri2, None))
            cursor.close()

        self.session.rename(uri1, uri2, None)
        confirm_does_not_exist(self, uri1)
        check(self, uri2, 10)

        self.session.rename(uri2, uri1, None)
        confirm_does_not_exist(self, uri2)
        check(self, uri1, 10)

        self.session.drop(uri1)
Beispiel #10
0
    def drop(self, populate, with_cursor, reopen, drop_index):
        uri = self.uri + self.name
        populate(self, uri, 'key_format=S' + self.extra_config, 10)

        # Open cursors should cause failure.
        if with_cursor:
            cursor = self.session.open_cursor(uri, None, None)
            self.assertRaises(wiredtiger.WiredTigerError,
                              lambda: self.session.drop(uri, None))
            cursor.close()

        if reopen:
            self.reopen_conn()

        if drop_index:
            drop_uri = complex_populate_index_name(self, uri, 0)
        else:
            drop_uri = uri
        self.session.drop(drop_uri, None)
        confirm_does_not_exist(self, drop_uri)
Beispiel #11
0
    def drop(self, populate, with_cursor, reopen, drop_index):
        uri = self.uri + self.name
        populate(self, uri, 'key_format=S' + self.extra_config, 10)

        # Open cursors should cause failure.
        if with_cursor:
            cursor = self.session.open_cursor(uri, None, None)
            self.assertRaises(wiredtiger.WiredTigerError,
                lambda: self.session.drop(uri, None))
            cursor.close()

        if reopen:
            self.reopen_conn()

        if drop_index:
            drop_uri = complex_populate_index_name(self, uri, 0)
        else:
            drop_uri = uri
        self.session.drop(drop_uri, None)
        confirm_does_not_exist(self, drop_uri)
Beispiel #12
0
    def rename(self, populate, check, with_cursor):
        uri1 = self.uri + self.name1
        uri2 = self.uri + self.name2
        populate(self, uri1, 'key_format=S', 10)

        # Open cursors should cause failure.
        if with_cursor:
            cursor = self.session.open_cursor(uri1, None, None)
            self.assertRaises(wiredtiger.WiredTigerError,
                lambda: self.session.rename(uri1, uri2, None))
            cursor.close()

        self.session.rename(uri1, uri2, None)
        confirm_does_not_exist(self, uri1)
        check(self, uri2, 10)

        self.session.rename(uri2, uri1, None)
        confirm_does_not_exist(self, uri2)
        check(self, uri1, 10)

        self.session.drop(uri1)
Beispiel #13
0
    def drop(self, dataset, with_cursor, reopen, drop_index):
        uri = self.uri + self.name
        ds = dataset(self, uri, 10, config=self.extra_config)
        ds.populate()

        # Open cursors should cause failure.
        if with_cursor:
            cursor = self.session.open_cursor(uri, None, None)
            self.assertRaises(wiredtiger.WiredTigerError,
                lambda: self.session.drop(uri, None))
            cursor.close()

        if reopen:
            self.reopen_conn()

        if drop_index:
            drop_uri = ds.index_name(0)
        else:
            drop_uri = uri
        self.session.drop(drop_uri, None)
        confirm_does_not_exist(self, drop_uri)
    def drop(self, dataset, with_cursor, reopen, drop_index):
        uri = self.uri + self.name
        ds = dataset(self, uri, 10, config=self.extra_config)
        ds.populate()

        # Open cursors should cause failure.
        if with_cursor:
            cursor = self.session.open_cursor(uri, None, None)
            self.assertRaises(wiredtiger.WiredTigerError,
                              lambda: self.session.drop(uri, None))
            cursor.close()

        if reopen:
            self.reopen_conn()

        if drop_index:
            drop_uri = ds.index_name(0)
        else:
            drop_uri = uri
        self.session.drop(drop_uri, None)
        confirm_does_not_exist(self, drop_uri)
Beispiel #15
0
    def rename(self, dataset, with_cursor):
        uri1 = self.uri + self.name1
        uri2 = self.uri + self.name2
        # Only populate uri1, we keep ds2 for checking.
        ds1 = dataset(self, uri1, 10)
        ds2 = dataset(self, uri2, 10)
        ds1.populate()

        # Open cursors should cause failure.
        if with_cursor:
            cursor = self.session.open_cursor(uri1, None, None)
            self.assertRaises(wiredtiger.WiredTigerError,
                lambda: self.session.rename(uri1, uri2, None))
            cursor.close()

        self.session.rename(uri1, uri2, None)
        confirm_does_not_exist(self, uri1)
        ds2.check()

        self.session.rename(uri2, uri1, None)
        confirm_does_not_exist(self, uri2)
        ds1.check()

        self.session.drop(uri1)
Beispiel #16
0
    def rename(self, dataset, with_cursor):
        uri1 = self.uri + self.name1
        uri2 = self.uri + self.name2
        # Only populate uri1, we keep ds2 for checking.
        ds1 = dataset(self, uri1, 10)
        ds2 = dataset(self, uri2, 10)
        ds1.populate()

        # Open cursors should cause failure.
        if with_cursor:
            cursor = self.session.open_cursor(uri1, None, None)
            self.assertRaises(wiredtiger.WiredTigerError,
                              lambda: self.session.rename(uri1, uri2, None))
            cursor.close()

        self.session.rename(uri1, uri2, None)
        confirm_does_not_exist(self, uri1)
        ds2.check()

        self.session.rename(uri2, uri1, None)
        confirm_does_not_exist(self, uri2)
        ds1.check()

        self.session.drop(uri1)
Beispiel #17
0
 def test_rename_dne(self):
     uri1 = self.uri + self.name1
     uri2 = self.uri + self.name2
     confirm_does_not_exist(self, uri1)
     self.assertRaises(wiredtiger.WiredTigerError,
         lambda: self.session.rename(uri1, uri2, None))
Beispiel #18
0
 def test_drop_dne(self):
     uri = self.uri + self.name
     confirm_does_not_exist(self, uri)
     self.session.drop(uri, "force")
     self.assertRaises(wiredtiger.WiredTigerError, lambda: self.session.drop(uri, None))
Beispiel #19
0
 def test_rename_dne(self):
     uri1 = self.uri + self.name1
     uri2 = self.uri + self.name2
     confirm_does_not_exist(self, uri1)
     self.assertRaises(wiredtiger.WiredTigerError,
         lambda: self.session.rename(uri1, uri2, None))
Beispiel #20
0
 def test_drop_dne(self):
     uri = self.uri + self.name
     confirm_does_not_exist(self, uri)
     self.session.drop(uri, 'force')
     self.assertRaises(wiredtiger.WiredTigerError,
                       lambda: self.session.drop(uri, None))