gc_clock: make 64 bit

Fixes: #3353

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
Benny Halevy
2019-01-01 00:00:41 +02:00
parent 1ccd72f115
commit 93270dd8e0
6 changed files with 8 additions and 12 deletions

View File

@@ -1008,8 +1008,8 @@ compare_atomic_cell_for_merge(atomic_cell_view left, atomic_cell_view right) {
// delegates to AbstractCell.reconcile() which compares values after
// comparing timestamps, which in case of deleted cells will hold
// serialized expiry.
return (uint32_t) left.deletion_time().time_since_epoch().count()
< (uint32_t) right.deletion_time().time_since_epoch().count() ? -1 : 1;
return (uint64_t) left.deletion_time().time_since_epoch().count()
< (uint64_t) right.deletion_time().time_since_epoch().count() ? -1 : 1;
}
}
return 0;

View File

@@ -1499,8 +1499,8 @@ static void add_table_params_to_mutations(mutation& m, const clustering_key& cke
m.set_clustered_cell(ckey, "bloom_filter_fp_chance", table->bloom_filter_fp_chance(), timestamp);
m.set_clustered_cell(ckey, "comment", table->comment(), timestamp);
m.set_clustered_cell(ckey, "dclocal_read_repair_chance", table->dc_local_read_repair_chance(), timestamp);
m.set_clustered_cell(ckey, "default_time_to_live", table->default_time_to_live().count(), timestamp);
m.set_clustered_cell(ckey, "gc_grace_seconds", table->gc_grace_seconds().count(), timestamp);
m.set_clustered_cell(ckey, "default_time_to_live", gc_clock::as_int32(table->default_time_to_live()), timestamp);
m.set_clustered_cell(ckey, "gc_grace_seconds", gc_clock::as_int32(table->gc_grace_seconds()), timestamp);
m.set_clustered_cell(ckey, "max_index_interval", table->max_index_interval(), timestamp);
m.set_clustered_cell(ckey, "memtable_flush_period_in_ms", table->memtable_flush_period(), timestamp);
m.set_clustered_cell(ckey, "min_index_interval", table->min_index_interval(), timestamp);

View File

@@ -28,11 +28,10 @@
#include <chrono>
#include <optional>
// FIXME: wraps around in 2038
class gc_clock final {
public:
using base = seastar::lowres_system_clock;
using rep = int32_t;
using rep = int64_t;
using period = std::ratio<1, 1>; // seconds
using duration = std::chrono::duration<rep, period>;
using time_point = std::chrono::time_point<gc_clock, duration>;

View File

@@ -1006,8 +1006,8 @@ int compare_row_marker_for_merge(const row_marker& left, const row_marker& right
// delegates to AbstractCell.reconcile() which compares values after
// comparing timestamps, which in case of deleted cells will hold
// serialized expiry.
return (uint32_t) left.deletion_time().time_since_epoch().count()
< (uint32_t) right.deletion_time().time_since_epoch().count() ? -1 : 1;
return (uint64_t) left.deletion_time().time_since_epoch().count()
< (uint64_t) right.deletion_time().time_since_epoch().count() ? -1 : 1;
}
}
return 0;

View File

@@ -85,9 +85,6 @@ inline gc_clock::duration parse_ttl(const serialization_header& header,
}
inline gc_clock::time_point parse_expiry(int64_t value) {
if (value > std::numeric_limits<gc_clock::duration::rep>::max()) {
throw malformed_sstable_exception(format("Too big expiry: {}", value));
}
return gc_clock::time_point(gc_clock::duration(value));
}

View File

@@ -334,7 +334,7 @@ void write_delta_ttl(W& out, gc_clock::duration ttl, const encoding_stats& enc_s
template <typename W>
GCC6_CONCEPT(requires Writer<W>())
void write_delta_local_deletion_time(W& out, int64_t local_deletion_time, const encoding_stats& enc_stats) {
write_unsigned_delta_vint(out, local_deletion_time, static_cast<int64_t>(enc_stats.min_local_deletion_time.time_since_epoch().count()));
write_unsigned_delta_vint(out, local_deletion_time, enc_stats.min_local_deletion_time.time_since_epoch().count());
}
template <typename W>