@Override public String toString() { if (!state.equals(MergeState.NONE)) return "Merge " + operation + " of " + extent + " State: " + state; return "No Merge in progress"; } }
@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 long isReady(long tid, Master env) { if (!env.getMergeInfo(tableId).getState().equals(MergeState.NONE)) { return 50; } return 0; }
@Override public void write(DataOutput out) throws IOException { range.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()]; }
public static void setMerges(IteratorSetting cfg, Collection<MergeInfo> merges) { DataOutputBuffer buffer = new DataOutputBuffer(); try { for (MergeInfo info : merges) { KeyExtent extent = info.getExtent(); if (extent != null && !info.getState().equals(MergeState.NONE)) { info.write(buffer); } } } catch (Exception ex) { throw new RuntimeException(ex); } String encoded = Base64.getEncoder() .encodeToString(Arrays.copyOf(buffer.getData(), buffer.getLength())); cfg.addOption(MERGES_OPTION, encoded); }
@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 { range = new KeyExtent(); range.readFields(in); state = MergeState.values()[in.readInt()]; operation = Operation.values()[in.readInt()]; }
private void sendChopRequest(MergeInfo info, TabletState state, TabletLocationState tls) { // Don't bother if we're in the wrong state if (!info.getState().equals(MergeState.WAITING_FOR_CHOPPED)) return; // Tablet must be online if (!state.equals(TabletState.HOSTED)) return; // Tablet isn't already chopped if (tls.chopped) return; // Tablet ranges intersect if (info.needsToBeChopped(tls.extent)) { TServerConnection conn; try { conn = this.master.tserverSet.getConnection(tls.current); if (conn != null) { Master.log.info("Asking {} to chop {}", tls.current, tls.extent); conn.chop(this.master.masterLock, tls.extent); } else { Master.log.warn("Could not connect to server {}", tls.current); } } catch (TException e) { Master.log.warn("Communications error asking tablet server to chop a tablet"); } } }
public MergeStats(MergeInfo info) { this.info = info; if (info.getState().equals(MergeState.NONE)) return; if (info.getExtent().getEndRow() == null) upperSplit = true; if (info.getExtent().getPrevEndRow() == null) lowerSplit = true; }
private void sendSplitRequest(MergeInfo info, TabletState state, TabletLocationState tls) { if (!info.getState().equals(MergeState.SPLITTING)) return;
public void setMergeState(MergeInfo info, MergeState state) throws KeeperException, InterruptedException { synchronized (mergeLock) { String path = getZooKeeperRoot() + Constants.ZTABLES + "/" + info.getExtent().getTableId() + "/merge"; info.setState(state); if (state.equals(MergeState.NONE)) { context.getZooReaderWriter().recursiveDelete(path, NodeMissingPolicy.SKIP); } else { DataOutputBuffer out = new DataOutputBuffer(); try { info.write(out); } catch (IOException ex) { throw new RuntimeException("Unlikely", ex); } context.getZooReaderWriter().putPersistentData(path, out.getData(), state.equals(MergeState.STARTED) ? ZooUtil.NodeExistsPolicy.FAIL : ZooUtil.NodeExistsPolicy.OVERWRITE); } mergeLock.notifyAll(); } nextEvent.event("Merge state of %s set to %s", info.getExtent(), state); }
public void update(KeyExtent ke, TabletState state, boolean chopped, boolean hasWALs) { if (info.getState().equals(MergeState.NONE)) return; if (!upperSplit && info.getExtent().getEndRow().equals(ke.getPrevEndRow())) { log.info("Upper split found"); upperSplit = true; } if (!lowerSplit && info.getExtent().getPrevEndRow().equals(ke.getEndRow())) { log.info("Lower split found"); lowerSplit = true; } if (!info.overlaps(ke)) return; if (info.needsToBeChopped(ke)) { this.needsToBeChopped++; if (chopped) { if (state.equals(TabletState.HOSTED)) { this.chopped++; } else if (!hasWALs) { this.chopped++; } } } this.total++; if (state.equals(TabletState.HOSTED)) this.hosted++; if (state.equals(TabletState.UNASSIGNED) || state.equals(TabletState.SUSPENDED)) this.unassigned++; }
@Override public String toString() { if (!state.equals(MergeState.NONE)) return "Merge " + operation.toString() + " of " + extent + " State: " + state; return "No Merge in progress"; } }
public String toString() { if (!state.equals(MergeState.NONE)) return "Merge " + operation.toString() + " of " + range + " State: " + state; return "No Merge in progress"; } }
@Override public long isReady(long tid, Master env) throws Exception { Text tableIdText = new Text(tableId); if (!env.getMergeInfo(tableIdText).getState().equals(MergeState.NONE)) { return 50; } return 0; }
@Override public long isReady(long tid, Master env) throws Exception { if (!env.getMergeInfo(tableId).getState().equals(MergeState.NONE)) { return 50; } return 0; }
public static void setMerges(IteratorSetting cfg, Collection<MergeInfo> merges) { DataOutputBuffer buffer = new DataOutputBuffer(); try { for (MergeInfo info : merges) { KeyExtent extent = info.getRange(); if (extent != null && !info.getState().equals(MergeState.NONE)) { info.write(buffer); } } } catch (Exception ex) { throw new RuntimeException(ex); } String encoded = new String(Base64.encodeBase64(Arrays.copyOf(buffer.getData(), buffer.getLength())), UTF_8); cfg.addOption(MERGES_OPTION, encoded); }
private void sendChopRequest(MergeInfo info, TabletState state, TabletLocationState tls) { // Don't bother if we're in the wrong state if (!info.getState().equals(MergeState.WAITING_FOR_CHOPPED)) return; // Tablet must be online if (!state.equals(TabletState.HOSTED)) return; // Tablet isn't already chopped if (tls.chopped) return; // Tablet ranges intersect if (info.needsToBeChopped(tls.extent)) { TServerConnection conn; try { conn = this.master.tserverSet.getConnection(tls.current); if (conn != null) { Master.log.info("Asking " + tls.current + " to chop " + tls.extent); conn.chop(this.master.masterLock, tls.extent); } else { Master.log.warn("Could not connect to server " + tls.current); } } catch (TException e) { Master.log.warn("Communications error asking tablet server to chop a tablet"); } } }