You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2019/12/18 18:57:29 UTC
[couchdb] branch per-transaction-id created (now 5ada630)
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a change to branch per-transaction-id
in repository https://gitbox.apache.org/repos/asf/couchdb.git.
at 5ada630 Improve transaction name setting when tracing FDB transactions
This branch includes the following new commits:
new 5ada630 Improve transaction name setting when tracing FDB transactions
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[couchdb] 01/01: Improve transaction name setting when tracing FDB
transactions
Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch per-transaction-id
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 5ada63016ebffdd75deb778b6782ed2c907e7484
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,