public static void main(String[] args) throws Exception { ServerUtilOpts opts = new ServerUtilOpts(); opts.parseArgs(MergeStats.class.getName(), args); try (AccumuloClient client = opts.createClient()) { Map<String,String> tableIdMap = client.tableOperations().tableIdMap(); ZooReaderWriter zooReaderWriter = opts.getServerContext().getZooReaderWriter(); for (Entry<String,String> entry : tableIdMap.entrySet()) { final String table = entry.getKey(), tableId = entry.getValue(); String path = ZooUtil.getRoot(client.getInstanceID()) + Constants.ZTABLES + "/" + tableId + "/merge"; MergeInfo info = new MergeInfo(); if (zooReaderWriter.exists(path)) { byte[] data = zooReaderWriter.getData(path, new Stat()); DataInputBuffer in = new DataInputBuffer(); in.reset(data, data.length); info.readFields(in); } System.out.println(String.format("%25s %10s %10s %s", table, info.getState(), info.getOperation(), info.getExtent())); } } } }
@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 static void main(String[] args) throws Exception { ClientOpts opts = new ClientOpts(); opts.parseArgs(MergeStats.class.getName(), args); Connector conn = opts.getConnector(); Map<String,String> tableIdMap = conn.tableOperations().tableIdMap(); for (Entry<String,String> entry : tableIdMap.entrySet()) { final String table = entry.getKey(), tableId = entry.getValue(); String path = ZooUtil.getRoot(conn.getInstance().getInstanceID()) + Constants.ZTABLES + "/" + tableId + "/merge"; MergeInfo info = new MergeInfo(); if (ZooReaderWriter.getInstance().exists(path)) { byte[] data = ZooReaderWriter.getInstance().getData(path, new Stat()); DataInputBuffer in = new DataInputBuffer(); in.reset(data, data.length); info.readFields(in); } System.out.println(String.format("%25s %10s %10s %s", table, info.getState(), info.getOperation(), info.getExtent())); } } }