wchevreuil commented on a change in pull request #81:
URL:
https://github.com/apache/hbase-operator-tools/pull/81#discussion_r689419142
##########
File path: hbase-hbck2/src/main/java/org/apache/hbase/HBCKMetaTableAccessor.java
##########
@@ -263,6 +259,39 @@ public static void addRegionToMeta(Connection conn,
RegionInfo region) throws IO
});
}
+
+ /**
+ * List all dirty metadata currently in META.
Review comment:
Let's explain properly what "dirty" means in this context.
##########
File path: hbase-hbck2/src/main/java/org/apache/hbase/HBCK2.java
##########
@@ -100,6 +102,7 @@
private static final String SET_REGION_STATE = "setRegionState";
private static final String SCHEDULE_RECOVERIES = "scheduleRecoveries";
private static final String GENERATE_TABLE_INFO =
"generateMissingTableDescriptorFile";
+ private static final String REPORT_DIRTY_METADATA = "reportDirtyMetadata";
Review comment:
Let's give this command a more intuitive name. What's dirtyMetadata?
##########
File path: hbase-hbck2/src/main/java/org/apache/hbase/HBCKMetaTableAccessor.java
##########
@@ -263,6 +259,39 @@ public static void addRegionToMeta(Connection conn,
RegionInfo region) throws IO
});
}
+
+ /**
+ * List all dirty metadata currently in META.
+ * @param conn a valid, open connection.
+ * @return a Map of all dirty metadata in META.
+ * @throws IOException on any issues related with scanning meta table
+ */
+ public static Map<TableName, List<byte[]>> getDirtyMetadata(Connection conn)
throws IOException {
+ Map<TableName, List<byte[]>> dirtyTableRegions = new HashMap<>();
+ Map<String, TableName> tableNameMap = new HashMap<>();
+ getTables(conn).forEach(tableName ->
tableNameMap.put(tableName.getNameAsString(), tableName));
+ Table metaTable = conn.getTable(TableName.META_TABLE_NAME);
+ Scan scan = new Scan();
+ ResultScanner resultScanner = metaTable.getScanner(scan);
+ for (Result result : resultScanner) {
+ result.listCells().forEach(cell -> {
Review comment:
Do we really need to iterate through each cell? It seems you only care
about the row key, so no need to go through every single cell of each row.
##########
File path: hbase-hbck2/src/main/java/org/apache/hbase/HBCK2.java
##########
@@ -558,6 +590,14 @@ private static void usageReplication(PrintWriter writer) {
writer.println(" purge if '--fix'.");
}
+ private static void usageReportDirtyRegionsInMeta(PrintWriter writer){
+ writer.println(" " + REPORT_DIRTY_METADATA + " [OPTIONS]");
+ writer.println(" Options:");
+ writer.println(" -f, --fix fix meta by delete all dirty metadata
found.");
+ writer.println(" Looks for undeleted metadata in meta table. ");
+ writer.println(" Undeleted metadata means a table has been deleted, but
not delete all metadata in meta.");
Review comment:
Can we describe here in more details an example scenario where this
command would be useful? See, for example, the explanation for
`reportMissingRegionsInMeta`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]