diff options
author | George Hazan <ghazan@miranda.im> | 2018-06-22 11:00:03 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-06-22 11:00:03 +0300 |
commit | eae6a13cd510ef0949868842fbd2b93654b560d4 (patch) | |
tree | 9995588c117ab5cff5aad0f59dfe5451a13c5de1 /plugins/Dbx_mdbx/src | |
parent | dcf9b115274faa6ac32550dc3578bb03e178a5c6 (diff) |
DebugBreak() removed from unsuccessful transaction opening
Diffstat (limited to 'plugins/Dbx_mdbx/src')
-rw-r--r-- | plugins/Dbx_mdbx/src/dbutils.cpp | 34 | ||||
-rw-r--r-- | plugins/Dbx_mdbx/src/stdafx.h | 15 |
2 files changed, 37 insertions, 12 deletions
diff --git a/plugins/Dbx_mdbx/src/dbutils.cpp b/plugins/Dbx_mdbx/src/dbutils.cpp index 147b43ef30..e3d125d302 100644 --- a/plugins/Dbx_mdbx/src/dbutils.cpp +++ b/plugins/Dbx_mdbx/src/dbutils.cpp @@ -45,3 +45,37 @@ int DBSettingKey::Compare(const MDBX_val *ax, const MDBX_val *bx) CMP_UINT(a->dwModuleId, b->dwModuleId);
return strcmp(a->szSettingName, b->szSettingName);
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+txn_ptr_ro::txn_ptr_ro(CMDBX_txn_ro &_txn) :
+ txn(_txn),
+ lock(txn.cs)
+{
+ for (int nRetries = 0; nRetries < 5; nRetries++) {
+ int rc = mdbx_txn_renew(txn);
+ if (rc == MDBX_SUCCESS)
+ break;
+
+ #ifdef _DEBUG
+ DebugBreak();
+ #endif
+ Netlib_Logf(nullptr, "txn_ptr_ro::txn_ptr_ro failed with error=%d, retrying...", rc);
+ Sleep(0);
+ }
+}
+
+txn_ptr_ro::~txn_ptr_ro()
+{
+ for (int nRetries = 0; nRetries < 5; nRetries++) {
+ int rc = mdbx_txn_reset(txn);
+ if (rc == MDBX_SUCCESS)
+ break;
+
+ #ifdef _DEBUG
+ DebugBreak();
+ #endif
+ Netlib_Logf(nullptr, "txn_ptr_ro::~txn_ptr_ro failed with error=%d, retrying...", rc);
+ Sleep(0);
+ }
+}
diff --git a/plugins/Dbx_mdbx/src/stdafx.h b/plugins/Dbx_mdbx/src/stdafx.h index cbb50765ab..49f182f5cf 100644 --- a/plugins/Dbx_mdbx/src/stdafx.h +++ b/plugins/Dbx_mdbx/src/stdafx.h @@ -109,18 +109,9 @@ class txn_ptr_ro mir_cslock lock;
public:
- __forceinline txn_ptr_ro(CMDBX_txn_ro &_txn) : txn(_txn), lock(txn.cs)
- {
- int rc = mdbx_txn_renew(txn);
- if (rc != MDBX_SUCCESS)
- DebugBreak();
- }
- __forceinline ~txn_ptr_ro()
- {
- int rc = mdbx_txn_reset(txn);
- if (rc != MDBX_SUCCESS)
- DebugBreak();
- }
+ txn_ptr_ro(CMDBX_txn_ro &_txn);
+ ~txn_ptr_ro();
+
__forceinline operator MDBX_txn*() const { return txn; }
};
|