mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-3.11' into trunk
This commit is contained in:
commit
e4fac3582e
|
|
@ -136,6 +136,17 @@ public enum CassandraRelevantProperties
|
|||
/** mx4jport */
|
||||
MX4JPORT ("mx4jport"),
|
||||
|
||||
/**
|
||||
* When bootstraping we wait for all schema versions found in gossip to be seen, and if not seen in time we fail
|
||||
* the bootstrap; this property will avoid failing and allow bootstrap to continue if set to true.
|
||||
*/
|
||||
BOOTSTRAP_SKIP_SCHEMA_CHECK("cassandra.skip_schema_check"),
|
||||
|
||||
/**
|
||||
* When bootstraping how long to wait for schema versions to be seen.
|
||||
*/
|
||||
BOOTSTRAP_SCHEMA_DELAY_MS("cassandra.schema_delay_ms"),
|
||||
|
||||
//cassandra properties (without the "cassandra." prefix)
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -121,6 +121,8 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
|||
import static java.util.concurrent.TimeUnit.NANOSECONDS;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import static java.util.stream.Collectors.toMap;
|
||||
import static org.apache.cassandra.config.CassandraRelevantProperties.BOOTSTRAP_SCHEMA_DELAY_MS;
|
||||
import static org.apache.cassandra.config.CassandraRelevantProperties.BOOTSTRAP_SKIP_SCHEMA_CHECK;
|
||||
import static org.apache.cassandra.index.SecondaryIndexManager.getIndexName;
|
||||
import static org.apache.cassandra.index.SecondaryIndexManager.isIndexColumnFamily;
|
||||
import static org.apache.cassandra.net.NoPayload.noPayload;
|
||||
|
|
@ -139,9 +141,9 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
|
|||
|
||||
public static final int INDEFINITE = -1;
|
||||
public static final int RING_DELAY = getRingDelay(); // delay after which we assume ring has stablized
|
||||
public static final int SCHEMA_DELAY = getRingDelay(); // delay after which we assume ring has stablized
|
||||
public static final int SCHEMA_DELAY_MILLIS = getSchemaDelay();
|
||||
|
||||
private static final boolean REQUIRE_SCHEMAS = !Boolean.getBoolean("cassandra.skip_schema_check");
|
||||
private static final boolean REQUIRE_SCHEMAS = !BOOTSTRAP_SKIP_SCHEMA_CHECK.getBoolean();
|
||||
|
||||
private final JMXProgressSupport progressSupport = new JMXProgressSupport(this);
|
||||
|
||||
|
|
@ -161,10 +163,10 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
|
|||
|
||||
private static int getSchemaDelay()
|
||||
{
|
||||
String newdelay = System.getProperty("cassandra.schema_delay_ms");
|
||||
String newdelay = BOOTSTRAP_SCHEMA_DELAY_MS.getString();
|
||||
if (newdelay != null)
|
||||
{
|
||||
logger.info("Overriding SCHEMA_DELAY to {}ms", newdelay);
|
||||
logger.info("Overriding SCHEMA_DELAY_MILLIS to {}ms", newdelay);
|
||||
return Integer.parseInt(newdelay);
|
||||
}
|
||||
else
|
||||
|
|
@ -894,7 +896,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
|
|||
Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
boolean schemasReceived = MigrationCoordinator.instance.awaitSchemaRequests(TimeUnit.SECONDS.toMillis(SCHEMA_DELAY));
|
||||
boolean schemasReceived = MigrationCoordinator.instance.awaitSchemaRequests(SCHEMA_DELAY_MILLIS);
|
||||
|
||||
if (schemasReceived)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -443,11 +443,16 @@ public class GossipHelper
|
|||
}
|
||||
|
||||
public static void withProperty(String prop, boolean value, Runnable r)
|
||||
{
|
||||
withProperty(prop, Boolean.toString(value), r);
|
||||
}
|
||||
|
||||
public static void withProperty(String prop, String value, Runnable r)
|
||||
{
|
||||
String before = System.getProperty(prop);
|
||||
try
|
||||
{
|
||||
System.setProperty(prop, Boolean.toString(value));
|
||||
System.setProperty(prop, value);
|
||||
r.run();
|
||||
}
|
||||
finally
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import org.apache.cassandra.distributed.shared.NetworkTopology;
|
|||
import org.apache.cassandra.distributed.test.TestBaseImpl;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.apache.cassandra.config.CassandraRelevantProperties.BOOTSTRAP_SCHEMA_DELAY_MS;
|
||||
import static org.apache.cassandra.distributed.action.GossipHelper.bootstrap;
|
||||
import static org.apache.cassandra.distributed.action.GossipHelper.pullSchemaFrom;
|
||||
import static org.apache.cassandra.distributed.action.GossipHelper.statusToBootstrap;
|
||||
|
|
@ -93,8 +94,9 @@ public class BootstrapTest extends TestBaseImpl
|
|||
IInstanceConfig config = cluster.newInstanceConfig();
|
||||
config.set("auto_bootstrap", true);
|
||||
IInvokableInstance newInstance = cluster.bootstrap(config);
|
||||
withProperty("cassandra.join_ring", false,
|
||||
() -> newInstance.startup(cluster));
|
||||
withProperty(BOOTSTRAP_SCHEMA_DELAY_MS.getKey(), Integer.toString(90 * 1000),
|
||||
() -> withProperty("cassandra.join_ring", false,
|
||||
() -> newInstance.startup(cluster)));
|
||||
|
||||
newInstance.nodetoolResult("join").asserts().success();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue