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

    
https://github.com/apache/incubator-distributedlog/pull/42#discussion_r86109926
  
    --- Diff: 
distributedlog-core/src/main/java/com/twitter/distributedlog/BKSyncLogReaderDLSN.java
 ---
    @@ -116,7 +110,7 @@ public void resumeReadAhead() {
     
         @Override
         public void onSuccess(LogRecordWithDLSN record) {
    -        setLastSeenDLSN(record.getDlsn());
    +        this.lastSeenDLSN = record.getDlsn();
    --- End diff --
    
    Are you referring this code below? lastDLSNSeenByReadAhead is a local 
variable and the lastSeenDLSN is a volatile variable. The visibility and the 
ordering of a volatile variable is guaranteed by java - that says accessing the 
lastSeenDLSN will retrieve the latest value, hence no atomicity is required 
here.
    
    `                        // if last seen DLSN by reader is same as the one 
seen by ReadAhead
                            // that means that reader is caught up with 
ReadAhead and ReadAhead
                            // is caught up with stream
                            shallWait = DLSN.InitialDLSN != 
lastDLSNSeenByReadAhead
                                    && 
lastSeenDLSN.compareTo(lastDLSNSeenByReadAhead) < 0
                                    && 
startDLSN.compareTo(lastDLSNSeenByReadAhead) <= 0;`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to