bookkeeper-distributedlog-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From khurrumnasimm <...@git.apache.org>
Subject [GitHub] incubator-distributedlog pull request #42: Fix deadlock on BKSyncLogReaderDL...
Date Wed, 02 Nov 2016 10:22:26 GMT
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message