18
18
19
19
#include < stdexcept>
20
20
21
+ #include < silkworm/infra/common/log.hpp>
21
22
#include < silkworm/node/db/util.hpp>
22
23
23
24
namespace silkworm ::db {
@@ -32,6 +33,21 @@ namespace detail {
32
33
dump.append (std::to_string (bool (result.value )));
33
34
return dump;
34
35
}
36
+
37
+ log::Args log_args_for_commit_latency (const MDBX_commit_latency& commit_latency) {
38
+ return {
39
+ " preparation" ,
40
+ std::to_string (commit_latency.preparation ),
41
+ " write" ,
42
+ std::to_string (commit_latency.write ),
43
+ " sync" ,
44
+ std::to_string (commit_latency.sync ),
45
+ " ending" ,
46
+ std::to_string (commit_latency.ending ),
47
+ " whole" ,
48
+ std::to_string (commit_latency.whole ),
49
+ };
50
+ }
35
51
} // namespace detail
36
52
37
53
// ! \brief Returns data of current cursor position or moves it to the beginning or the end of the table based on
@@ -285,13 +301,15 @@ void RWTxnUnmanaged::commit_and_stop() {
285
301
}
286
302
287
303
void RWTxnUnmanaged::commit () {
288
- const ::mdbx::error err = static_cast <MDBX_error_t>(::mdbx_txn_commit (handle_));
304
+ MDBX_commit_latency commit_latency{};
305
+ const ::mdbx::error err = static_cast <MDBX_error_t>(::mdbx_txn_commit_ex (handle_, &commit_latency));
289
306
if (err.code () != MDBX_THREAD_MISMATCH) {
290
307
handle_ = nullptr ;
291
308
}
292
309
if (err.code () != MDBX_SUCCESS) {
293
310
err.throw_exception ();
294
311
}
312
+ SILK_TRACE << " Commit latency" << detail::log_args_for_commit_latency (commit_latency);
295
313
}
296
314
297
315
thread_local ObjectPool<MDBX_cursor, detail::cursor_handle_deleter> PooledCursor::handles_pool_{};
0 commit comments