Examples of BookieServer


Examples of org.apache.bookkeeper.proto.BookieServer

            urLedgerMgr.releaseUnderreplicatedLedger(lid);
        }
    }

    private String shutdownBookie(int bkShutdownIndex) throws Exception {
        BookieServer bkServer = bs.get(bkShutdownIndex);
        String bookieAddr = StringUtils.addrToString(bkServer.getLocalAddress());
        LOG.debug("Shutting down bookie:" + bookieAddr);
        killBookie(bkShutdownIndex);
        auditorElectors.get(bookieAddr).shutdown();
        auditorElectors.remove(bookieAddr);
        return bookieAddr;
View Full Code Here

Examples of org.apache.bookkeeper.proto.BookieServer

        ServerConfiguration conf = bsConfs.get(0);
        killBookie(0);
        final CountDownLatch latch = new CountDownLatch(1);
        final CountDownLatch shutdownComplete = new CountDownLatch(1);
        // simulating ZooKeeper exception by assigning a closed zk client to bk
        BookieServer bkServer = new BookieServer(conf) {
            protected Bookie newBookie(ServerConfiguration conf)
                    throws IOException, KeeperException, InterruptedException,
                    BookieException {
                return new Bookie(conf) {
                    @Override
                    public void addEntry(ByteBuffer entry, WriteCallback cb,
                                         Object ctx, byte[] masterKey)
                            throws IOException, BookieException {
                        throw new OutOfMemoryError();
                    }
                };
            }
        };
        bkServer.start();

        LedgerHandle lh = bkc.createLedger(1, 1, BookKeeper.DigestType.CRC32, "passwd".getBytes());
        lh.asyncAddEntry("test".getBytes(), new AddCallback() {
                @Override
                public void addComplete(int rc, LedgerHandle lh, long entryId, Object ctx) {
                    // dont care, only trying to trigger OOM
                }
            }, null);
        bkServer.join();
        Assert.assertFalse("Should have died", bkServer.isRunning());
        Assert.assertEquals("Should have died with server exception code",
                            ExitCode.SERVER_EXCEPTION, bkServer.getExitCode());
    }
View Full Code Here

Examples of org.apache.bookkeeper.proto.BookieServer

        // starting the replication service, so that he will be able to act as
        // target bookie
        startNewBookie();
        int newBookieIndex = bs.size() - 1;
        BookieServer newBookieServer = bs.get(newBookieIndex);

        LOG.debug("Waiting to finish the replication of failed bookie : "
                + replicaToKillAddr);
        latch.await();
View Full Code Here

Examples of org.apache.bookkeeper.proto.BookieServer

        // starting the replication service, so that he will be able to act as
        // target bookie
        startNewBookie();
        int newBookieIndex = bs.size() - 1;
        BookieServer newBookieServer = bs.get(newBookieIndex);

        LOG.debug("Waiting to finish the replication of failed bookie : "
                + replicaToKillAddr);

        // waiting to finish replication
View Full Code Here

Examples of org.apache.bookkeeper.proto.BookieServer

        // starting the replication service, so that he will be able to act as
        // target bookie
        startNewBookie();
        int newBookieIndex = bs.size() - 1;
        BookieServer newBookieServer = bs.get(newBookieIndex);

        LOG.debug("Waiting to finish the replication of failed bookie : "
                + replicaToKillAddr);
        while (true) {
            if (latch.getCount() < numberOfLedgers || latch.getCount() <= 0) {
View Full Code Here

Examples of org.apache.bookkeeper.proto.BookieServer

        final ServerConfiguration conf = new ServerConfiguration()
            .setZkServers(null).setJournalDirName(tmpDir.getPath())
            .setAllowLoopback(true).setLedgerDirNames(new String[] { tmpDir.getPath() });

        // simulating ZooKeeper exception by assigning a closed zk client to bk
        BookieServer bkServer = new BookieServer(conf) {
            protected Bookie newBookie(ServerConfiguration conf)
                    throws IOException, KeeperException, InterruptedException,
                    BookieException {
                MockBookie bookie = new MockBookie(conf);
                bookie.zk = zkc;
                zkc.close();
                return bookie;
            };
        };

        bkServer.start();
        bkServer.join();
        Assert.assertEquals("Failed to return ExitCode.ZK_REG_FAIL",
                ExitCode.ZK_REG_FAIL, bkServer.getExitCode());
    }
View Full Code Here

Examples of org.apache.bookkeeper.proto.BookieServer

        int port = 12555;
        conf.setZkServers(null).setBookiePort(port)
            .setAllowLoopback(true)
            .setJournalDirName(tmpDir.getPath())
            .setLedgerDirNames(new String[] { tmpDir.getPath() });
        BookieServer bs1 = new BookieServer(conf);
        bs1.start();

        // starting bk server with same conf
        try {
            BookieServer bs2 = new BookieServer(conf);
            bs2.start();
            fail("Should throw BindException, as the bk server is already running!");
        } catch (BindException be) {
            Assert.assertTrue("BKServer allowed duplicate startups!", be
                    .getMessage().contains("Address already in use"));
        }
View Full Code Here

Examples of org.apache.bookkeeper.proto.BookieServer

                                  + ZooKeeperDefaultPort);
            bsConfs[i].setJournalDirName(tmpDirs[i].getPath());
            bsConfs[i].setLedgerDirNames(new String[] { tmpDirs[i].getPath() });
            bsConfs[i].setAllowLoopback(true);

            bs[i] = new BookieServer(bsConfs[i]);
            bs[i].start();
        }
    }
View Full Code Here

Examples of org.apache.bookkeeper.proto.BookieServer

    // Create Bookie Servers (B1, B2, B3)
    tmpDirB1 = File.createTempFile("bookie1", "test");
        tmpDirB1.delete();
        tmpDirB1.mkdir();
    
    bs1 = new BookieServer(initialPort, tmpDirB1, new File[]{tmpDirB1});
    bs1.start();
   
    tmpDirB2 = File.createTempFile("bookie2", "test");
        tmpDirB2.delete();
        tmpDirB2.mkdir();
       
    bs2 = new BookieServer(initialPort + 1, tmpDirB2, new File[]{tmpDirB2});
    bs2.start();

    tmpDirB3 = File.createTempFile("bookie3", "test");
        tmpDirB3.delete();
        tmpDirB3.mkdir();
       
    bs3 = new BookieServer(initialPort + 2, tmpDirB3, new File[]{tmpDirB3});
    bs3.start();
   
    rng = new Random(System.currentTimeMillis())// Initialize the Random Number Generator
    entries = new ArrayList<byte[]>(); // initialize the  entries list
    entriesSize = new ArrayList<Integer>();
View Full Code Here

Examples of org.apache.bookkeeper.proto.BookieServer

        tmpDir1 = File.createTempFile("bookie1", "test");
        tmpDir1.delete();
        tmpDir1.mkdir();
       
        final int PORT1 = Integer.parseInt(BOOKIEADDR1.split(":")[1]);
        bs1 = new BookieServer(PORT1, tmpDir1, new File[] { tmpDir1 });
        bs1.start();
       
        tmpDir2 = File.createTempFile("bookie2", "test");
        tmpDir2.delete();
        tmpDir2.mkdir();
       
        final int PORT2 = Integer.parseInt(BOOKIEADDR2.split(":")[1]);
        bs2 = new BookieServer(PORT2, tmpDir2, new File[] { tmpDir2 });
        bs2.start();
       
        tmpDir3 = File.createTempFile("bookie3", "test");
        tmpDir3.delete();
        tmpDir3.mkdir();
       
        final int PORT3 = Integer.parseInt(BOOKIEADDR3.split(":")[1]);
        bs3 = new BookieServer(PORT3, tmpDir3, new File[] { tmpDir3 });
        bs3.start();
       
        /*
         * Instantiates a ZooKeeper server. This is a blind copy
         * of setUp from SessionTest.java.
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.