Search in sources :

Example 1 with LayoutManager

use of org.apache.bookkeeper.meta.LayoutManager in project incubator-pulsar by apache.

the class PulsarRegistrationManager method nukeExistingCluster.

@Override
public boolean nukeExistingCluster() throws Exception {
    log.info("Nuking metadata of existing cluster, ledger root path: {}", ledgersRootPath);
    if (!store.exists(ledgersRootPath + "/" + INSTANCEID).join()) {
        log.info("There is no existing cluster with ledgersRootPath: {}, so exiting nuke operation", ledgersRootPath);
        return true;
    }
    @Cleanup RegistrationClient registrationClient = new PulsarRegistrationClient(store, ledgersRootPath);
    Collection<BookieId> rwBookies = registrationClient.getWritableBookies().join().getValue();
    if (rwBookies != null && !rwBookies.isEmpty()) {
        log.error("Bookies are still up and connected to this cluster, " + "stop all bookies before nuking the cluster");
        return false;
    }
    Collection<BookieId> roBookies = registrationClient.getReadOnlyBookies().join().getValue();
    if (roBookies != null && !roBookies.isEmpty()) {
        log.error("Readonly Bookies are still up and connected to this cluster, " + "stop all bookies before nuking the cluster");
        return false;
    }
    LayoutManager layoutManager = new PulsarLayoutManager(store, ledgersRootPath);
    LedgerManagerFactory ledgerManagerFactory = new PulsarLedgerManagerFactory();
    ledgerManagerFactory.initialize(conf, layoutManager, LegacyHierarchicalLedgerManagerFactory.CUR_VERSION);
    return ledgerManagerFactory.validateAndNukeExistingCluster(conf, layoutManager);
}
Also used : BookieId(org.apache.bookkeeper.net.BookieId) LayoutManager(org.apache.bookkeeper.meta.LayoutManager) RegistrationClient(org.apache.bookkeeper.discover.RegistrationClient) Cleanup(lombok.Cleanup) LegacyHierarchicalLedgerManagerFactory(org.apache.bookkeeper.meta.LegacyHierarchicalLedgerManagerFactory) LedgerManagerFactory(org.apache.bookkeeper.meta.LedgerManagerFactory)

Example 2 with LayoutManager

use of org.apache.bookkeeper.meta.LayoutManager in project pulsar by yahoo.

the class PulsarRegistrationManager method nukeExistingCluster.

@Override
public boolean nukeExistingCluster() throws Exception {
    log.info("Nuking metadata of existing cluster, ledger root path: {}", ledgersRootPath);
    if (!store.exists(ledgersRootPath + "/" + INSTANCEID).join()) {
        log.info("There is no existing cluster with ledgersRootPath: {}, so exiting nuke operation", ledgersRootPath);
        return true;
    }
    @Cleanup RegistrationClient registrationClient = new PulsarRegistrationClient(store, ledgersRootPath);
    Collection<BookieId> rwBookies = registrationClient.getWritableBookies().join().getValue();
    if (rwBookies != null && !rwBookies.isEmpty()) {
        log.error("Bookies are still up and connected to this cluster, " + "stop all bookies before nuking the cluster");
        return false;
    }
    Collection<BookieId> roBookies = registrationClient.getReadOnlyBookies().join().getValue();
    if (roBookies != null && !roBookies.isEmpty()) {
        log.error("Readonly Bookies are still up and connected to this cluster, " + "stop all bookies before nuking the cluster");
        return false;
    }
    LayoutManager layoutManager = new PulsarLayoutManager(store, ledgersRootPath);
    LedgerManagerFactory ledgerManagerFactory = new PulsarLedgerManagerFactory();
    ledgerManagerFactory.initialize(conf, layoutManager, LegacyHierarchicalLedgerManagerFactory.CUR_VERSION);
    return ledgerManagerFactory.validateAndNukeExistingCluster(conf, layoutManager);
}
Also used : BookieId(org.apache.bookkeeper.net.BookieId) LayoutManager(org.apache.bookkeeper.meta.LayoutManager) RegistrationClient(org.apache.bookkeeper.discover.RegistrationClient) Cleanup(lombok.Cleanup) LegacyHierarchicalLedgerManagerFactory(org.apache.bookkeeper.meta.LegacyHierarchicalLedgerManagerFactory) LedgerManagerFactory(org.apache.bookkeeper.meta.LedgerManagerFactory)

Example 3 with LayoutManager

use of org.apache.bookkeeper.meta.LayoutManager in project pulsar by apache.

the class PulsarRegistrationManager method nukeExistingCluster.

@Override
public boolean nukeExistingCluster() throws Exception {
    log.info("Nuking metadata of existing cluster, ledger root path: {}", ledgersRootPath);
    if (!store.exists(ledgersRootPath + "/" + INSTANCEID).join()) {
        log.info("There is no existing cluster with ledgersRootPath: {}, so exiting nuke operation", ledgersRootPath);
        return true;
    }
    @Cleanup RegistrationClient registrationClient = new PulsarRegistrationClient(store, ledgersRootPath);
    Collection<BookieId> rwBookies = registrationClient.getWritableBookies().join().getValue();
    if (rwBookies != null && !rwBookies.isEmpty()) {
        log.error("Bookies are still up and connected to this cluster, " + "stop all bookies before nuking the cluster");
        return false;
    }
    Collection<BookieId> roBookies = registrationClient.getReadOnlyBookies().join().getValue();
    if (roBookies != null && !roBookies.isEmpty()) {
        log.error("Readonly Bookies are still up and connected to this cluster, " + "stop all bookies before nuking the cluster");
        return false;
    }
    LayoutManager layoutManager = new PulsarLayoutManager(store, ledgersRootPath);
    LedgerManagerFactory ledgerManagerFactory = new PulsarLedgerManagerFactory();
    ledgerManagerFactory.initialize(conf, layoutManager, LegacyHierarchicalLedgerManagerFactory.CUR_VERSION);
    return ledgerManagerFactory.validateAndNukeExistingCluster(conf, layoutManager);
}
Also used : BookieId(org.apache.bookkeeper.net.BookieId) LayoutManager(org.apache.bookkeeper.meta.LayoutManager) RegistrationClient(org.apache.bookkeeper.discover.RegistrationClient) Cleanup(lombok.Cleanup) LegacyHierarchicalLedgerManagerFactory(org.apache.bookkeeper.meta.LegacyHierarchicalLedgerManagerFactory) LedgerManagerFactory(org.apache.bookkeeper.meta.LedgerManagerFactory)

Aggregations

Cleanup (lombok.Cleanup)3 RegistrationClient (org.apache.bookkeeper.discover.RegistrationClient)3 LayoutManager (org.apache.bookkeeper.meta.LayoutManager)3 LedgerManagerFactory (org.apache.bookkeeper.meta.LedgerManagerFactory)3 LegacyHierarchicalLedgerManagerFactory (org.apache.bookkeeper.meta.LegacyHierarchicalLedgerManagerFactory)3 BookieId (org.apache.bookkeeper.net.BookieId)3