mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-2.1' into trunk
This commit is contained in:
commit
c11e1a9d8a
|
|
@ -43,6 +43,8 @@
|
|||
|
||||
|
||||
2.1.3
|
||||
* Invalidate affected prepared statements when a table's columns
|
||||
are altered (CASSANDRA-7910)
|
||||
* Stress - user defined writes should populate sequentally (CASSANDRA-8524)
|
||||
* Fix regression in SSTableRewriter causing some rows to become unreadable
|
||||
during compaction (CASSANDRA-8429)
|
||||
|
|
|
|||
|
|
@ -724,11 +724,15 @@ public final class CFMetaData
|
|||
return def == null ? defaultValidator : def.type;
|
||||
}
|
||||
|
||||
public void reload()
|
||||
/**
|
||||
* Updates this object in place to match the definition in the system schema tables.
|
||||
* @return true if any columns were added, removed, or altered; otherwise, false is returned
|
||||
*/
|
||||
public boolean reload()
|
||||
{
|
||||
try
|
||||
{
|
||||
apply(LegacySchemaTables.createTableFromName(ksName, cfName));
|
||||
return apply(LegacySchemaTables.createTableFromName(ksName, cfName));
|
||||
}
|
||||
catch (ConfigurationException e)
|
||||
{
|
||||
|
|
@ -739,10 +743,11 @@ public final class CFMetaData
|
|||
/**
|
||||
* Updates CFMetaData in-place to match cfm
|
||||
*
|
||||
* @return true if any columns were added, removed, or altered; otherwise, false is returned
|
||||
* @throws ConfigurationException if ks/cf names or cf ids didn't match
|
||||
*/
|
||||
@VisibleForTesting
|
||||
public void apply(CFMetaData cfm) throws ConfigurationException
|
||||
public boolean apply(CFMetaData cfm) throws ConfigurationException
|
||||
{
|
||||
logger.debug("applying {} to {}", cfm, this);
|
||||
|
||||
|
|
@ -802,6 +807,10 @@ public final class CFMetaData
|
|||
|
||||
rebuild();
|
||||
logger.debug("application result is {}", this);
|
||||
|
||||
return !columnDiff.entriesOnlyOnLeft().isEmpty() ||
|
||||
!columnDiff.entriesOnlyOnRight().isEmpty() ||
|
||||
!columnDiff.entriesDiffering().isEmpty();
|
||||
}
|
||||
|
||||
public void validateCompatility(CFMetaData cfm) throws ConfigurationException
|
||||
|
|
|
|||
|
|
@ -472,11 +472,11 @@ public class Schema
|
|||
{
|
||||
CFMetaData cfm = getCFMetaData(ksName, tableName);
|
||||
assert cfm != null;
|
||||
cfm.reload();
|
||||
boolean columnsDidChange = cfm.reload();
|
||||
|
||||
Keyspace keyspace = Keyspace.open(cfm.ksName);
|
||||
keyspace.getColumnFamilyStore(cfm.cfName).reload();
|
||||
MigrationManager.instance.notifyUpdateColumnFamily(cfm);
|
||||
MigrationManager.instance.notifyUpdateColumnFamily(cfm, columnsDidChange);
|
||||
}
|
||||
|
||||
public void dropTable(String ksName, String tableName)
|
||||
|
|
|
|||
|
|
@ -621,13 +621,22 @@ public class QueryProcessor implements QueryHandler
|
|||
}
|
||||
}
|
||||
|
||||
public void onUpdateColumnFamily(String ksName, String cfName, boolean columnsDidChange)
|
||||
{
|
||||
logger.info("Column definitions for {}.{} changed, invalidating related prepared statements", ksName, cfName);
|
||||
if (columnsDidChange)
|
||||
removeInvalidPreparedStatements(ksName, cfName);
|
||||
}
|
||||
|
||||
public void onDropKeyspace(String ksName)
|
||||
{
|
||||
logger.info("Keyspace {} was dropped, invalidating related prepared statements", ksName);
|
||||
removeInvalidPreparedStatements(ksName, null);
|
||||
}
|
||||
|
||||
public void onDropColumnFamily(String ksName, String cfName)
|
||||
{
|
||||
logger.info("Table {}.{} was dropped, invalidating related prepared statements", ksName, cfName);
|
||||
removeInvalidPreparedStatements(ksName, cfName);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public abstract class MigrationListener
|
|||
{
|
||||
}
|
||||
|
||||
public void onUpdateColumnFamily(String ksName, String cfName)
|
||||
public void onUpdateColumnFamily(String ksName, String cfName, boolean columnsDidChange)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -195,10 +195,10 @@ public class MigrationManager
|
|||
listener.onUpdateKeyspace(ksm.name);
|
||||
}
|
||||
|
||||
public void notifyUpdateColumnFamily(CFMetaData cfm)
|
||||
public void notifyUpdateColumnFamily(CFMetaData cfm, boolean columnsDidChange)
|
||||
{
|
||||
for (MigrationListener listener : listeners)
|
||||
listener.onUpdateColumnFamily(cfm.ksName, cfm.cfName);
|
||||
listener.onUpdateColumnFamily(cfm.ksName, cfm.cfName, columnsDidChange);
|
||||
}
|
||||
|
||||
public void notifyUpdateUserType(UserType ut)
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ public class Server implements CassandraDaemon.Server
|
|||
server.connectionTracker.send(new Event.SchemaChange(Event.SchemaChange.Change.UPDATED, ksName));
|
||||
}
|
||||
|
||||
public void onUpdateColumnFamily(String ksName, String cfName)
|
||||
public void onUpdateColumnFamily(String ksName, String cfName, boolean columnsDidChange)
|
||||
{
|
||||
server.connectionTracker.send(new Event.SchemaChange(Event.SchemaChange.Change.UPDATED, Event.SchemaChange.Target.TABLE, ksName, cfName));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue