Examples of readEntries()


Examples of org.apache.bookkeeper.client.LedgerHandle.readEntries()

        BookieServer server = new BookieServer(bsConfs.get(3));
        server.start();
        bs.set(3, server);

        assertEquals(numEntries - 1 , lh.getLastAddConfirmed());
        Enumeration<LedgerEntry> entries = lh.readEntries(0, lh.getLastAddConfirmed());

        int numScanned = 0;
        while (entries.hasMoreElements()) {
            assertEquals((""+numScanned), new String(entries.nextElement().getEntry()));
            numScanned++;
View Full Code Here

Examples of org.apache.bookkeeper.client.LedgerHandle.readEntries()

        BookieServer server = new BookieServer(bsConfs.get(3));
        server.start();
        bs.set(3, server);

        assertEquals(numEntries - 1 , lh.getLastAddConfirmed());
        Enumeration<LedgerEntry> entries = lh.readEntries(0, lh.getLastAddConfirmed());

        int numScanned = 0;
        while (entries.hasMoreElements()) {
            assertEquals((""+numScanned), new String(entries.nextElement().getEntry()));
            numScanned++;
View Full Code Here

Examples of org.apache.bookkeeper.client.LedgerHandle.readEntries()

            while (startSeqId <= tEndSeqId) {
                correctedEndSeqId = Math.min(startSeqId + NUM_MESSAGES_TO_PRINT - 1, tEndSeqId);
               
                try {
                    Enumeration<LedgerEntry> seq =
                        lh.readEntries(startSeqId - ledger.getStartSeqIdIncluded(),
                                       correctedEndSeqId - ledger.getStartSeqIdIncluded());
                    LedgerEntry entry = null;
                    while (seq.hasMoreElements()) {
                        entry = seq.nextElement();
                        Message message;
View Full Code Here

Examples of org.apache.bookkeeper.client.LedgerHandle.readEntries()

                bookie.isRunning() && bookie.isReadOnly());

        // Now kill the other bookie and read entries from the readonly bookie
        killBookie(0);

        Enumeration<LedgerEntry> readEntries = ledger.readEntries(0, 9);
        while (readEntries.hasMoreElements()) {
            LedgerEntry entry = readEntries.nextElement();
            assertEquals("Entry should contain correct data", "data",
                    new String(entry.getEntry()));
        }
View Full Code Here

Examples of org.apache.bookkeeper.client.LedgerHandle.readEntries()

                if(i == numEntriesToWrite/2) {
                    LedgerHandle lhOpen = bkc.openLedgerNoRecovery(ledgerId, digestType, ledgerPassword);
                    // no recovery opened ledger 's last confirmed entry id is less than written
                    // and it just can read until (i-1)
                    int toRead = i - 1;
                    Enumeration<LedgerEntry> readEntry = lhOpen.readEntries(toRead, toRead);
                    assertTrue("Enumeration of ledger entries has no element", readEntry.hasMoreElements() == true);
                    LedgerEntry e = readEntry.nextElement();
                    assertEquals(toRead, e.getEntryId());
                    Assert.assertArrayEquals(entries.get(toRead), e.getEntry());
                    // should not written to a read only ledger
View Full Code Here

Examples of org.apache.bookkeeper.client.LedgerHandle.readEntries()

                    // and it just can read until (i-1)
                    int toRead = i - 1;

                    long readLastConfirmed = lhOpen.readLastConfirmed();
                    assertTrue(readLastConfirmed != 0);
                    Enumeration<LedgerEntry> readEntry = lhOpen.readEntries(toRead, toRead);
                    assertTrue("Enumeration of ledger entries has no element", readEntry.hasMoreElements() == true);
                    LedgerEntry e = readEntry.nextElement();
                    assertEquals(toRead, e.getEntryId());
                    Assert.assertArrayEquals(entries.get(toRead), e.getEntry());
                    // should not written to a read only ledger
View Full Code Here

Examples of org.apache.bookkeeper.client.LedgerHandle.readEntries()

        return lhs;
    }

    private void verifyLedger(long lid, long startEntryId, long endEntryId) throws Exception {
        LedgerHandle lh = bkc.openLedger(lid, digestType, "".getBytes());
        Enumeration<LedgerEntry> entries = lh.readEntries(startEntryId, endEntryId);
        while (entries.hasMoreElements()) {
            LedgerEntry entry = entries.nextElement();
            assertEquals(msg, new String(entry.getEntry()));
        }
    }
View Full Code Here

Examples of org.apache.bookkeeper.client.LedgerHandle.readEntries()

        Thread.sleep(2 * baseConf.getFlushInterval());

        // restart bookies
        restartBookies();

        Enumeration<LedgerEntry> seq = wlh.readEntries(0, numMsgs - 1);
        assertTrue("Enumeration of ledger entries has no element", seq.hasMoreElements() == true);
        int entryId = 0;
        while (seq.hasMoreElements()) {
            LedgerEntry e = seq.nextElement();
            assertEquals(entryId, e.getEntryId());
View Full Code Here

Examples of org.apache.bookkeeper.client.LedgerHandle.readEntries()

    private void verifyRecoveredLedgers(LedgerHandle lh, long startEntryId,
            long endEntryId) throws BKException, InterruptedException {
        LedgerHandle lhs = bkc.openLedgerNoRecovery(lh.getId(),
                BookKeeper.DigestType.CRC32, TESTPASSWD);
        Enumeration<LedgerEntry> entries = lhs.readEntries(startEntryId,
                endEntryId);
        assertTrue("Should have the elements", entries.hasMoreElements());
        while (entries.hasMoreElements()) {
            LedgerEntry entry = entries.nextElement();
            assertEquals("TestReplicationWorker", new String(entry.getEntry()));
View Full Code Here

Examples of org.apache.bookkeeper.client.LedgerHandle.readEntries()

        // should not have triggered recovery and fencing
       
        writelh.addEntry(tmp.getBytes());
        long numReadable = readlh.getLastAddConfirmed();
        LOG.error("numRead " + numReadable);
        Enumeration<LedgerEntry> entries = readlh.readEntries(1, numReadable);
        try {
            readlh.readEntries(numReadable+1, numReadable+1);
            fail("Shouldn't have been able to read this far");
        } catch (BKException.BKReadException e) {
            // all is good
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.