MCPcopy Create free account
hub / github.com/apache/cassandra-python-driver / rebuild_keyspace

Method rebuild_keyspace

cassandra/metadata.py:1742–1755  ·  view source on GitHub ↗
(self, keyspace, build_if_absent=False)

Source from the content-addressed store, hash-verified

1740 self._rebuild_lock = RLock()
1741
1742 def rebuild_keyspace(self, keyspace, build_if_absent=False):
1743 with self._rebuild_lock:
1744 try:
1745 current = self.tokens_to_hosts_by_ks.get(keyspace, None)
1746 if (build_if_absent and current is None) or (not build_if_absent and current is not None):
1747 ks_meta = self._metadata.keyspaces.get(keyspace)
1748 if ks_meta:
1749 replica_map = self.replica_map_for_keyspace(self._metadata.keyspaces[keyspace])
1750 self.tokens_to_hosts_by_ks[keyspace] = replica_map
1751 except Exception:
1752 # should not happen normally, but we don't want to blow up queries because of unexpected meta state
1753 # bypass until new map is generated
1754 self.tokens_to_hosts_by_ks[keyspace] = {}
1755 log.exception("Failed creating a token map for keyspace '%s' with %s. PLEASE REPORT THIS: https://datastax-oss.atlassian.net/projects/PYTHON", keyspace, self.token_to_host_owner)
1756
1757 def replica_map_for_keyspace(self, ks_metadata):
1758 strategy = ks_metadata.replication_strategy

Callers 3

get_replicasMethod · 0.95
_keyspace_addedMethod · 0.80
_keyspace_updatedMethod · 0.80

Calls 2

getMethod · 0.45

Tested by

no test coverage detected