This commit is contained in:
Marcus Olsson 2015-12-04 14:30:00 -05:00 committed by Joshua McKenzie
parent 8fd810c945
commit a4da379bb0
5 changed files with 70 additions and 27 deletions

View File

@ -1,4 +1,5 @@
3.0.1
* Disable reloading of GossipingPropertyFileSnitch (CASSANDRA-9474)
* Handle single-column deletions correction in materialized views
when the column is part of the view primary key (CASSANDRA-10796)
* Fix issue with datadir migration on upgrade (CASSANDRA-10788)

View File

@ -146,10 +146,13 @@ Deprecation
Operations
----------
- Switching racks is no longer an allowed operation on a node which has
data. Instead, the node will need to be decommissioned and rebootstrapped.
If moving from the SimpleSnitch, make sure the rack containing all current
nodes is named "rack1".
- Switching data center or racks is no longer an allowed operation on a node
which has data. Instead, the node will need to be decommissioned and
rebootstrapped. If moving from the SimpleSnitch, make sure that the data
center and rack containing all current nodes is named "datacenter1" and
"rack1". To override this behaviour use -Dcassandra.ignore_rack=true and/or
-Dcassandra.ignore_dc=true.
- Reloading the configuration file of GossipingPropertyFileSnitch has been disabled.
New features
------------
@ -160,13 +163,6 @@ New features
- Native protocol server now allows both SSL and non-SSL connections on
the same port.
Operations
------------
- Changing rack or dc of live nodes is no longer possible for PropertyFileSnitch
and YamlFileNetworkTopologySnitch. Reloading the configuration file of
GossipingPropertyFileSnitch has been disabled, CASSANDRA-10243.
2.2.3
=====

View File

@ -1068,6 +1068,21 @@ public final class SystemKeyspace
return null;
}
/**
* Gets the stored data center for the local node, or null if none have been set yet.
*/
public static String getDatacenter()
{
String req = "SELECT data_center FROM system.%s WHERE key='%s'";
UntypedResultSet result = executeInternal(String.format(req, LOCAL, LOCAL));
// Look up the Data center (return it if found)
if (!result.isEmpty() && result.one().has("data_center"))
return result.one().getString("data_center");
return null;
}
public static PaxosState loadPaxosState(DecoratedKey key, CFMetaData metadata)
{
String req = "SELECT * FROM system.%s WHERE row_key = ? AND cf_id = ?";

View File

@ -241,21 +241,6 @@ public class CassandraDaemon
Keyspace.setInitialized();
if (!Boolean.getBoolean("cassandra.ignore_rack"))
{
String storedRack = SystemKeyspace.getRack();
if (storedRack != null)
{
String currentRack = DatabaseDescriptor.getEndpointSnitch().getRack(FBUtilities.getBroadcastAddress());
if (!storedRack.equals(currentRack))
{
logger.error("Cannot start node if snitch's rack differs from previous rack. " +
"Please fix the snitch or decommission and rebootstrap this node.");
System.exit(100);
}
}
}
// initialize keyspaces
for (String keyspaceName : Schema.instance.getKeyspaces())
{

View File

@ -75,7 +75,9 @@ public class StartupChecks
initSigarLibrary,
checkDataDirs,
checkSSTablesFormat,
checkSystemKeyspaceState);
checkSystemKeyspaceState,
checkDatacenter,
checkRack);
public StartupChecks withDefaultTests()
{
@ -300,4 +302,48 @@ public class StartupChecks
}
}
};
public static final StartupCheck checkDatacenter = new StartupCheck()
{
public void execute() throws StartupException
{
if (!Boolean.getBoolean("cassandra.ignore_dc"))
{
String storedDc = SystemKeyspace.getDatacenter();
if (storedDc != null)
{
String currentDc = DatabaseDescriptor.getEndpointSnitch().getDatacenter(FBUtilities.getBroadcastAddress());
if (!storedDc.equals(currentDc))
{
String formatMessage = "Cannot start node if snitch's data center (%s) differs from previous data center (%s). " +
"Please fix the snitch configuration, decommission and rebootstrap this node or use the flag -Dcassandra.ignore_dc=true.";
throw new StartupException(100, String.format(formatMessage, currentDc, storedDc));
}
}
}
}
};
public static final StartupCheck checkRack = new StartupCheck()
{
public void execute() throws StartupException
{
if (!Boolean.getBoolean("cassandra.ignore_rack"))
{
String storedRack = SystemKeyspace.getRack();
if (storedRack != null)
{
String currentRack = DatabaseDescriptor.getEndpointSnitch().getRack(FBUtilities.getBroadcastAddress());
if (!storedRack.equals(currentRack))
{
String formatMessage = "Cannot start node if snitch's rack (%s) differs from previous rack (%s). " +
"Please fix the snitch configuration, decommission and rebootstrap this node or use the flag -Dcassandra.ignore_rack=true.";
throw new StartupException(100, String.format(formatMessage, currentRack, storedRack));
}
}
}
}
};
}