mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
system_distributed_keyspace: Add better routine to get latest cdc gen. timestamp
Since we have a table of cdc version timestamps, conviniently sorted reversed, we can just query this and get the latest known gen ts.
This commit is contained in:
@@ -525,6 +525,18 @@ system_distributed_keyspace::cdc_get_versioned_streams(db_clock::time_point not_
|
||||
co_return result;
|
||||
}
|
||||
|
||||
future<db_clock::time_point>
|
||||
system_distributed_keyspace::cdc_current_generation_timestamp(context ctx) {
|
||||
auto timestamp_cql = co_await _qp.execute_internal(
|
||||
format("SELECT time FROM {}.{} WHERE key = ? limit 1", NAME, CDC_TIMESTAMPS),
|
||||
quorum_if_many(ctx.num_token_owners),
|
||||
internal_distributed_query_state(),
|
||||
{ CDC_TIMESTAMPS_KEY },
|
||||
false);
|
||||
|
||||
co_return timestamp_cql->one().get_as<db_clock::time_point>("time");
|
||||
}
|
||||
|
||||
future<std::vector<db_clock::time_point>>
|
||||
system_distributed_keyspace::get_cdc_desc_v1_timestamps(context ctx) {
|
||||
std::vector<db_clock::time_point> res;
|
||||
|
||||
@@ -109,6 +109,9 @@ public:
|
||||
future<std::vector<db_clock::time_point>> get_cdc_desc_v1_timestamps(context);
|
||||
|
||||
future<std::map<db_clock::time_point, cdc::streams_version>> cdc_get_versioned_streams(db_clock::time_point not_older_than, context);
|
||||
|
||||
future<db_clock::time_point> cdc_current_generation_timestamp(context);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user