eolivelli commented on a change in pull request #2203: Issue #609 Add indexDirs 
field to cookie
URL: https://github.com/apache/bookkeeper/pull/2203#discussion_r352836177
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Cookie.java
 ##########
 @@ -124,14 +127,28 @@ private boolean verifyLedgerDirs(Cookie c, boolean 
checkIfSuperSet) {
         }
     }
 
-    private void verifyInternal(Cookie c, boolean checkIfSuperSet) throws 
BookieException.InvalidCookieException {
+    private boolean verifyIndexDirs(Cookie c, boolean checkIfSuperSet, boolean 
enforceCookieIndexDirCheck) {
+        if (!enforceCookieIndexDirCheck) {
+            return true;
+        }
+
+        if (!checkIfSuperSet) {
+            return indexDirs.equals(c.indexDirs);
+        } else {
+            return isSuperSet(decodeDirPathFromCookie(indexDirs), 
decodeDirPathFromCookie(c.indexDirs));
+        }
+    }
+
+    private void verifyInternal(Cookie c, boolean checkIfSuperSet, 
ServerConfiguration conf) throws BookieException.InvalidCookieException {
 
 Review comment:
   can't we simply pass 'conf.isEnforceCookieIndexDirCheck' instead of the full 
object ?
   why did you choose to pass the reference to the full ServerConfiguration 
object ?
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to