Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmarks/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def setup(options):
try:
session.execute("""
CREATE KEYSPACE %s
WITH replication = { 'class': 'SimpleStrategy', 'replication_factor': '2' }
WITH replication = { 'class': 'NetworkTopologyStrategy', 'replication_factor': '2' }
""" % options.keyspace)

log.debug("Setting keyspace...")
Expand Down
6 changes: 3 additions & 3 deletions cassandra/cqlengine/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _get_context(keyspaces, connections):

def create_keyspace_simple(name, replication_factor, durable_writes=True, connections=None):
"""
Creates a keyspace with SimpleStrategy for replica placement
Creates a keyspace with NetworkTopologyStrategy for replica placement

If the keyspace already exists, it will not be modified.

Expand All @@ -66,11 +66,11 @@ def create_keyspace_simple(name, replication_factor, durable_writes=True, connec
*There are plans to guard schema-modifying functions with an environment-driven conditional.*

:param str name: name of keyspace to create
:param int replication_factor: keyspace replication factor, used with :attr:`~.SimpleStrategy`
:param int replication_factor: keyspace replication factor, used with :attr:`~.NetworkTopologyStrategy`
:param bool durable_writes: Write log is bypassed if set to False
:param list connections: List of connection names
"""
_create_keyspace(name, durable_writes, 'SimpleStrategy',
_create_keyspace(name, durable_writes, 'NetworkTopologyStrategy',
{'replication_factor': replication_factor}, connections=connections)


Expand Down
2 changes: 1 addition & 1 deletion docs/scylla-specific.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ New Error Types
session = cluster.connect()
session.execute("""
CREATE KEYSPACE IF NOT EXISTS keyspace1
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '1'}
""")
session.execute("USE keyspace1")
Expand Down
2 changes: 1 addition & 1 deletion examples/concurrent_executions/execute_async_with_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
session = cluster.connect()

session.execute(("CREATE KEYSPACE IF NOT EXISTS examples "
"WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1' }"))
"WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '1' }"))
session.execute("USE examples")
session.execute("CREATE TABLE IF NOT EXISTS tbl_sample_kv (id uuid, value text, PRIMARY KEY (id))")
prepared_insert = session.prepare("INSERT INTO tbl_sample_kv (id, value) VALUES (?, ?)")
Expand Down
2 changes: 1 addition & 1 deletion examples/concurrent_executions/execute_with_threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
session = cluster.connect()

session.execute(("CREATE KEYSPACE IF NOT EXISTS examples "
"WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1' }"))
"WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '1' }"))
session.execute("USE examples")
session.execute("CREATE TABLE IF NOT EXISTS tbl_sample_kv (id uuid, value text, PRIMARY KEY (id))")
prepared_insert = session.prepare("INSERT INTO tbl_sample_kv (id, value) VALUES (?, ?)")
Expand Down
2 changes: 1 addition & 1 deletion examples/example_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def main():
log.info("creating keyspace...")
session.execute("""
CREATE KEYSPACE IF NOT EXISTS %s
WITH replication = { 'class': 'SimpleStrategy', 'replication_factor': '2' }
WITH replication = { 'class': 'NetworkTopologyStrategy', 'replication_factor': '2' }
""" % KEYSPACE)

log.info("setting keyspace...")
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/cqlengine/connections/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ def setUpClass(cls):
super(SeveralConnectionsTest, cls).setUpClass()
cls.setup_cluster = TestCluster()
cls.setup_session = cls.setup_cluster.connect()
ddl = "CREATE KEYSPACE {0} WITH replication = {{'class': 'SimpleStrategy', 'replication_factor': '{1}'}}".format(cls.keyspace1, 1)
ddl = "CREATE KEYSPACE {0} WITH replication = {{'class': 'NetworkTopologyStrategy', 'replication_factor': '{1}'}}".format(cls.keyspace1, 1)
execute_with_long_wait_retry(cls.setup_session, ddl)
ddl = "CREATE KEYSPACE {0} WITH replication = {{'class': 'SimpleStrategy', 'replication_factor': '{1}'}}".format(cls.keyspace2, 1)
ddl = "CREATE KEYSPACE {0} WITH replication = {{'class': 'NetworkTopologyStrategy', 'replication_factor': '{1}'}}".format(cls.keyspace2, 1)
execute_with_long_wait_retry(cls.setup_session, ddl)

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/long/test_failure_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def test_write_failures_from_coordinator(self):
self._perform_cql_statement(
"""
CREATE KEYSPACE testksfail
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'}
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '3'}
""", consistency_level=ConsistencyLevel.ALL, expected_exception=None)

# create table
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/long/test_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_should_rethrow_on_unvailable_with_default_policy_if_cas(self):
cluster = TestCluster(execution_profiles={EXEC_PROFILE_DEFAULT: ep})
session = cluster.connect()

session.execute("CREATE KEYSPACE test_retry_policy_cas WITH replication = {'class':'SimpleStrategy','replication_factor': 3};")
session.execute("CREATE KEYSPACE test_retry_policy_cas WITH replication = {'class':'NetworkTopologyStrategy','replication_factor': 3};")
session.execute("CREATE TABLE test_retry_policy_cas.t (id int PRIMARY KEY, data text);")
session.execute('INSERT INTO test_retry_policy_cas.t ("id", "data") VALUES (%(0)s, %(1)s)', {'0': 42, '1': 'testing'})

