@Override public void process() { try { LOG.info("Handling table operation " + eventType + " on table " + Bytes.toString(tableName)); List<HRegionInfo> hris = MetaReader.getTableRegions(this.server.getCatalogTracker(), tableName); handleTableOperation(hris); if (eventType.isOnlineSchemaChangeSupported() && this.masterServices. getAssignmentManager().getZKTable(). isEnabledTable(Bytes.toString(tableName))) { if (reOpenAllRegions(hris)) { LOG.info("Completed table operation " + eventType + " on table " + Bytes.toString(tableName)); } else { LOG.warn("Error on reopening the regions"); } } } catch (IOException e) { LOG.error("Error manipulating table " + Bytes.toString(tableName), e); } catch (KeeperException e) { LOG.error("Error manipulating table " + Bytes.toString(tableName), e); } finally { notifyEventBeingHandled(); } }
@Override public void write(DataOutput out) throws IOException { out.writeShort(eventType.ordinal()); out.writeLong(System.currentTimeMillis()); Bytes.writeByteArray(out, regionName); // remaining fields are optional so prefixed with boolean out.writeBoolean(this.origin != null); if (this.origin != null) { Bytes.writeByteArray(out, this.origin.getVersionedBytes()); } out.writeBoolean(this.payload != null); if (this.payload != null) { Bytes.writeByteArray(out, this.payload); } }
@Override public void readFields(DataInput in) throws IOException { // the event type byte eventType = EventType.values()[in.readShort()]; // the timestamp stamp = in.readLong(); // the encoded name of the region being transitioned regionName = Bytes.readByteArray(in); // remaining fields are optional so prefixed with boolean // the name of the regionserver sending the data if (in.readBoolean()) { byte [] versionedBytes = Bytes.readByteArray(in); this.origin = ServerName.parseVersionedServerName(versionedBytes); } if (in.readBoolean()) { this.payload = Bytes.readByteArray(in); } }
LOG.debug(zkw.prefix("Attempting to transition node " + HRegionInfo.prettyPrint(encoded) + " from " + beginState.toString() + " to " + endState.toString())); " not the expected version " + expectedVersion)); return -1; } else if (beginState.equals(EventType.M_ZK_REGION_OFFLINE) && endState.equals(EventType.RS_ZK_REGION_OPENING) && expectedVersion == -1 && stat.getVersion() != 0) { if(!existingData.getEventType().equals(beginState)) { LOG.warn(zkw.prefix("Attempt to transition the " + "unassigned node for " + encoded +
if (!data.getEventType().equals(expectedState)) { LOG.warn(zkw.prefix("Attempting to delete unassigned " + "node " + regionName + " in " + expectedState +
public TableEventHandler(EventType eventType, byte [] tableName, Server server, MasterServices masterServices) throws IOException { super(server, eventType); this.masterServices = masterServices; this.tableName = tableName; 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; } } this.tableNameStr = Bytes.toString(this.tableName); }