@Override public Repo<Master> call(long tid, Master env) throws Exception { if (RootTable.ID.equals(tableId) && Operation.MERGE.equals(op)) { log.warn("Attempt to merge tablets for {} does nothing. It is not splittable.", RootTable.NAME); } Text start = startRow.length == 0 ? null : new Text(startRow); Text end = endRow.length == 0 ? null : new Text(endRow); if (start != null && end != null) if (start.compareTo(end) >= 0) throw new AcceptableThriftTableOperationException(tableId.canonicalID(), null, TableOperation.MERGE, TableOperationExceptionType.BAD_RANGE, "start row must be less than end row"); env.mustBeOnline(tableId); MergeInfo info = env.getMergeInfo(tableId); if (info.getState() == MergeState.NONE) { KeyExtent range = new KeyExtent(tableId, end, start); env.setMergeState(new MergeInfo(range, op), MergeState.STARTED); } return new TableRangeOpWait(namespaceId, tableId); }
@Override public void write(DataOutput out) throws IOException { extent.write(out); out.writeInt(state.ordinal()); out.writeInt(operation.ordinal()); }
@Override public void readFields(DataInput in) throws IOException { extent = new KeyExtent(); extent.readFields(in); state = MergeState.values()[in.readInt()]; operation = Operation.values()[in.readInt()]; }
@Override public Repo<Master> call(long tid, Master env) throws Exception { if (RootTable.ID.equals(tableId) && Operation.MERGE.equals(op)) { log.warn("Attempt to merge tablets for " + RootTable.NAME + " does nothing. It is not splittable."); } Text start = startRow.length == 0 ? null : new Text(startRow); Text end = endRow.length == 0 ? null : new Text(endRow); if (start != null && end != null) if (start.compareTo(end) >= 0) throw new AcceptableThriftTableOperationException(tableId, null, TableOperation.MERGE, TableOperationExceptionType.BAD_RANGE, "start row must be less than end row"); env.mustBeOnline(tableId); MergeInfo info = env.getMergeInfo(tableId); if (info.getState() == MergeState.NONE) { KeyExtent range = new KeyExtent(tableId, end, start); env.setMergeState(new MergeInfo(range, op), MergeState.STARTED); } return new TableRangeOpWait(getNamespaceId(env), tableId); }
@Override public Repo<Master> call(long tid, Master master) throws Exception { Text tableIdText = new Text(tableId); MergeInfo mergeInfo = master.getMergeInfo(tableIdText); log.info("removing merge information " + mergeInfo); master.clearMergeState(tableIdText); Utils.unreserveTable(tableId, tid, true); // We can't add entries to the metadata table if it is offline for this merge. // If the delete entries for the metadata table were in the root tablet, it would work just fine // but all the delete entries go into the end of the metadata table. Work around: add the // delete entries after the merge completes. if (mergeInfo.getOperation().equals(Operation.MERGE) && tableId.equals(Constants.METADATA_TABLE_ID)) { return new MakeDeleteEntries(); } return null; }
public boolean isDelete() { return this.operation.equals(Operation.DELETE); }
public boolean isDelete() { return this.operation.equals(Operation.DELETE); }
public String toString() { if (!state.equals(MergeState.NONE)) return "Merge " + operation.toString() + " of " + range + " State: " + state; return "No Merge in progress"; } }
@Override public void readFields(DataInput in) throws IOException { range = new KeyExtent(); range.readFields(in); state = MergeState.values()[in.readInt()]; operation = Operation.values()[in.readInt()]; }
@Override public void write(DataOutput out) throws IOException { extent.write(out); out.writeInt(state.ordinal()); out.writeInt(operation.ordinal()); }
@Override public void readFields(DataInput in) throws IOException { extent = new KeyExtent(); extent.readFields(in); state = MergeState.values()[in.readInt()]; operation = Operation.values()[in.readInt()]; }
@Override public String toString() { if (!state.equals(MergeState.NONE)) return "Merge " + operation.toString() + " of " + extent + " State: " + state; return "No Merge in progress"; } }
@Override public void write(DataOutput out) throws IOException { range.write(out); out.writeInt(state.ordinal()); out.writeInt(operation.ordinal()); }
public boolean isDelete() { return this.operation.equals(Operation.DELETE); }