Compaction filter poc

This commit is contained in:
Andi Skrgat 2023-04-14 10:09:38 +02:00
parent 876359f4b6
commit a22b011736
2 changed files with 28 additions and 3 deletions

View File

@ -0,0 +1,27 @@
// Copyright 2023 Memgraph Ltd.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
// License, and you may not use this file except in compliance with the Business Source License.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
#include <rocksdb/cache.h>
#include <rocksdb/compaction_filter.h>
#include <rocksdb/options.h>
#include <rocksdb/slice_transform.h>
class TimestampCompactionFilter : public rocksdb::CompactionFilter {
public:
const char *Name() const override { return "TimestampCompactionFilter"; }
/// Return true if the key-value pair should be removed from the database during compaction.
/// Filters KV entries that are older than the specified timestamp.
bool Filter(int level, const rocksdb::Slice &key, const rocksdb::Slice &existing_value, std::string *new_value,
bool *value_changed) const override {
return true;
}
};

View File

@ -169,8 +169,7 @@ Result<std::vector<LabelId>> VertexAccessor::Labels(View view) const {
labels = vertex_->labels;
delta = vertex_->delta;
}
return std::move(labels);
/*ApplyDeltasForRead(transaction_, delta, view, [&exists, &deleted, &labels](const Delta &delta) {
ApplyDeltasForRead(transaction_, delta, view, [&exists, &deleted, &labels](const Delta &delta) {
switch (delta.action) {
case Delta::Action::REMOVE_LABEL: {
// Remove the label because we don't see the addition.
@ -206,7 +205,6 @@ Result<std::vector<LabelId>> VertexAccessor::Labels(View view) const {
if (!exists) return Error::NONEXISTENT_OBJECT;
if (!for_deleted_ && deleted) return Error::DELETED_OBJECT;
return std::move(labels);
*/
}
Result<PropertyValue> VertexAccessor::SetProperty(PropertyId property, const PropertyValue &value) {