VladRodionov commented on a change in pull request #623: HBASE-22749:
Distributed MOB compactions
URL: https://github.com/apache/hbase/pull/623#discussion_r335777734
##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobUtils.java
##########
@@ -907,6 +789,143 @@ public static boolean hasMobColumns(TableDescriptor htd)
{
return false;
}
+ /**
+ * Get list of Mob column families (if any exists)
+ * @param htd table descriptor
+ * @return list of Mob column families
+ */
+ public static List<ColumnFamilyDescriptor>
getMobColumnFamilies(TableDescriptor htd){
+
+ List<ColumnFamilyDescriptor> fams = new
ArrayList<ColumnFamilyDescriptor>();
+ ColumnFamilyDescriptor[] hcds = htd.getColumnFamilies();
+ for (ColumnFamilyDescriptor hcd : hcds) {
+ if (hcd.isMobEnabled()) {
+ fams.add(hcd);
+ }
+ }
+ return fams;
+ }
+
+ /**
+ * Performs housekeeping file cleaning (called by MOB Cleaner chore)
+ * @param conf configuration
+ * @param table table name
+ * @throws IOException
+ */
+ public static void cleanupObsoleteMobFiles(Configuration conf, TableName
table)
+ throws IOException {
+
+ try (final Connection conn = ConnectionFactory.createConnection(conf);
+ final Admin admin = conn.getAdmin();) {
+ TableDescriptor htd = admin.getDescriptor(table);
+ List<ColumnFamilyDescriptor> list = getMobColumnFamilies(htd);
+ if (list.size() == 0) {
+ LOG.info("Skipping non-MOB table [" + table + "]");
+ return;
+ }
+ Path rootDir = FSUtils.getRootDir(conf);
+ Path tableDir = FSUtils.getTableDir(rootDir, table);
+ // How safe is this call?
Review comment:
Your second q. is what what I meant. Is there are chances, directory listing
will contains partial results. In case of split - no. Daughter regions are
created first and parent region is deleted once both daughters went through
major compaction. In case of a merge, parents will be deleted only after merged
region major compacted. So, we will never have partial (in terms of store
files) result of a directory listing call. I assume, this call is safe for our
purposes.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services