horizonzy commented on code in PR #3433:
URL: https://github.com/apache/bookkeeper/pull/3433#discussion_r932932120
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Cookie.java:
##########
@@ -136,11 +137,27 @@ private boolean verifyLedgerDirs(Cookie c, boolean
checkIfSuperSet) {
}
}
+ private boolean verifyDefaultIndexDirsWithLedgerDirs(String indexDirsTpm,
Cookie c, boolean checkIfSuperSet) {
Review Comment:
we can change this method name -> doVerifyIndexDirs(String indexDirs,
boolean checkIfSuperSet).
In this method, we pass in the indexDirs from rm cookie or local file
cookie. I check the cookie's param indexDirs is from origin indexDirs or
ledgersDir.
##########
bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CookieIndexDirTest.java:
##########
@@ -970,4 +970,35 @@ public void testBookieIdSetting() throws Exception {
cookie.writeToRegistrationManager(rm, conf, version1);
Assert.assertTrue(cookie.toString().contains(customBookieId));
}
+
+ /**
+ * Compatibility test
+ * 1. First create bookie without indexDirName
+ * 2. Configure indexDirName to start bookie
+ */
+ @Test
+ public void testNewBookieStartingWithOldCookie() throws Exception {
+ String journalDir = newDirectory();
+ String[] ledgerDirs = {newDirectory(), newDirectory()};
+ ServerConfiguration conf =
TestBKConfiguration.newServerConfiguration();
+ conf.setJournalDirName(journalDir)
+ .setLedgerDirNames(ledgerDirs)
+ .setBookiePort(bookiePort)
+ .setMetadataServiceUri(zkUtil.getMetadataServiceUri());
+ validateConfig(conf);
+
+ conf = TestBKConfiguration.newServerConfiguration();
+ conf.setJournalDirName(journalDir)
+ .setLedgerDirNames(ledgerDirs)
+ .setIndexDirName(ledgerDirs)
+ .setBookiePort(bookiePort)
+ .setMetadataServiceUri(zkUtil.getMetadataServiceUri());
+ try {
+ validateConfig(conf);
+ } catch (InvalidCookieException ice) {
+ // error behaviour
+ fail("fail to start,error info:");
Review Comment:
-> "Validate failed, error info: " + ice.getMessage();
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]