public void submit(final EventHandler eh) { Executor executor = getExecutor(eh.getEventType().getExecutorServiceType()); if (executor == null) { // This happens only when events are submitted after shutdown() was // called, so dropping them should be "ok" since it means we're // shutting down. LOG.error("Cannot submit [" + eh + "] because the executor is missing." + " Is this process shutting down?"); } else { executor.submit(eh); } }
when(rss.getRegionServerAccounting()).thenReturn(new RegionServerAccounting(CONF)); String string = org.apache.hadoop.hbase.executor.EventType.RS_COMPACTED_FILES_DISCHARGER .toString(); ExecutorService es = new ExecutorService(string); es.startExecutorService(
if(LOG.isDebugEnabled()) { LOG.debug(zkw.prefix("Transitioning " + HRegionInfo.prettyPrint(encoded) + " from " + beginState.toString() + " to " + endState.toString())); if (beginState.equals(EventType.M_ZK_REGION_OFFLINE) && endState.equals(EventType.RS_ZK_REGION_OPENING) && expectedVersion == -1 && stat.getVersion() != 0) { if (!et.equals(beginState)) { String existingServer = (rt.getServerName() == null) ? "<unknown>" : rt.getServerName().toString();
public TableEventHandler prepare() throws IOException { //acquire the table write lock, blocking this.tableLock = masterServices.getTableLockManager() .writeLock(tableName, eventType.toString()); this.tableLock.acquire(); boolean success = false; try { try { this.masterServices.checkTableModifiable(tableName); } catch (TableNotDisabledException ex) { if (isOnlineSchemaChangeAllowed() && eventType.isOnlineSchemaChangeSupported()) { LOG.debug("Ignoring table not disabled exception " + "for supporting online schema changes."); } else { throw ex; } } prepareWithTableLock(); success = true; } finally { if (!success ) { releaseTableLock(); } } this.isPrepareCalled = true; return this; }
/** * @param type * @param regionName * @param sn * @param payload May be null * @return a serialized pb {@link RegionTransition} */ public static RegionTransition createRegionTransition(final EventType type, final byte [] regionName, final ServerName sn, final byte [] payload) { org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName pbsn = org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName.newBuilder(). setHostName(sn.getHostname()).setPort(sn.getPort()).setStartCode(sn.getStartcode()).build(); ZooKeeperProtos.RegionTransition.Builder builder = ZooKeeperProtos.RegionTransition.newBuilder(). setEventTypeCode(type.getCode()).setRegionName(ByteStringer.wrap(regionName)). setServerName(pbsn); builder.setCreateTime(System.currentTimeMillis()); if (payload != null) builder.setPayload(ByteStringer.wrap(payload)); return new RegionTransition(builder.build()); }
public EventType getEventType() { return EventType.get(this.rt.getEventTypeCode()); }
if (eventType.isOnlineSchemaChangeSupported() && this.masterServices. getAssignmentManager().getTableStateManager().isTableState( tableName, ZooKeeperProtos.Table.State.ENABLED)) {
public CreateTableHandler(Server server, MasterFileSystem fileSystemManager, HTableDescriptor hTableDescriptor, Configuration conf, HRegionInfo [] newRegions, MasterServices masterServices) { super(server, EventType.C_M_CREATE_TABLE); this.fileSystemManager = fileSystemManager; this.hTableDescriptor = hTableDescriptor; this.conf = conf; this.newRegions = newRegions; this.assignmentManager = masterServices.getAssignmentManager(); this.tableLockManager = masterServices.getTableLockManager(); this.tableLock = this.tableLockManager.writeLock(this.hTableDescriptor.getTableName() , EventType.C_M_CREATE_TABLE.toString()); }
EventType.C_M_DISABLE_TABLE.toString()); this.tableLock.acquire();
public void submit(final EventHandler eh) { Executor executor = getExecutor(eh.getEventType().getExecutorServiceType()); if (executor == null) { // This happens only when events are submitted after shutdown() was // called, so dropping them should be "ok" since it means we're // shutting down. LOG.error("Cannot submit [" + eh + "] because the executor is missing." + " Is this process shutting down?"); } else { executor.submit(eh); } }
if (data != null) { RegionTransition rt = RegionTransition.parseFrom(data); if (rt.getEventType().equals(EventType.RS_ZK_REQUEST_REGION_SPLIT)) { TableName table = HRegionInfo.getTable(rt.getRegionName()); if (!checkAndUpdateNamespaceRegionCount(table, rt.getRegionName(), 1)) { ZKUtil.deleteNode(watcher, ZKUtil.joinZNode(watcher.assignmentZNode, child)); } else if (rt.getEventType().equals(EventType.RS_ZK_REQUEST_REGION_MERGE)) { TableName table = HRegionInfo.getTable(rt.getRegionName()); checkAndUpdateNamespaceRegionCount(table, rt.getRegionName(), -1);
when(rss.getRegionServerAccounting()).thenReturn(new RegionServerAccounting(CONF)); String string = org.apache.hadoop.hbase.executor.EventType.RS_COMPACTED_FILES_DISCHARGER .toString(); ExecutorService es = new ExecutorService(string); es.startExecutorService(
RegionTransition rt= RegionTransition.parseFrom(existingBytes); EventType et = rt.getEventType(); if (et.equals(EventType.RS_ZK_REGION_OPENED)) { LOG.debug("ALREADY_OPENED " + region.getRegionNameAsString() + " and node in "+et+" state");
EventType.C_M_ENABLE_TABLE.toString()); this.tableLock.acquire();
if (!EventType.M_ZK_REGION_CLOSING.equals(rt.getEventType())) { LOG.warn(zkw.prefix("Attempt to check the " + "closing node for " + encoded +
/** * @param snapshot descriptor of the snapshot to take * @param masterServices master services provider */ public TakeSnapshotHandler(SnapshotDescription snapshot, final MasterServices masterServices) { super(masterServices, EventType.C_M_SNAPSHOT_TABLE); assert snapshot != null : "SnapshotDescription must not be nul1"; assert masterServices != null : "MasterServices must not be nul1"; this.master = masterServices; this.snapshot = snapshot; this.snapshotTable = TableName.valueOf(snapshot.getTable()); this.conf = this.master.getConfiguration(); this.fs = this.master.getMasterFileSystem().getFileSystem(); this.rootDir = this.master.getMasterFileSystem().getRootDir(); this.snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshot, rootDir); this.workingDir = SnapshotDescriptionUtils.getWorkingSnapshotDir(snapshot, rootDir); this.monitor = new ForeignExceptionDispatcher(snapshot.getName()); this.snapshotManifest = SnapshotManifest.create(conf, fs, workingDir, snapshot, monitor); this.tableLockManager = master.getTableLockManager(); this.tableLock = this.tableLockManager.writeLock( snapshotTable, EventType.C_M_SNAPSHOT_TABLE.toString()); // prepare the verify this.verifier = new MasterSnapshotVerifier(masterServices, snapshot, rootDir); // update the running tasks this.status = TaskMonitor.get().createStatus( "Taking " + snapshot.getType() + " snapshot on table: " + snapshotTable); }