This is an automated email from the ASF dual-hosted git repository. samt pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/cassandra.git
commit 8ebe72d853c18d62f3e50f39736330b2bf141518 Merge: 1916e5d 8a5b127 Author: Sam Tunnicliffe <[email protected]> AuthorDate: Wed Mar 11 10:29:33 2020 +0000 Merge branch 'cassandra-3.11' into trunk .../index/internal/CassandraIndexTest.java | 23 ++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --cc test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java index 65c2417,b573e6f..bab2eb2 --- a/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java +++ b/test/unit/org/apache/cassandra/index/internal/CassandraIndexTest.java @@@ -496,24 -526,32 +502,33 @@@ public class CassandraIndexTest extend createIndex(String.format("CREATE INDEX %s ON %%s(c)", indexName)); waitForIndex(KEYSPACE, tableName, indexName); // check that there are no other rows in the built indexes table - assertRows(execute(String.format("SELECT * FROM %s.\"%s\"", SchemaConstants.SYSTEM_KEYSPACE_NAME, SystemKeyspace.BUILT_INDEXES)), - row(KEYSPACE, indexName, null)); + rs = execute(selectBuiltIndexesQuery); + int sizeAfterBuild = rs.size(); - assertRowsIgnoringOrderAndExtra(rs, row(KEYSPACE, indexName)); ++ assertRowsIgnoringOrderAndExtra(rs, row(KEYSPACE, indexName, null)); // rebuild the index and verify the built status table getCurrentColumnFamilyStore().rebuildSecondaryIndex(indexName); waitForIndex(KEYSPACE, tableName, indexName); // check that there are no other rows in the built indexes table - assertRows(execute(String.format("SELECT * FROM %s.\"%s\"", SchemaConstants.SYSTEM_KEYSPACE_NAME, SystemKeyspace.BUILT_INDEXES)), - row(KEYSPACE, indexName, null )); + rs = execute(selectBuiltIndexesQuery); + assertEquals(sizeAfterBuild, rs.size()); - assertRowsIgnoringOrderAndExtra(rs, row(KEYSPACE, indexName)); ++ assertRowsIgnoringOrderAndExtra(rs, row(KEYSPACE, indexName, null)); + + // check that dropping the index removes it from the built indexes table + dropIndex("DROP INDEX %s." + indexName); + rs = execute(selectBuiltIndexesQuery); + assertEquals(initialSize, rs.size()); + rs.forEach(row -> assertFalse(row.getString("table_name").equals(KEYSPACE) // table_name is actually keyspace + && row.getString("index_name").equals(indexName))); } + // this is slightly annoying, but we cannot read rows from the methods in Util as - // ReadCommand#executeInternal uses metadata retrieved via the cfId, which the index + // ReadCommand#executeLocally uses metadata retrieved via the tableId, which the index // CFS inherits from the base CFS. This has the 'wrong' partitioner (the index table // uses LocalPartition, the base table a real one, so we cannot read from the index - // table with executeInternal + // table with executeLocally private void assertIndexRowTtl(ColumnFamilyStore indexCfs, int indexedValue, int ttl) throws Throwable { DecoratedKey indexKey = indexCfs.decorateKey(ByteBufferUtil.bytes(indexedValue)); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
