joshelser commented on a change in pull request #2237:
URL: https://github.com/apache/hbase/pull/2237#discussion_r559183840
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/InitMetaProcedure.java
##########
@@ -166,4 +170,35 @@ protected void completionCleanup(MasterProcedureEnv env) {
public void await() throws InterruptedException {
latch.await();
}
+
+ private static boolean deleteMetaTableDirectoryIfPartial(FileSystem
rootDirectoryFs,
+ Path metaTableDir) throws IOException {
+ boolean isPartial = true;
+ try {
+ TableDescriptor metaDescriptor =
+ FSTableDescriptors.getTableDescriptorFromFs(rootDirectoryFs,
metaTableDir);
+ // when entering the state of INIT_META_WRITE_FS_LAYOUT, if a meta table
directory is found,
+ // the meta table should not have any useful data and considers as
partial.
+ // if we find any valid HFiles, operator should fix the meta e.g. via
HBCK.
+ if (metaDescriptor != null && metaDescriptor.getColumnFamilyCount() > 0)
{
+ RemoteIterator<LocatedFileStatus> iterator =
rootDirectoryFs.listFiles(metaTableDir, true);
+ while (iterator.hasNext()) {
+ LocatedFileStatus status = iterator.next();
+ if (StoreFileInfo.isHFile(status.getPath()) && HFile
+ .isHFileFormat(rootDirectoryFs, status.getPath())) {
+ isPartial = false;
+ break;
+ }
+ }
+ }
+ } finally {
+ if (!isPartial) {
+ throw new IOException("Meta table is not partial, please sideline this
meta directory "
+ + "or run HBCK to fix this meta table, e.g. rebuild the server
hostname in ZNode for the "
Review comment:
Instead of specific commands to run, what about referencing something in
the book (which could be updated if "what to do" changes across release
versions)?
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/InitMetaProcedure.java
##########
@@ -167,4 +171,35 @@ protected void completionCleanup(MasterProcedureEnv env) {
public void await() throws InterruptedException {
latch.await();
}
+
+ private static boolean deleteMetaTableDirectoryIfPartial(FileSystem
rootDirectoryFs,
+ Path metaTableDir) throws IOException {
+ boolean isPartial = true;
+ try {
+ TableDescriptor metaDescriptor =
+ FSTableDescriptors.getTableDescriptorFromFs(rootDirectoryFs,
metaTableDir);
+ // when entering the state of INIT_META_WRITE_FS_LAYOUT, if a meta table
directory is found,
+ // the meta table should not have any useful data and considers as
partial.
+ // if we find any valid HFiles, operator should fix the meta e.g. via
HBCK.
+ if (metaDescriptor != null && metaDescriptor.getColumnFamilyCount() > 0)
{
+ RemoteIterator<LocatedFileStatus> iterator =
rootDirectoryFs.listFiles(metaTableDir, true);
+ while (iterator.hasNext()) {
+ LocatedFileStatus status = iterator.next();
+ if (StoreFileInfo.isHFile(status.getPath()) && HFile
+ .isHFileFormat(rootDirectoryFs, status.getPath())) {
+ isPartial = false;
+ break;
+ }
+ }
+ }
+ } finally {
+ if (!isPartial) {
+ throw new IOException("Meta table is not partial, please sideline this
meta directory "
+ + "or run HBCK to fix this meta table, e.g. rebuild the server
hostname in ZNode for the "
+ + "meta region");
+ }
Review comment:
I would worry that the ProcedureExecutor is going to resubmit the IMP
again. You might have to, instead, let IMP finish without an error and
determine via some side-effect (e.g. set a variable in HMaster?) if we bailed
out of IMP and then fail at that level. Truthfully, I don't remember what
happens by default (if all procedures which throw an exception are implicitly
retried.
----------------------------------------------------------------
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]