[ 
https://issues.apache.org/jira/browse/TEPHRA-228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16014911#comment-16014911
 ] 

ASF GitHub Bot commented on TEPHRA-228:
---------------------------------------

Github user poornachandra commented on a diff in the pull request:

    https://github.com/apache/incubator-tephra/pull/42#discussion_r117127048
  
    --- Diff: 
tephra-core/src/main/java/org/apache/tephra/TransactionManager.java ---
    @@ -347,15 +346,17 @@ private void cleanupTimedOutTransactions() {
             long currentTime = System.currentTimeMillis();
             Map<Long, InProgressType> timedOut = Maps.newHashMap();
             for (Map.Entry<Long, InProgressTx> tx : inProgress.entrySet()) {
    -          long expiration = tx.getValue().getExpiration();
    +          InProgressTx inProgressTx = tx.getValue();
    +          long expiration = inProgressTx.getExpiration();
               if (expiration >= 0L && currentTime > expiration) {
                 // timed out, remember tx id (can't remove while iterating 
over entries)
    -            timedOut.put(tx.getKey(), tx.getValue().getType());
    -            LOG.info("Tx invalid list: added tx {} because of timeout", 
tx.getKey());
    +            timedOut.put(tx.getKey(), inProgressTx.getType());
    +            String clientId = inProgressTx.getClientId() != null ? 
inProgressTx.getClientId() : "unknown";
    +            LOG.info("Tx invalid list: added tx {} belonging to client 
'{}' because of timeout.",
    --- End diff --
    
    Let's add the client id to the log message in `doInvalidate` too.


> Introduce client ID that can be used to track requests per client
> -----------------------------------------------------------------
>
>                 Key: TEPHRA-228
>                 URL: https://issues.apache.org/jira/browse/TEPHRA-228
>             Project: Tephra
>          Issue Type: Improvement
>          Components: api, core
>            Reporter: Poorna Chandra
>            Assignee: Gokul Gunasekaran
>             Fix For: 0.12.0-incubating
>
>
> Today transaction manager does not have details of what transaction belongs 
> to which client. For instance when a there are a lot of invalid transactions 
> generated by a client, it is not easy to say which client generated the 
> invalid transactions. Transaction manager just logs a message saying the 
> transaction ID was invalidated. This makes debugging very difficult since 
> there is no easy way to map the transaction ID to a program.
> Transaction APIs should allow clients to pass in client IDs for every start 
> transaction call. Transaction manager can store this client ID as part of the 
> transaction metadata. And when transaction manager logs messages with 
> transaction ID, it can include the client ID in the message.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to