Package org.apache.accumulo.server.master.EventCoordinator

Examples of org.apache.accumulo.server.master.EventCoordinator.Listener


      zoo.putPersistentData(path, "forced down".getBytes(Constants.UTF8), NodeExistsPolicy.OVERWRITE);
      return null;
    }
   
    // TODO move this to isReady() and drop while loop? - ACCUMULO-1259
    Listener listener = master.getEventCoordinator().getListener();
    master.shutdownTServer(server);
    while (master.onlineTabletServers().contains(server)) {
      TServerConnection connection = master.getConnection(server);
      if (connection != null) {
        try {
          TabletServerStatus status = connection.getTableMap(false);
          if (status.tableMap != null && status.tableMap.isEmpty()) {
            log.info("tablet server hosts no tablets " + server);
            connection.halt(master.getMasterLock());
            log.info("tablet server asked to halt " + server);
            break;
          }
        } catch (TTransportException ex) {
          // expected
        } catch (Exception ex) {
          log.error("Error talking to tablet server " + server + ": " + ex);
        }
      }
      listener.waitForEvents(1000);
    }
   
    return null;
  }
View Full Code Here


      zoo.putPersistentData(path, "forced down".getBytes(), NodeExistsPolicy.OVERWRITE);
      return new DisconnectLogger(server.getLocation().getAddress().getHostAddress());
    }
   
    // TODO move this to isReady() and drop while loop?
    Listener listener = m.getEventCoordinator().getListener();
    m.shutdownTServer(server);
    while (m.onlineTabletServers().contains(server)) {
      TServerConnection connection = m.getConnection(server);
      if (connection != null) {
        try {
          TabletServerStatus status = connection.getTableMap(false);
          if (status.tableMap != null && status.tableMap.isEmpty()) {
            log.info("tablet server hosts no tablets " + server);
            connection.halt(m.getMasterLock());
            log.info("tablet server asked to halt " + server);
            break;
          }
        } catch (TTransportException ex) {
          // expected
        } catch (Exception ex) {
          log.error("Error talking to tablet server " + server + ": " + ex);
        }
      }
      listener.waitForEvents(1000);
    }
   
    return new DisconnectLogger(server.getLocation().getAddress().getHostAddress());
  }
View Full Code Here

      zoo.putPersistentData(path, "forced down".getBytes(), NodeExistsPolicy.OVERWRITE);
      return null;
    }
   
    // TODO move this to isReady() and drop while loop? - ACCUMULO-1259
    Listener listener = master.getEventCoordinator().getListener();
    master.shutdownTServer(server);
    while (master.onlineTabletServers().contains(server)) {
      TServerConnection connection = master.getConnection(server);
      if (connection != null) {
        try {
          TabletServerStatus status = connection.getTableMap(false);
          if (status.tableMap != null && status.tableMap.isEmpty()) {
            log.info("tablet server hosts no tablets " + server);
            connection.halt(master.getMasterLock());
            log.info("tablet server asked to halt " + server);
            break;
          }
        } catch (TTransportException ex) {
          // expected
        } catch (Exception ex) {
          log.error("Error talking to tablet server " + server + ": " + ex);
        }
      }
      listener.waitForEvents(1000);
    }
   
    return null;
  }
View Full Code Here

      zoo.putPersistentData(path, "forced down".getBytes(), NodeExistsPolicy.OVERWRITE);
      return new DisconnectLogger(server.getLocation().getAddress().getHostAddress());
    }
   
    // TODO move this to isReady() and drop while loop?
    Listener listener = m.getEventCoordinator().getListener();
    m.shutdownTServer(server);
    while (m.onlineTabletServers().contains(server)) {
      TServerConnection connection = m.getConnection(server);
      if (connection != null) {
        try {
          TabletServerStatus status = connection.getTableMap();
          if (status.tableMap != null && status.tableMap.isEmpty()) {
            log.info("tablet server hosts no tablets " + server);
            connection.halt(m.getMasterLock());
            log.info("tablet server asked to halt " + server);
            break;
          }
        } catch (TTransportException ex) {
          // expected
        } catch (Exception ex) {
          log.error("Error talking to tablet server " + server + ": " + ex);
        }
      }
      listener.waitForEvents(1000);
    }
   
    return new DisconnectLogger(server.getLocation().getAddress().getHostAddress());
  }
