Improve memory handling of Deltas (#1688)
- Reduce delta from 104B to 80B - Hold and pass them around as in a deque - Detect and deleted deltas within commit if safe to do so
This commit is contained in:
committed by
GitHub
parent
7ead00f23e
commit
4ef6a1f9c3
@@ -1,4 +1,4 @@
|
||||
// Copyright 2023 Memgraph Ltd.
|
||||
// Copyright 2024 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
|
||||
@@ -419,9 +419,9 @@ TEST(PropertyStore, IntEncoding) {
|
||||
{memgraph::storage::PropertyId::FromUint(1048576UL), memgraph::storage::PropertyValue(1048576L)},
|
||||
{memgraph::storage::PropertyId::FromUint(std::numeric_limits<uint32_t>::max()),
|
||||
memgraph::storage::PropertyValue(std::numeric_limits<int32_t>::max())},
|
||||
{memgraph::storage::PropertyId::FromUint(4294967296UL), memgraph::storage::PropertyValue(4294967296L)},
|
||||
{memgraph::storage::PropertyId::FromUint(137438953472UL), memgraph::storage::PropertyValue(137438953472L)},
|
||||
{memgraph::storage::PropertyId::FromUint(std::numeric_limits<uint64_t>::max()),
|
||||
{memgraph::storage::PropertyId::FromUint(1048577UL), memgraph::storage::PropertyValue(4294967296L)},
|
||||
{memgraph::storage::PropertyId::FromUint(1048578UL), memgraph::storage::PropertyValue(137438953472L)},
|
||||
{memgraph::storage::PropertyId::FromUint(std::numeric_limits<uint32_t>::max()),
|
||||
memgraph::storage::PropertyValue(std::numeric_limits<int64_t>::max())}};
|
||||
|
||||
memgraph::storage::PropertyStore props;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2023 Memgraph Ltd.
|
||||
// Copyright 2024 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
|
||||
@@ -154,8 +154,8 @@ class DeltaGenerator final {
|
||||
|
||||
void Finalize(bool append_transaction_end = true) {
|
||||
auto commit_timestamp = gen_->timestamp_++;
|
||||
if (transaction_.deltas.use().empty()) return;
|
||||
for (const auto &delta : transaction_.deltas.use()) {
|
||||
if (transaction_.deltas.empty()) return;
|
||||
for (const auto &delta : transaction_.deltas) {
|
||||
auto owner = delta.prev.Get();
|
||||
while (owner.type == memgraph::storage::PreviousPtr::Type::DELTA) {
|
||||
owner = owner.delta->prev.Get();
|
||||
@@ -171,7 +171,7 @@ class DeltaGenerator final {
|
||||
if (append_transaction_end) {
|
||||
gen_->wal_file_.AppendTransactionEnd(commit_timestamp);
|
||||
if (gen_->valid_) {
|
||||
gen_->UpdateStats(commit_timestamp, transaction_.deltas.use().size() + 1);
|
||||
gen_->UpdateStats(commit_timestamp, transaction_.deltas.size() + 1);
|
||||
for (auto &data : data_) {
|
||||
if (data.type == memgraph::storage::durability::WalDeltaData::Type::VERTEX_SET_PROPERTY) {
|
||||
// We need to put the final property value into the SET_PROPERTY
|
||||
|
||||
Reference in New Issue
Block a user