cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kishan Karunaratne (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CASSANDRA-9310) Table change event returns as keyspace change event
Date Tue, 05 May 2015 21:17:00 GMT

     [ https://issues.apache.org/jira/browse/CASSANDRA-9310?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Kishan Karunaratne updated CASSANDRA-9310:
------------------------------------------
    Description: 
When an index is dropped, its existence is still persisted across the keyspace metadata. This
happens because the response to drop the index from the metadata is never received, as a keyspace
change response is (incorrectly) received by the driver instead of a table change response.

{noformat}
        self.session.execute("CREATE TABLE %s (k int PRIMARY KEY, a int)" % self.table_name)

        ks_meta = self.cluster.metadata.keyspaces[self.keyspace_name]
        table_meta = ks_meta.tables[self.table_name]
        self.assertNotIn('a_idx', ks_meta.indexes)
        self.assertNotIn('b_idx', ks_meta.indexes)
        self.assertNotIn('a_idx', table_meta.indexes)
        self.assertNotIn('b_idx', table_meta.indexes)

        self.session.execute("CREATE INDEX a_idx ON %s (a)" % self.table_name)
        self.session.execute("ALTER TABLE %s ADD b int" % self.table_name)
        self.session.execute("CREATE INDEX b_idx ON %s (b)" % self.table_name)

        ks_meta = self.cluster.metadata.keyspaces[self.keyspace_name]
        table_meta = ks_meta.tables[self.table_name]
        self.assertIsInstance(ks_meta.indexes['a_idx'], IndexMetadata)
        self.assertIsInstance(ks_meta.indexes['b_idx'], IndexMetadata)
        self.assertIsInstance(table_meta.indexes['a_idx'], IndexMetadata)
        self.assertIsInstance(table_meta.indexes['b_idx'], IndexMetadata)

        # both indexes updated when index dropped
        self.session.execute("DROP INDEX a_idx")
        ks_meta = self.cluster.metadata.keyspaces[self.keyspace_name]
        table_meta = ks_meta.tables[self.table_name]
        self.assertNotIn('a_idx', ks_meta.indexes)
{noformat}

Output:
{noformat}
AssertionError: 'a_idx' unexpectedly found in {u'b_idx': <cassandra.metadata.IndexMetadata
object at 0x7f2dd87d4590>, u'a_idx': <cassandra.metadata.IndexMetadata object at 0x7f2dd87d4a10>}
{noformat}

  was:
When an index is dropped, its existence is still persisted across the keyspace metadata. This
happens because the response to drop the index from the metadata is never received, as a keyspace
change response is (incorrectly) received by the driver instead of a table change response.

{noformat}
        self.session.execute("CREATE TABLE %s (k int PRIMARY KEY, a int)" % self.table_name)

        ks_meta = self.cluster.metadata.keyspaces[self.keyspace_name]
        table_meta = ks_meta.tables[self.table_name]
        self.assertNotIn('a_idx', ks_meta.indexes)
        self.assertNotIn('b_idx', ks_meta.indexes)
        self.assertNotIn('a_idx', table_meta.indexes)
        self.assertNotIn('b_idx', table_meta.indexes)

        self.session.execute("CREATE INDEX a_idx ON %s (a)" % self.table_name)
        self.session.execute("ALTER TABLE %s ADD b int" % self.table_name)
        self.session.execute("CREATE INDEX b_idx ON %s (b)" % self.table_name)

        ks_meta = self.cluster.metadata.keyspaces[self.keyspace_name]
        table_meta = ks_meta.tables[self.table_name]
        self.assertIsInstance(ks_meta.indexes['a_idx'], IndexMetadata)
        self.assertIsInstance(ks_meta.indexes['b_idx'], IndexMetadata)
        self.assertIsInstance(table_meta.indexes['a_idx'], IndexMetadata)
        self.assertIsInstance(table_meta.indexes['b_idx'], IndexMetadata)

        # both indexes updated when index dropped
        self.session.execute("DROP INDEX a_idx")
        ks_meta = self.cluster.metadata.keyspaces[self.keyspace_name]
        table_meta = ks_meta.tables[self.table_name]
        self.assertNotIn('a_idx', ks_meta.indexes)
{noformat}


> Table change event returns as keyspace change event
> ---------------------------------------------------
>
>                 Key: CASSANDRA-9310
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-9310
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: C* 1.2.19 and 2.0.14 | python-driver master (upcoming v. 2.6)
>            Reporter: Kishan Karunaratne
>
> When an index is dropped, its existence is still persisted across the keyspace metadata.
This happens because the response to drop the index from the metadata is never received, as
a keyspace change response is (incorrectly) received by the driver instead of a table change
response.
> {noformat}
>         self.session.execute("CREATE TABLE %s (k int PRIMARY KEY, a int)" % self.table_name)
>         ks_meta = self.cluster.metadata.keyspaces[self.keyspace_name]
>         table_meta = ks_meta.tables[self.table_name]
>         self.assertNotIn('a_idx', ks_meta.indexes)
>         self.assertNotIn('b_idx', ks_meta.indexes)
>         self.assertNotIn('a_idx', table_meta.indexes)
>         self.assertNotIn('b_idx', table_meta.indexes)
>         self.session.execute("CREATE INDEX a_idx ON %s (a)" % self.table_name)
>         self.session.execute("ALTER TABLE %s ADD b int" % self.table_name)
>         self.session.execute("CREATE INDEX b_idx ON %s (b)" % self.table_name)
>         ks_meta = self.cluster.metadata.keyspaces[self.keyspace_name]
>         table_meta = ks_meta.tables[self.table_name]
>         self.assertIsInstance(ks_meta.indexes['a_idx'], IndexMetadata)
>         self.assertIsInstance(ks_meta.indexes['b_idx'], IndexMetadata)
>         self.assertIsInstance(table_meta.indexes['a_idx'], IndexMetadata)
>         self.assertIsInstance(table_meta.indexes['b_idx'], IndexMetadata)
>         # both indexes updated when index dropped
>         self.session.execute("DROP INDEX a_idx")
>         ks_meta = self.cluster.metadata.keyspaces[self.keyspace_name]
>         table_meta = ks_meta.tables[self.table_name]
>         self.assertNotIn('a_idx', ks_meta.indexes)
> {noformat}
> Output:
> {noformat}
> AssertionError: 'a_idx' unexpectedly found in {u'b_idx': <cassandra.metadata.IndexMetadata
object at 0x7f2dd87d4590>, u'a_idx': <cassandra.metadata.IndexMetadata object at 0x7f2dd87d4a10>}
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message