View Full Code Here

 
  @Override
  public Repo<Master> call(long tid, Master m) throws Exception {
    // TODO move this code to isReady() and drop while loop?
    // Make sure nobody is still using logs hosted on that node
    Listener listener = m.getEventCoordinator().getListener();
    while (m.stillMaster()) {
      boolean flushed = false;
      ZooTabletStateStore zooTabletStateStore = null;
      try {
        zooTabletStateStore = new ZooTabletStateStore();
      } catch (DistributedStoreException e) {
        log.warn("Unable to open ZooTabletStateStore, will retry", e);
      }
      MetaDataStateStore theRest = null;
     
      if (m.onlineTabletServers().size() != 0)
        theRest = new MetaDataStateStore();
     
      for (TabletStateStore store : new TabletStateStore[] {zooTabletStateStore, theRest}) {
        if (store != null) {
          for (TabletLocationState tabletState : store) {
            for (Collection<String> logSet : tabletState.walogs) {
              for (String logEntry : logSet) {
                if (logger.equals(logEntry.split("/")[0])) {
                  TServerConnection tserver = m.getConnection(tabletState.current);
                  if (tserver != null) {
                    log.info("Requesting " + tabletState.current + " flush tablet " + tabletState.extent + " because it has a log entry " + logEntry);
                    tserver.flushTablet(m.getMasterLock(), tabletState.extent);
                  }
                  flushed = true;
                }
              }
            }
          }
        }
      }
      if (zooTabletStateStore != null && !flushed)
        break;
      listener.waitForEvents(1000);
    }
    return new StopLogger(logger);
  }
View Full Code Here

      zoo.putPersistentData(path, "forced down".getBytes(), NodeExistsPolicy.OVERWRITE);
      return new DisconnectLogger(server.getLocation().getAddress().getHostAddress());
    }
   
    // TODO move this to isReady() and drop while loop?
    Listener listener = m.getEventCoordinator().getListener();
    m.shutdownTServer(server);
    while (m.stillMaster() && m.onlineTabletServers().contains(server)) {
      TServerConnection connection = m.getConnection(server);
      if (connection != null) {
        try {
          TabletServerStatus status = connection.getTableMap();
          if (status.tableMap != null && status.tableMap.isEmpty()) {
            log.info("tablet server hosts no tablets " + server);
            connection.halt(m.getMasterLock());
            log.info("tablet server asked to halt " + server);
            break;
          }
        } catch (TTransportException ex) {
          // expected
        } catch (Exception ex) {
          log.error("Error talking to tablet server " + server + ": " + ex);
        }
      }
      listener.waitForEvents(1000);
    }
   
    return new DisconnectLogger(server.getLocation().getAddress().getHostAddress());
  }
View Full Code Here

 
  @Override
  public Repo<Master> call(long tid, Master m) throws Exception {
    // TODO move this code to isReady() and drop while loop?
    // Make sure nobody is still using logs hosted on that node
    Listener listener = m.getEventCoordinator().getListener();
    while (m.stillMaster()) {
      boolean flushed = false;
      ZooTabletStateStore zooTabletStateStore = null;
      try {
        zooTabletStateStore = new ZooTabletStateStore();
      } catch (DistributedStoreException e) {
        log.warn("Unable to open ZooTabletStateStore, will retry", e);
      }
      MetaDataStateStore theRest = new MetaDataStateStore();
      for (TabletStateStore store : new TabletStateStore[] {zooTabletStateStore, theRest}) {
        if (store != null) {
          for (TabletLocationState tabletState : store) {
            for (Collection<String> logSet : tabletState.walogs) {
              for (String logEntry : logSet) {
                if (logger.equals(logEntry.split("/")[0])) {
                  TServerConnection tserver = m.getConnection(tabletState.current);
                  if (tserver != null) {
                    log.info("Requesting " + tabletState.current + " flush tablet " + tabletState.extent + " because it has a log entry " + logEntry);
                    tserver.flushTablet(m.getMasterLock(), tabletState.extent);
                  }
                  flushed = true;
                }
              }
            }
          }
        }
      }
      if (zooTabletStateStore != null && !flushed)
        break;
      listener.waitForEvents(1000);
    }
    return new StopLogger(logger);
  }
View Full Code Here

TOP

Related Classes of org.apache.accumulo.server.master.EventCoordinator.Listener

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.