summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-11-25 18:19:07 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-11-25 18:19:07 +0300
commit90b9c5d9c12d75e14f4c4cb7f871e4787f6c89e9 (patch)
treefdcf0e031cec97efe8783dbd6dd03fa3fb54b335 /plugins
parente23a1b7001f133785df96f8b3968f659f87f7d56 (diff)
Dbx_mdbx: adaptation of Compact for new write transaction scheme
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Dbx_mdbx/src/dbintf.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/Dbx_mdbx/src/dbintf.cpp b/plugins/Dbx_mdbx/src/dbintf.cpp
index 632314cc7c..ed8e1fc514 100644
--- a/plugins/Dbx_mdbx/src/dbintf.cpp
+++ b/plugins/Dbx_mdbx/src/dbintf.cpp
@@ -65,6 +65,13 @@ BOOL CDbxMDBX::Backup(const wchar_t *pwszPath)
return 1;
}
+ mir_cslock lck(m_csDbAccess);
+
+ if (m_pWriteTran) {
+ mdbx_txn_commit(m_pWriteTran);
+ m_pWriteTran = nullptr;
+ }
+
int res = mdbx_env_copy2fd(m_env, pFile, MDBX_CP_COMPACT);
if (res != MDBX_SUCCESS) {
Netlib_Logf(0, "CDbxMDBX::Backup: mdbx_env_copy2fd failed with error code %d", res);
@@ -81,6 +88,9 @@ LBL_Fail:
}
CloseHandle(pFile);
+
+ txn_ptr trnlck(this);
+ trnlck.Commit();
return 0;
}