Skip to content

Commit 3cd7fac

Browse files
author
litongxin
committed
deal with AbsAndLat and AbsOrLat
1 parent da374a9 commit 3cd7fac

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/storage/disk_table.cc

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,7 @@ bool DiskTable::InitColumnFamilyDescriptor() {
173173
cfo.prefix_extractor.reset(new KeyTsPrefixTransform());
174174
const auto& indexs = inner_index->GetIndex();
175175
for (const auto& index_def : indexs) {
176-
if (index_def->GetTTLType() == ::openmldb::storage::TTLType::kAbsoluteTime ||
177-
index_def->GetTTLType() == ::openmldb::storage::TTLType::kAbsOrLat) {
176+
if (index_def->GetTTLType() == ::openmldb::storage::TTLType::kAbsoluteTime) {
178177
cfo.compaction_filter_factory = std::make_shared<AbsoluteTTLFilterFactory>(
179178
inner_index, &idx_cnt_vec_, pk_cnt_vec_[inner_index->GetId()],
180179
&bloom_filter_vec_[inner_index->GetId()]);
@@ -424,17 +423,17 @@ void DiskTable::GcHead() {
424423
if (indexs.size() > 1) {
425424
std::map<uint32_t, uint64_t> ttl_map;
426425
std::map<uint32_t, uint32_t> idx_map;
427-
std::set<uint32_t> abs_set;
426+
std::set<uint32_t> other_TTL_set;
428427
for (const auto& index : indexs) {
429428
auto ts_col = index->GetTsColumn();
430429
if (ts_col) {
431430
auto lat_ttl = index->GetTTL()->lat_ttl;
432431
if (lat_ttl > 0) {
433432
ttl_map.emplace(ts_col->GetId(), lat_ttl);
434433
}
435-
auto abs_ttl = index->GetTTL()->abs_ttl;
436-
if (abs_ttl > 0) {
437-
abs_set.insert(ts_col->GetId());
434+
auto TTL_type = index->GetTTLType();
435+
if (TTL_type != openmldb::storage::TTLType::kLatestTime) {
436+
other_TTL_set.insert(ts_col->GetId());
438437
}
439438
idx_map.emplace(ts_col->GetId(), index->GetId());
440439
}
@@ -447,7 +446,7 @@ void DiskTable::GcHead() {
447446
uint64_t ts = 0;
448447
uint32_t ts_idx = 0;
449448
ParseKeyAndTs(true, it->key(), cur_pk, ts, ts_idx);
450-
if (abs_set.find(ts_idx) != abs_set.end()) {
449+
if (other_TTL_set.find(ts_idx) != other_TTL_set.end()) {
451450
it->Next();
452451
continue;
453452
}

src/storage/disk_table.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@ class AbsoluteTTLAndCountCompactionFilter : public rocksdb::CompactionFilter {
259259
return false;
260260
}
261261
if (ts_col->GetId() == ts_idx) {
262+
if (index->GetTTLType() != ::openmldb::storage::TTLType::kAbsoluteTime) {
263+
return false;
264+
}
262265
real_ttl = index->GetTTL()->abs_ttl;
263266
idx = index->GetId();
264267
has_found = true;

0 commit comments

Comments
 (0)