ZanderXu commented on PR #4560:
URL: https://github.com/apache/hadoop/pull/4560#issuecomment-1245232780

   @xkrogen After deep thinking and do some verifications, I found there are 
two places should be fixed for the case that `sinceTxId = highestTxId + 1`.
   
   Currently Journal throws one `NewerTxnIdException` to namenode, we expect 
namenode can catch `NewerTxnIdException` during `selectRpcInputStreams` and 
ignore it. 
   
   But the namenode throws a `QuorumException` during `selectRpcInputStreams` 
because there are a majority of `NewerTxnIdException`. Then the namenode 
fallbacks to `selectStreamingInputStreams`.
   
   Beside this problem, JournalNodeRpcServer shouldn't print any logs about 
`NewerTxnIdException` when `sinceTxId = highestTxId + 1`, but it should print 
some logs about `NewerTxnIdException` when `sinceTxId > highestTxId + 1`.
   
   So as above cases, how about handling them differently? such as
   ```
       long highestTxId = getHighestWrittenTxId();
       if (sinceTxId == highestTxId + 1) {
         // This is normal case and will return one response with 0 txnCount.
         metrics.rpcEmptyResponses.incr();
         return 
GetJournaledEditsResponseProto.newBuilder().setTxnCount(0).build();
       } else if (sinceTxId > highestTxId) {
         // Requested edits that don't exist yet and is newer than highestTxId.
         metrics.rpcEmptyResponses.incr();
         throw new NewerTxnIdException(
             "Highest txn ID available in the journal is %d, but requested txns 
starting at %d.",
             highestTxId, sinceTxId);
       }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to