From eae8af6571ec369d0d185fc6379b32535bd59d49 Mon Sep 17 00:00:00 2001 From: Martchus Date: Fri, 15 Apr 2022 19:20:01 +0200 Subject: [PATCH] Avoid big build action IDs by reusing older/lower ones --- 3rdparty/lmdb-safe | 2 +- librepomgr/serversetup.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/3rdparty/lmdb-safe b/3rdparty/lmdb-safe index 95ff695..389d662 160000 --- a/3rdparty/lmdb-safe +++ b/3rdparty/lmdb-safe @@ -1 +1 @@ -Subproject commit 95ff695381c9662ec100697bebc6132bc317c005 +Subproject commit 389d662f3b1f311bc5bf931c4ee4f83ca18fcc23 diff --git a/librepomgr/serversetup.cpp b/librepomgr/serversetup.cpp index 0d8a766..77aabdd 100644 --- a/librepomgr/serversetup.cpp +++ b/librepomgr/serversetup.cpp @@ -246,7 +246,7 @@ LibPkg::StorageID ServiceSetup::BuildSetup::allocateBuildActionID() { static const auto emptyBuildAction = BuildAction(); auto txn = m_storage->buildActions.getRWTransaction(); - const auto id = txn.put(emptyBuildAction); + const auto id = txn.put(emptyBuildAction, txn.newID()); txn.commit(); return id; } @@ -321,6 +321,9 @@ StorageID ServiceSetup::BuildSetup::storeBuildAction(const std::shared_ptrbuildActions.getRWTransaction(); + if (!buildAction->id) { + buildAction->id = txn.newID(); + } const auto id = txn.put(*buildAction, static_cast(buildAction->id)); // buildAction->id expected to be a valid StorageID or 0 txn.commit(); return id;