Uploaded image for project: 'Bookkeeper'
  1. Bookkeeper
  2. BOOKKEEPER-956

HierarchicalLedgerManager doesn't work for ledgerid of length 9 and 10 because of order issue in HierarchicalLedgerRangeIterator

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 4.5.0
    • None
    • None

    Description

      Issue Description:-
      HierarchicalLedgerManager is supposed to work for ledgerids upto length of 10 (its layout is 2-4-4). But because of order issue in HierarchicalLedgerRangeIterator it doesn't work correctly if we create Ledgers of ledgerid length 9 and 10.

      Rootcause:- in HierarchicalLedgerRangeIterator, in 'preload' method after getting l1Nodes by calling "zk.getChildren(ledgerRootPath, null)", they need to be sorted, just like l2nodes in 'nextL1Node' method

      How it manifests:-
      If we try to create Ledgers using LedgerCreateAdv api with ledgerids of lengths 9 and 10, write entries and read entries, it will fail with following exception messages

      2015-11-30 13:57:31,209 - WARN - [GarbageCollectorThread:ScanAndCompareGarbageCollector@103] - Exception when iterating over the metadata {}
      java.lang.IllegalArgumentException: inconsistent range
      at java.util.concurrent.ConcurrentSkipListMap$SubMap.<init>(ConcurrentSkipListMap.java:2506)
      at java.util.concurrent.ConcurrentSkipListMap.subMap(ConcurrentSkipListMap.java:1984)
      at java.util.concurrent.ConcurrentSkipListMap.subMap(ConcurrentSkipListMap.java:93)
      at org.apache.bookkeeper.bookie.ScanAndCompareGarbageCollector.gc(ScanAndCompareGarbageCollector.java:86)
      at org.apache.bookkeeper.bookie.GarbageCollectorThread.doGcLedgers(GarbageCollectorThread.java:419)
      at org.apache.bookkeeper.bookie.GarbageCollectorThread.run(GarbageCollectorThread.java:377)

      org.apache.bookkeeper.client.BKException$BKNotEnoughBookiesException
      at org.apache.bookkeeper.client.BKException.create(BKException.java:58)
      at org.apache.bookkeeper.client.LedgerHandleAdv.addEntry(LedgerHandleAdv.java:101)
      at org.apache.bookkeeper.client.LedgerHandleAdv.addEntry(LedgerHandleAdv.java:70)
      at org.apache.bookkeeper.client.BookieWriteLedgerTest.testLedgerCreateAdvWithLedgerId(BookieWriteLedgerTest.java:212)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
      at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      at java.lang.Thread.run(Thread.java:745)

      Attachments

        Issue Links

          Activity

            People

              reddycharan18@gmail.com Charan Reddy Guttapalem
              reddycharan18@gmail.com Charan Reddy Guttapalem
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: