Package org.apache.bookkeeper.meta.LedgerManager

Examples of org.apache.bookkeeper.meta.LedgerManager.LedgerRange


                }
            }
            long lastEnd = -1;

            while(ledgerRangeIterator.hasNext()) {
                LedgerRange lRange = ledgerRangeIterator.next();
                Map<Long, Boolean> subBkActiveLedgers = null;

                Long start = lastEnd + 1;
                Long end = lRange.end();
                if (!ledgerRangeIterator.hasNext()) {
                    end = Long.MAX_VALUE;
                }
                subBkActiveLedgers = bkActiveLedgersSnapshot.subMap(
                        start, true, end, true);

                Set<Long> ledgersInMetadata = lRange.getLedgers();
                LOG.debug("Active in metadata {}, Active in bookie {}",
                          ledgersInMetadata, subBkActiveLedgers.keySet());
                for (Long bkLid : subBkActiveLedgers.keySet()) {
                    if (!ledgersInMetadata.contains(bkLid)) {
                        // remove it from current active ledger
View Full Code Here


                LedgerRangeIterator iter = m.getLedgerRanges();
                if (cmdLine.hasOption("m")) {
                    List<ReadMetadataCallback> futures
                        = new ArrayList<ReadMetadataCallback>(LIST_BATCH_SIZE);
                    while (iter.hasNext()) {
                        LedgerRange r = iter.next();
                        for (Long lid : r.getLedgers()) {
                            ReadMetadataCallback cb = new ReadMetadataCallback(lid);
                            m.readLedgerMetadata(lid, cb);
                            futures.add(cb);
                        }
                        if (futures.size() >= LIST_BATCH_SIZE) {
                            while (futures.size() > 0) {
                                ReadMetadataCallback cb = futures.remove(0);
                                printLedgerMetadata(cb);
                            }
                        }
                    }
                    while (futures.size() > 0) {
                        ReadMetadataCallback cb = futures.remove(0);
                        printLedgerMetadata(cb);
                    }
                } else {
                    while (iter.hasNext()) {
                        LedgerRange r = iter.next();
                        for (Long lid : r.getLedgers()) {
                            System.out.println(Long.toString(lid));
                        }
                    }
                }
            } finally {
View Full Code Here

            };

        SortedSet<Long> scannedLedgers = new TreeSet<Long>();
        LedgerRangeIterator iterator = getLedgerManager().getLedgerRanges();
        while (iterator.hasNext()) {
            LedgerRange ledgerRange = iterator.next();
            scannedLedgers.addAll(ledgerRange.getLedgers());
        }

        assertEquals(createdLedgers, scannedLedgers);

        garbageCollector.gc(cleaner);
View Full Code Here

                    bkActiveLedgersSnapshot.remove(bkLid);
                    garbageCleaner.clean(bkLid);
                }
            }
            while(ledgerRangeIterator.hasNext()) {
                LedgerRange lRange = ledgerRangeIterator.next();
                Map<Long, Boolean> subBkActiveLedgers = null;
                Long start = lRange.start();
                Long end = lRange.end();
                if (end != LedgerRange.NOLIMIT) {
                    subBkActiveLedgers = bkActiveLedgersSnapshot.subMap(start,
                            true, end, true);
                } else {
                    if (start != LedgerRange.NOLIMIT) {
                        subBkActiveLedgers = bkActiveLedgersSnapshot.tailMap(start);
                    } else {
                        subBkActiveLedgers = bkActiveLedgersSnapshot;
                    }
                }
                Set<Long> globalActiveLedgers = lRange.getLedgers();
                LOG.debug("All active ledgers for hash node {}, Current active ledgers from Bookie for hash node {}",
                        globalActiveLedgers, subBkActiveLedgers.keySet());
                for (Long bkLid : subBkActiveLedgers.keySet()) {
                    if (!globalActiveLedgers.contains(bkLid)) {
                        // remove it from current active ledger
View Full Code Here

TOP

Related Classes of org.apache.bookkeeper.meta.LedgerManager.LedgerRange

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.