Compare commits
4 Commits
fix_finali
...
fix-transa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01e1c7f4d4 | ||
|
|
8a50abfb69 | ||
|
|
6e37b46eee | ||
|
|
5385c741ad |
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2023 Memgraph Ltd.
|
// Copyright 2024 Memgraph Ltd.
|
||||||
//
|
//
|
||||||
// Use of this software is governed by the Business Source License
|
// 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
|
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||||
@@ -60,10 +60,12 @@ void *my_alloc(extent_hooks_t *extent_hooks, void *new_addr, size_t size, size_t
|
|||||||
unsigned arena_ind) {
|
unsigned arena_ind) {
|
||||||
// This needs to be before, to throw exception in case of too big alloc
|
// This needs to be before, to throw exception in case of too big alloc
|
||||||
if (*commit) [[likely]] {
|
if (*commit) [[likely]] {
|
||||||
memgraph::utils::total_memory_tracker.Alloc(static_cast<int64_t>(size));
|
// This needs to happen before global alloc, because if thread tracker throws
|
||||||
|
// we will be left with incorrect state of global alloc
|
||||||
if (GetQueriesMemoryControl().IsThreadTracked()) [[unlikely]] {
|
if (GetQueriesMemoryControl().IsThreadTracked()) [[unlikely]] {
|
||||||
GetQueriesMemoryControl().TrackAllocOnCurrentThread(size);
|
GetQueriesMemoryControl().TrackAllocOnCurrentThread(size);
|
||||||
}
|
}
|
||||||
|
memgraph::utils::total_memory_tracker.Alloc(static_cast<int64_t>(size));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *ptr = old_hooks->alloc(extent_hooks, new_addr, size, alignment, zero, commit, arena_ind);
|
auto *ptr = old_hooks->alloc(extent_hooks, new_addr, size, alignment, zero, commit, arena_ind);
|
||||||
|
|||||||
@@ -4172,6 +4172,10 @@ Interpreter::PrepareResult Interpreter::Prepare(const std::string &query_string,
|
|||||||
utils::Downcast<ConstraintQuery>(parsed_query.query) != nullptr ||
|
utils::Downcast<ConstraintQuery>(parsed_query.query) != nullptr ||
|
||||||
upper_case_query.find(kSchemaAssert) != std::string::npos;
|
upper_case_query.find(kSchemaAssert) != std::string::npos;
|
||||||
SetupDatabaseTransaction(could_commit, unique);
|
SetupDatabaseTransaction(could_commit, unique);
|
||||||
|
query_execution_ptr->get()->transaction_id_ = *current_db_.db_transactional_accessor_->GetTransactionId();
|
||||||
|
}
|
||||||
|
if (in_explicit_transaction_) {
|
||||||
|
query_execution_ptr->get()->transaction_id_ = *current_db_.db_transactional_accessor_->GetTransactionId();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MG_ENTERPRISE
|
#ifdef MG_ENTERPRISE
|
||||||
|
|||||||
@@ -312,6 +312,8 @@ class Interpreter final {
|
|||||||
|
|
||||||
std::map<std::string, TypedValue> summary;
|
std::map<std::string, TypedValue> summary;
|
||||||
std::vector<Notification> notifications;
|
std::vector<Notification> notifications;
|
||||||
|
// Used for tracking of query and procedure memory limit
|
||||||
|
uint64_t transaction_id_;
|
||||||
|
|
||||||
static auto Create(std::variant<utils::MonotonicBufferResource, utils::PoolResource> memory_resource,
|
static auto Create(std::variant<utils::MonotonicBufferResource, utils::PoolResource> memory_resource,
|
||||||
std::optional<PreparedQuery> prepared_query = std::nullopt) -> std::unique_ptr<QueryExecution> {
|
std::optional<PreparedQuery> prepared_query = std::nullopt) -> std::unique_ptr<QueryExecution> {
|
||||||
@@ -427,8 +429,8 @@ std::map<std::string, TypedValue> Interpreter::Pull(TStream *result_stream, std:
|
|||||||
// If the query finished executing, we have received a value which tells
|
// If the query finished executing, we have received a value which tells
|
||||||
// us what to do after.
|
// us what to do after.
|
||||||
if (maybe_res) {
|
if (maybe_res) {
|
||||||
if (current_transaction_) {
|
if (query_execution->transaction_id_) {
|
||||||
memgraph::memory::TryStopTrackingOnTransaction(*current_transaction_);
|
memgraph::memory::TryStopTrackingOnTransaction(query_execution->transaction_id_);
|
||||||
}
|
}
|
||||||
// Save its summary
|
// Save its summary
|
||||||
maybe_summary.emplace(std::move(query_execution->summary));
|
maybe_summary.emplace(std::move(query_execution->summary));
|
||||||
|
|||||||
Reference in New Issue
Block a user