ivankelly commented on a change in pull request #1642: Utility to rebuild 
interleaved storage index files
URL: https://github.com/apache/bookkeeper/pull/1642#discussion_r215206635
 
 

 ##########
 File path: 
tests/integration/smoke/src/test/java/org/apache/bookkeeper/tests/integration/TestBookieShellCluster.java
 ##########
 @@ -83,4 +93,98 @@ public void test002_ListROBookies() throws Exception {
     public void test003_ListRWBookies() throws Exception {
         super.test003_ListRWBookies();
     }
+
+    /**
+     * These tests on being able to access cluster internals, so can't be put 
in test base.
+     */
+    @Test
+    public void test101_RegenerateIndex() throws Exception {
+        String zookeeper = String.format("zk+hierarchical://%s/ledgers",
+                                         
BookKeeperClusterUtils.zookeeperConnectString(docker));
+        int numEntries = 100;
+
+        long ledgerId = 0;
+
+
+        try (BookKeeper bk = BookKeeper.newBuilder(
+                     new 
ClientConfiguration().setMetadataServiceUri(zookeeper)).build()) {
+            log.info("Writing entries");
+            try (WriteHandle writer = 
bk.newCreateLedgerOp().withEnsembleSize(1)
+                    .withWriteQuorumSize(1).withAckQuorumSize(1)
+                    .withPassword("".getBytes()).execute().get()) {
+                int i = 0;
+                for (; i < numEntries - 1; i++) {
+                    writer.appendAsync(("entry" + i).getBytes());
+                }
+                writer.append(("entry" + i).getBytes());
+
+                ledgerId = ledgerId;
+            }
+
+            log.info("Restart bookies so index gets flushed");
+            assertTrue(BookKeeperClusterUtils.stopAllBookies(docker));
+            
assertTrue(BookKeeperClusterUtils.startAllBookiesWithVersion(docker, 
currentVersion));
+
+            log.info("Find the bookie containing the index");
+            String indexFileName = 
String.format("/opt/bookkeeper/data/ledgers/current/0/0/%d.idx", ledgerId);
+            List<String> bookie = 
BookKeeperClusterUtils.allBookies().stream().filter(
 
 Review comment:
   changed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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