mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
tracing::trace_keyspace_helper: use generate_legacy_id() for CF IDs generation
Explicitly generate tables' IDs of tables from the system_traces KS using generate_legacy_id() in order to ensure all Nodes create these tables with the same IDs. This is going to prevent hitting issue #420. Fixes #1976 Signed-off-by: Vlad Zolotarov <vladz@scylladb.com> Message-Id: <1484153725-31030-1-git-send-email-vladz@scylladb.com>
This commit is contained in:
committed by
Avi Kivity
parent
33e1f9af6b
commit
ca0a0f1458
@@ -118,11 +118,27 @@ future<> trace_keyspace_helper::setup_table(const sstring& name, const sstring&
|
||||
return make_ready_future<>();
|
||||
}
|
||||
|
||||
::shared_ptr<cql3::statements::raw::cf_statement> parsed = static_pointer_cast<
|
||||
cql3::statements::raw::cf_statement>(cql3::query_processor::parse_statement(cql));
|
||||
parsed->prepare_keyspace(KEYSPACE_NAME);
|
||||
::shared_ptr<cql3::statements::create_table_statement> statement =
|
||||
static_pointer_cast<cql3::statements::create_table_statement>(
|
||||
parsed->prepare(db, qp.get_cql_stats())->statement);
|
||||
auto schema = statement->get_cf_meta_data();
|
||||
|
||||
// Generate the CF UUID based on its KF names. This is needed to ensure that
|
||||
// all Nodes that create it would create it with the same UUID and we don't
|
||||
// hit the #420 issue.
|
||||
auto uuid = generate_legacy_id(schema->ks_name(), schema->cf_name());
|
||||
|
||||
schema_builder b(schema);
|
||||
b.set_uuid(uuid);
|
||||
|
||||
// We don't care it it fails really - this may happen due to concurrent
|
||||
// "CREATE TABLE" invocation on different Nodes.
|
||||
// The important thing is that it will converge eventually (some traces may
|
||||
// be lost in a process but that's ok).
|
||||
return qp.process(cql, db::consistency_level::ONE).discard_result().handle_exception([this] (auto ep) {});
|
||||
return service::get_local_migration_manager().announce_new_column_family(b.build(), false).discard_result().handle_exception([this] (auto ep) {});;
|
||||
}
|
||||
|
||||
bool trace_keyspace_helper::cache_sessions_table_handles(const schema_ptr& schema) {
|
||||
|
||||
Reference in New Issue
Block a user