Expand Down
12 changes: 6 additions & 6 deletions tests/integration/long/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_recreates(self):
log.debug(drop)
execute_until_pass(session, drop)

create = "CREATE KEYSPACE {0} WITH replication = {{'class': 'SimpleStrategy', 'replication_factor': 3}}".format(keyspace)
create = "CREATE KEYSPACE {0} WITH replication = {{'class': 'NetworkTopologyStrategy', 'replication_factor': 3}}".format(keyspace)
log.debug(create)
execute_until_pass(session, create)

Expand All @@ -82,7 +82,7 @@ def test_for_schema_disagreements_different_keyspaces(self):
session = self.session

for i in range(30):
execute_until_pass(session, "CREATE KEYSPACE test_{0} WITH replication = {{'class': 'SimpleStrategy', 'replication_factor': 1}}".format(i))
execute_until_pass(session, "CREATE KEYSPACE test_{0} WITH replication = {{'class': 'NetworkTopologyStrategy', 'replication_factor': 1}}".format(i))
execute_until_pass(session, "CREATE TABLE test_{0}.cf (key int PRIMARY KEY, value int)".format(i))

for j in range(100):
Expand All @@ -100,10 +100,10 @@ def test_for_schema_disagreements_same_keyspace(self):

for i in range(30):
try:
execute_until_pass(session, "CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}")
execute_until_pass(session, "CREATE KEYSPACE test WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1}")
except AlreadyExists:
execute_until_pass(session, "DROP KEYSPACE test")
execute_until_pass(session, "CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}")
execute_until_pass(session, "CREATE KEYSPACE test WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1}")

execute_until_pass(session, "CREATE TABLE test.cf (key int PRIMARY KEY, value int)")

Expand Down Expand Up @@ -132,7 +132,7 @@ def test_for_schema_disagreement_attribute(self):
cluster = TestCluster(max_schema_agreement_wait=0.001)
session = cluster.connect(wait_for_all_pools=True)

rs = session.execute("CREATE KEYSPACE test_schema_disagreement WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3}")
rs = session.execute("CREATE KEYSPACE test_schema_disagreement WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 3}")
self.check_and_wait_for_agreement(session, rs, False)
rs = session.execute(SimpleStatement("CREATE TABLE test_schema_disagreement.cf (key int PRIMARY KEY, value int)",
consistency_level=ConsistencyLevel.ALL))
Expand All @@ -144,7 +144,7 @@ def test_for_schema_disagreement_attribute(self):
# These should have schema agreement
cluster = TestCluster(max_schema_agreement_wait=100)
session = cluster.connect()
rs = session.execute("CREATE KEYSPACE test_schema_disagreement WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3}")
rs = session.execute("CREATE KEYSPACE test_schema_disagreement WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 3}")
self.check_and_wait_for_agreement(session, rs, True)
rs = session.execute(SimpleStatement("CREATE TABLE test_schema_disagreement.cf (key int PRIMARY KEY, value int)",
consistency_level=ConsistencyLevel.ALL))
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/long/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def validate_ssl_options(**kwargs):

# attempt a few simple commands.
insert_keyspace = """CREATE KEYSPACE ssltest
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'}
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '3'}
"""
statement = SimpleStatement(insert_keyspace)
statement.consistency_level = 3
Expand Down Expand Up @@ -369,7 +369,7 @@ def test_ssl_want_write_errors_are_retried(self):
except:
pass
session.execute(
"CREATE KEYSPACE ssl_error_test WITH replication = {'class':'SimpleStrategy','replication_factor':1};")
"CREATE KEYSPACE ssl_error_test WITH replication = {'class':'NetworkTopologyStrategy','replication_factor':1};")
session.execute("CREATE TABLE ssl_error_test.big_text (id uuid PRIMARY KEY, data text);")

params = {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/long/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def create_schema(cluster, session, keyspace, simple_strategy=True,

if simple_strategy:
ddl = "CREATE KEYSPACE %s WITH replication" \
" = {'class': 'SimpleStrategy', 'replication_factor': '%s'}"
" = {'class': 'NetworkTopologyStrategy', 'replication_factor': '%s'}"
session.execute(ddl % (keyspace, replication_factor), timeout=10)
else:
if not replication_strategy:
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/simulacron/test_empty_column.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ def test_empty_columns_in_system_schema(self):
'delay_in_ms': 0,
'rows': [
{
"strategy_class": "SimpleStrategy", # C* 2.2
"strategy_class": "NetworkTopologyStrategy", # C* 2.2
"strategy_options": '{}', # C* 2.2
"replication": {'strategy': 'SimpleStrategy', 'replication_factor': 1},
"replication": {'strategy': 'NetworkTopologyStrategy', 'replication_factor': 1},
"durable_writes": True,
"keyspace_name": "testks"
}
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/advanced/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def _create_vertex_metadata(self, label_name='label'):

def _create_keyspace_metadata(self, graph_engine):
return KeyspaceMetadata(
'keyspace', True, 'org.apache.cassandra.locator.SimpleStrategy',
{'replication_factor': 1}, graph_engine=graph_engine)
'keyspace', True, 'org.apache.cassandra.locator.NetworkTopologyStrategy',
{'dc1': 1}, graph_engine=graph_engine)

def _create_table_metadata(self, with_vertex=False, with_edge=False):
tm = TableMetadataDSE68('keyspace', 'table')
Expand Down
Loading
Loading