You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2020/02/10 18:40:59 UTC
[couchdb] 01/16: Improve transaction name setting when tracing FDB
transactions
This is an automated email from the ASF dual-hosted git repository.
davisp pushed a commit to branch prototype/fdb-layer-get-dbs-info
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 8918e28b19a04b2991a6ce9525351426a38fabee
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Wed Dec 18 13:49:03 2019 -0500
Improve transaction name setting when tracing FDB transactions
Previously the per-request nonce value was set as the transaction name and so
in the trace logs multiple transactions ended up having the same `TransactionID`
which was pretty confusing.
To fix the issue, append a transaction ID to the name. The ID is guaranteed to
be unique for the life of the VM node.
---
src/fabric/src/fabric2_fdb.erl | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/fabric/src/fabric2_fdb.erl b/src/fabric/src/fabric2_fdb.erl
index 404460e..6abe1f6 100644
--- a/src/fabric/src/fabric2_fdb.erl
+++ b/src/fabric/src/fabric2_fdb.erl
@@ -118,7 +118,10 @@ do_transaction(Fun, LayerPrefix) when is_function(Fun, 1) ->
erlfdb:transactional(Db, fun(Tx) ->
case get(erlfdb_trace) of
Name when is_binary(Name) ->
- erlfdb:set_option(Tx, transaction_logging_enable, Name);
+ UId = erlang:unique_integer([positive]),
+ UIdBin = integer_to_binary(UId, 36),
+ TxId = <<Name/binary, "_", UIdBin/binary>>,
+ erlfdb:set_option(Tx, transaction_logging_enable, TxId);
_ ->
ok
end,