Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HIVE-19970 : Replication dump has a NPE when table is empty #379

Closed
wants to merge 1 commit into from

Conversation

maheshk114
Copy link
Contributor

No description provided.

} catch (RuntimeException e) {
LOG.error("failed", e);
setException(e);
return ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have error code set for all instances of RuntimeException?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are just using the message ..the message will be set by the method throwing the excpetion and for the messages which are not set ..get error code returns generic error

for (Future<?> future : futures) {
try {
future.get();
} catch (Exception e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to catch only RuntimeException as otherwise it may suppress others.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was suppressed earlier ..now we are getting the exceptions and throwing it explicitly

@@ -4986,6 +4986,10 @@ private void alter_table_core(final String catName, final String dbname, final S
try {
Table oldt = get_table_core(catName, dbname, name);
firePreEvent(new PreAlterTableEvent(oldt, newTable, this));
if (newTable.getDbName() == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what use case the new DB name can be null?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its just for making the exception same ..as per review comment from vary

@@ -907,7 +907,7 @@ public void testAlterTableCascade() throws Exception {
}
}

@Test(expected = MetaException.class)
@Test(expected = InvalidOperationException.class)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this behaviour change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its just to revert back the changes ..not sure if its required or not so will remove this change

future.get();
} catch (Exception e) {
LOG.error("failed", e.getCause());
throw new HiveException(e.getCause().getMessage(), e.getCause());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this special handling for PartitionExport with futures semantics? FileOperations.export itself take care of NPE when partition directory missing right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FileOperations.export done it a separate thread so it has to be done manually here

@@ -3185,6 +3186,27 @@ public void testLoadCmPathMissing() throws IOException {
fs.create(path, false);
}

@Test
public void testDumpFileMissing() throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test name is misleading. It can be "testDumpWithTableDirMissing".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

run("DROP TABLE " + dbName + ".normal", driver);
run("drop database " + dbName, true, driver);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test case for one of the partition directory is missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -1097,6 +1100,8 @@ public Boolean apply(@Nullable CallerArguments args) {

// Retry with different dump should fail.
replica.loadFailure(replicatedDbName, tuple2.dumpLocation);
CommandProcessorResponse ret = replica.runCommand("REPL LOAD " + replicatedDbName + " FROM '" + tuple2.dumpLocation + "'");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall remove the duplicate verification step of REPL LOAD command with replica.loadFailure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -156,6 +159,10 @@ private void exportFilesAsList() throws SemanticException, IOException, LoginExc
}
done = true;
} catch (IOException e) {
if (e instanceof FileNotFoundException) {
logger.error("exporting data files in dir : " + dataPathList + " to " + exportRootDataDir + " failed");
throw new FileNotFoundException(FILE_NOT_FOUND.format(e.getMessage()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For same use-case with Acid tables where table dir is missing throws IOException from Utils.getDataPathList instead of FileNotFoundException. Also, add a test case to validate this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hadoop team has confirmed that they throw file not found for all cases where file/dir is missing.

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Feel free to reach out on the dev@hive.apache.org list if the patch is in need of reviews.

@github-actions github-actions bot added the stale label Jun 12, 2020
@github-actions github-actions bot closed this Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants