mirror of https://github.com/apache/cassandra
Move Schema.FORCE_LOAD_KEYSPACES and Schema.FORCE_LOAD_KEYSPACES_PROP to CassandraRelevantProps
patch by Doug Rohrer; reviewed by Brandon Williams and Jacek Lewandowski for CASSANDRA-17783
This commit is contained in:
parent
9dcba20866
commit
a805e32675
|
|
@ -1,4 +1,5 @@
|
|||
4.1-beta2
|
||||
* Move Schema.FORCE_LOAD_KEYSPACES and Schema.FORCE_LOAD_KEYSPACES_PROP to CassandraRelevantProps (CASSANDRA-17783)
|
||||
* Add --resolve-ip option to nodetool gossipinfo (CASSANDRA-17934)
|
||||
* Allow pre-V5 global limit on bytes in flight to revert to zero asynchronously in RateLimitingTest (CASSANDRA-17927)
|
||||
Merged from 4.0:
|
||||
|
|
|
|||
|
|
@ -295,9 +295,12 @@ public enum CassandraRelevantProperties
|
|||
ORG_APACHE_CASSANDRA_CONF_CASSANDRA_RELEVANT_PROPERTIES_TEST("org.apache.cassandra.conf.CassandraRelevantPropertiesTest"),
|
||||
ORG_APACHE_CASSANDRA_DB_VIRTUAL_SYSTEM_PROPERTIES_TABLE_TEST("org.apache.cassandra.db.virtual.SystemPropertiesTableTest"),
|
||||
|
||||
/** Used when running in Client mode and the system and schema keyspaces need to be initialized outside of their normal initialization path **/
|
||||
FORCE_LOAD_LOCAL_KEYSPACES("cassandra.schema.force_load_local_keyspaces"),
|
||||
;
|
||||
|
||||
|
||||
|
||||
CassandraRelevantProperties(String key, String defaultVal)
|
||||
{
|
||||
this.key = key;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import java.util.stream.Collectors;
|
|||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import org.apache.cassandra.config.CassandraRelevantProperties;
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.cassandra.cql3.statements.schema.CreateTableStatement;
|
||||
import org.apache.cassandra.cql3.statements.schema.CreateTypeStatement;
|
||||
|
|
@ -104,7 +105,7 @@ public class CQLSSTableWriter implements Closeable
|
|||
|
||||
static
|
||||
{
|
||||
System.setProperty("cassandra.schema.force_load_local_keyspaces", "true");
|
||||
CassandraRelevantProperties.FORCE_LOAD_LOCAL_KEYSPACES.setBoolean(true);
|
||||
DatabaseDescriptor.clientInitialization(false);
|
||||
// Partitioner is not set in client mode.
|
||||
if (DatabaseDescriptor.getPartitioner() == null)
|
||||
|
|
@ -554,7 +555,8 @@ public class CQLSSTableWriter implements Closeable
|
|||
throw new IllegalStateException("No modification (INSERT/UPDATE/DELETE) statement specified, you should provide a modification statement through using()");
|
||||
|
||||
Preconditions.checkState(Sets.difference(SchemaConstants.LOCAL_SYSTEM_KEYSPACE_NAMES, Schema.instance.getKeyspaces()).isEmpty(),
|
||||
"Local keyspaces were not loaded. If this is running as a client, please make sure to add %s=true system property.", Schema.FORCE_LOAD_LOCAL_KEYSPACES_PROP);
|
||||
"Local keyspaces were not loaded. If this is running as a client, please make sure to add %s=true system property.",
|
||||
CassandraRelevantProperties.FORCE_LOAD_LOCAL_KEYSPACES.getKey());
|
||||
synchronized (CQLSSTableWriter.class)
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.google.common.collect.MapDifference;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
|
||||
import org.apache.cassandra.config.CassandraRelevantProperties;
|
||||
import org.apache.cassandra.cql3.functions.*;
|
||||
import org.apache.cassandra.db.*;
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
|
|
@ -74,9 +75,6 @@ public class Schema implements SchemaProvider
|
|||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(Schema.class);
|
||||
|
||||
public static final String FORCE_LOAD_LOCAL_KEYSPACES_PROP = "cassandra.schema.force_load_local_keyspaces";
|
||||
private static final boolean FORCE_LOAD_LOCAL_KEYSPACES = Boolean.getBoolean(FORCE_LOAD_LOCAL_KEYSPACES_PROP);
|
||||
|
||||
public static final Schema instance = new Schema();
|
||||
|
||||
private volatile Keyspaces distributedKeyspaces = Keyspaces.none();
|
||||
|
|
@ -108,7 +106,7 @@ public class Schema implements SchemaProvider
|
|||
private Schema()
|
||||
{
|
||||
this.online = isDaemonInitialized();
|
||||
this.localKeyspaces = (FORCE_LOAD_LOCAL_KEYSPACES || isDaemonInitialized() || isToolInitialized())
|
||||
this.localKeyspaces = (CassandraRelevantProperties.FORCE_LOAD_LOCAL_KEYSPACES.getBoolean() || isDaemonInitialized() || isToolInitialized())
|
||||
? Keyspaces.of(SchemaKeyspace.metadata(), SystemKeyspace.metadata())
|
||||
: Keyspaces.none();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue