protected int removeReplicationEntries(Map<UUID,TServerInstance> candidates) { try { try { final Scanner s = ReplicationTable.getScanner(context); StatusSection.limit(s); for (Entry<Key,Value> entry : s) { UUID id = path2uuid(new Path(entry.getKey().getRow().toString())); candidates.remove(id); log.info("Ignore closed log " + id + " because it is being replicated"); } } catch (ReplicationTableOfflineException ex) { return candidates.size(); } final Scanner scanner = context.createScanner(MetadataTable.NAME, Authorizations.EMPTY); scanner.fetchColumnFamily(MetadataSchema.ReplicationSection.COLF); scanner.setRange(MetadataSchema.ReplicationSection.getRange()); for (Entry<Key,Value> entry : scanner) { Text file = new Text(); MetadataSchema.ReplicationSection.getFile(entry.getKey(), file); UUID id = path2uuid(new Path(file.toString())); candidates.remove(id); log.info("Ignore closed log " + id + " because it is being replicated"); } return candidates.size(); } catch (TableNotFoundException e) { log.error("Failed to scan metadata table", e); throw new IllegalArgumentException(e); } }
for (Entry<Key,Value> entry : metaBs) { if (tableId.equals(ReplicationSection.getTableId(entry.getKey()))) { ReplicationSection.getFile(entry.getKey(), buffer); wals.add(buffer.toString());
MetadataSchema.ReplicationSection.getFile(entry.getKey(), replFileText); String replFile = replFileText.toString(); boolean isClosed = closedWals.contains(replFile);
MetadataSchema.ReplicationSection.getFile(entry.getKey(), file); String tableId = MetadataSchema.ReplicationSection.getTableId(entry.getKey());
MetadataSchema.ReplicationSection.getFile(entry.getKey(), replFileText); String replFile = replFileText.toString(); boolean isClosed = closedWals.contains(replFile);
for (Entry<Key,Value> entry : metaBs) { if (tableId.equals(ReplicationSection.getTableId(entry.getKey()))) { ReplicationSection.getFile(entry.getKey(), buffer); wals.add(buffer.toString());
for (Entry<Key,Value> entry : scanner) { Text file = new Text(); MetadataSchema.ReplicationSection.getFile(entry.getKey(), file); UUID id = path2uuid(new Path(file.toString())); candidates.remove(id);
/** * Get the replication status messages for the given table that exist in the metadata table (~repl * entries) */ private Map<String,Status> getMetadataStatusForTable(String tableName) throws Exception { final Connector conn = getConnector(); final String tableId = conn.tableOperations().tableIdMap().get(tableName); Assert.assertNotNull("Could not determine table ID for " + tableName, tableId); Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY); Range r = MetadataSchema.ReplicationSection.getRange(); s.setRange(r); s.fetchColumn(MetadataSchema.ReplicationSection.COLF, new Text(tableId)); Map<String,Status> fileToStatus = new HashMap<>(); for (Entry<Key,Value> entry : s) { Text file = new Text(); MetadataSchema.ReplicationSection.getFile(entry.getKey(), file); Status status = Status.parseFrom(entry.getValue().get()); log.info("Got status for {}: {}", file, ProtobufUtil.toString(status)); fileToStatus.put(file.toString(), status); } return fileToStatus; }
MetadataSchema.ReplicationSection.getFile(entry.getKey(), file); Table.ID tableId = MetadataSchema.ReplicationSection.getTableId(entry.getKey());