Push correct protocol notification for DROP INDEX

patch by Carl Yeksigian; reviewed by Sam Tunnicliffe for CASSANDRA-9310
This commit is contained in:
Carl Yeksigian 2015-05-12 18:13:11 -04:00 committed by Aleksey Yeschenko
parent f4ec535db4
commit b2a2d46352
2 changed files with 19 additions and 7 deletions

View File

@ -1,6 +1,8 @@
2.0.16:
* Push correct protocol notification for DROP INDEX (CASSANDRA-9310)
* token-generator - generated tokens too long (CASSANDRA-9300)
2.0.15:
* Fix counting of tombstones for TombstoneOverwhelmingException (CASSANDRA-9299)
* Fix ReconnectableSnitch reconnecting to peers during upgrade (CASSANDRA-6702)

View File

@ -33,6 +33,9 @@ public class DropIndexStatement extends SchemaAlteringStatement
public final String indexName;
public final boolean ifExists;
// initialized in announceMigration()
private String indexedCF;
public DropIndexStatement(String indexName, boolean ifExists)
{
super(new CFName());
@ -40,14 +43,20 @@ public class DropIndexStatement extends SchemaAlteringStatement
this.ifExists = ifExists;
}
// We don't override CFStatement#columnFamily as this'd change the
// protocol for returned events when we drop an index. We need it
// to return null so that SchemaMigrations remain a keyspace,
// rather than table, level event (see SchemaAlteringStatement#execute).
public String getColumnFamily() throws InvalidRequestException
public String columnFamily()
{
CFMetaData cfm = findIndexedCF();
return cfm == null ? null : cfm.cfName;
if (indexedCF != null)
return indexedCF;
try
{
CFMetaData cfm = findIndexedCF();
return cfm == null ? null : cfm.cfName;
}
catch (InvalidRequestException ire)
{
throw new RuntimeException(ire);
}
}
public void checkAccess(ClientState state) throws UnauthorizedException, InvalidRequestException
@ -77,6 +86,7 @@ public class DropIndexStatement extends SchemaAlteringStatement
return false;
CFMetaData updatedCfm = updateCFMetadata(cfm);
indexedCF = updatedCfm.cfName;
MigrationManager.announceColumnFamilyUpdate(updatedCfm, false);
return true;
}