[
https://issues.apache.org/jira/browse/HIVE-23993?focusedWorklogId=468891&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-468891
]
ASF GitHub Bot logged work on HIVE-23993:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 10/Aug/20 21:23
Start Date: 10/Aug/20 21:23
Worklog Time Spent: 10m
Work Description: pkumarsinha commented on a change in pull request #1367:
URL: https://github.com/apache/hive/pull/1367#discussion_r468190174
##########
File path:
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java
##########
@@ -1639,12 +1655,68 @@ public void
testFailureUnsupportedAuthorizerReplication() throws Throwable {
.run("insert into table1 values (2)");
try {
primary.dump(primaryDbName, clause);
+ Assert.fail();
} catch (SemanticException e) {
assertEquals("Invalid config error : Authorizer sentry not supported for
replication " +
"for ranger service.", e.getMessage());
assertEquals(ErrorMsg.REPL_INVALID_CONFIG_FOR_SERVICE.getErrorCode(),
ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode());
}
+ //This is now non recoverable error
+ try {
+ primary.dump(primaryDbName, clause);
+ Assert.fail();
+ } catch (Exception e) {
+
assertEquals(ErrorMsg.REPL_FAILED_WITH_NON_RECOVERABLE_ERROR.getErrorCode(),
+ ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode());
+ }
+ //Delete non recoverable marker to fix this
Review comment:
Can you please also add a check to ensure that there is no marker file
at this point of time
##########
File path:
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java
##########
@@ -45,10 +46,7 @@
import org.junit.Test;
import javax.annotation.Nullable;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
+import java.io.*;
Review comment:
nit: Revert this import.
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/AtlasDumpTask.java
##########
@@ -107,12 +107,21 @@ public int execute() {
} catch (Exception e) {
LOG.error("Exception while dumping atlas metadata", e);
setException(e);
+ int errorCode = ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode();
try {
- work.getMetricCollector().reportStageEnd(getName(), Status.FAILED);
+ if (errorCode > 40000) {
Review comment:
It should be >= ?
##########
File path:
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java
##########
@@ -1639,12 +1655,68 @@ public void
testFailureUnsupportedAuthorizerReplication() throws Throwable {
.run("insert into table1 values (2)");
try {
primary.dump(primaryDbName, clause);
+ Assert.fail();
} catch (SemanticException e) {
assertEquals("Invalid config error : Authorizer sentry not supported for
replication " +
"for ranger service.", e.getMessage());
assertEquals(ErrorMsg.REPL_INVALID_CONFIG_FOR_SERVICE.getErrorCode(),
ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode());
}
+ //This is now non recoverable error
+ try {
+ primary.dump(primaryDbName, clause);
+ Assert.fail();
+ } catch (Exception e) {
+
assertEquals(ErrorMsg.REPL_FAILED_WITH_NON_RECOVERABLE_ERROR.getErrorCode(),
+ ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode());
+ }
+ //Delete non recoverable marker to fix this
+ Path baseDumpDir = new
Path(primary.hiveConf.getVar(HiveConf.ConfVars.REPLDIR));
+ Path nonRecoverablePath = getNonRecoverablePath(baseDumpDir,
primaryDbName);
+ Assert.assertNotNull(nonRecoverablePath);
+ baseDumpDir.getFileSystem(primary.hiveConf).delete(nonRecoverablePath,
true);
+ //This should pass as non recoverable marker removed and valid configs
present.
+ WarehouseInstance.Tuple dump = primary.dump(primaryDbName);
+
+ try {
+ replica.load(replicatedDbName, primaryDbName, clause);
+ } catch (Exception e) {
+
Assert.assertEquals(ErrorMsg.REPL_INVALID_CONFIG_FOR_SERVICE.getErrorCode(),
+ ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode());
+ }
+ //This is now non recoverable error
+ try {
+ replica.load(replicatedDbName, primaryDbName, clause);
+ Assert.fail();
+ } catch (Exception e) {
+
assertEquals(ErrorMsg.REPL_FAILED_WITH_NON_RECOVERABLE_ERROR.getErrorCode(),
+ ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode());
+ }
+ //Delete non recoverable marker to fix this
Review comment:
Please add a check here that even the dump fails at this point of time.
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/util/ReplUtils.java
##########
@@ -366,4 +371,26 @@ public static boolean includeAcidTableInDump(HiveConf
conf) {
public static boolean tableIncludedInReplScope(ReplScope replScope, String
tableName) {
return ((replScope == null) ||
replScope.tableIncludedInReplScope(tableName));
}
+
+ public static boolean failedWithNonRecoverableError(Path dumpRoot, HiveConf
conf) throws SemanticException {
+ if (dumpRoot == null) {
+ return false;
+ }
+ Retryable retryable = Retryable.builder()
+ .withHiveConf(conf)
+ .withRetryOnException(IOException.class).build();
+ try {
+ return retryable.executeCallable(() -> {
+ FileSystem fs = dumpRoot.getFileSystem(conf);
+ if (fs.exists(dumpRoot)) {
+ if (fs.exists(new Path(dumpRoot,
NON_RECOVERABLE_MARKER.toString()))) {
Review comment:
Single exists check is enough, fs.exists(dumpRoot) is not required.
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/util/ReplUtils.java
##########
@@ -366,4 +371,26 @@ public static boolean includeAcidTableInDump(HiveConf
conf) {
public static boolean tableIncludedInReplScope(ReplScope replScope, String
tableName) {
return ((replScope == null) ||
replScope.tableIncludedInReplScope(tableName));
}
+
+ public static boolean failedWithNonRecoverableError(Path dumpRoot, HiveConf
conf) throws SemanticException {
+ if (dumpRoot == null) {
Review comment:
When would dumpRoot be null here? Shouldn't it throw an exception in
that case?
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/Utils.java
##########
@@ -45,10 +44,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.DataOutputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
Review comment:
nit: Revert this
##########
File path:
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java
##########
@@ -1639,12 +1655,68 @@ public void
testFailureUnsupportedAuthorizerReplication() throws Throwable {
.run("insert into table1 values (2)");
try {
primary.dump(primaryDbName, clause);
+ Assert.fail();
} catch (SemanticException e) {
assertEquals("Invalid config error : Authorizer sentry not supported for
replication " +
"for ranger service.", e.getMessage());
assertEquals(ErrorMsg.REPL_INVALID_CONFIG_FOR_SERVICE.getErrorCode(),
ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode());
}
+ //This is now non recoverable error
+ try {
+ primary.dump(primaryDbName, clause);
+ Assert.fail();
+ } catch (Exception e) {
+
assertEquals(ErrorMsg.REPL_FAILED_WITH_NON_RECOVERABLE_ERROR.getErrorCode(),
+ ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode());
+ }
+ //Delete non recoverable marker to fix this
+ Path baseDumpDir = new
Path(primary.hiveConf.getVar(HiveConf.ConfVars.REPLDIR));
+ Path nonRecoverablePath = getNonRecoverablePath(baseDumpDir,
primaryDbName);
+ Assert.assertNotNull(nonRecoverablePath);
+ baseDumpDir.getFileSystem(primary.hiveConf).delete(nonRecoverablePath,
true);
+ //This should pass as non recoverable marker removed and valid configs
present.
+ WarehouseInstance.Tuple dump = primary.dump(primaryDbName);
+
+ try {
+ replica.load(replicatedDbName, primaryDbName, clause);
+ } catch (Exception e) {
+
Assert.assertEquals(ErrorMsg.REPL_INVALID_CONFIG_FOR_SERVICE.getErrorCode(),
+ ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode());
+ }
+ //This is now non recoverable error
+ try {
+ replica.load(replicatedDbName, primaryDbName, clause);
+ Assert.fail();
+ } catch (Exception e) {
+
assertEquals(ErrorMsg.REPL_FAILED_WITH_NON_RECOVERABLE_ERROR.getErrorCode(),
+ ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode());
+ }
+ //Delete non recoverable marker to fix this
Review comment:
one more check we should do here is for the stack trace in
NON_RECOVERABLE_MARKER file.
##########
File path:
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java
##########
@@ -1639,12 +1655,68 @@ public void
testFailureUnsupportedAuthorizerReplication() throws Throwable {
.run("insert into table1 values (2)");
try {
primary.dump(primaryDbName, clause);
+ Assert.fail();
} catch (SemanticException e) {
assertEquals("Invalid config error : Authorizer sentry not supported for
replication " +
"for ranger service.", e.getMessage());
assertEquals(ErrorMsg.REPL_INVALID_CONFIG_FOR_SERVICE.getErrorCode(),
ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode());
}
+ //This is now non recoverable error
+ try {
+ primary.dump(primaryDbName, clause);
+ Assert.fail();
+ } catch (Exception e) {
+
assertEquals(ErrorMsg.REPL_FAILED_WITH_NON_RECOVERABLE_ERROR.getErrorCode(),
+ ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode());
+ }
+ //Delete non recoverable marker to fix this
Review comment:
Also, if you run a repl load now, it should also fail.
----------------------------------------------------------------
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 468891)
Time Spent: 20m (was: 10m)
> Handle irrecoverable errors
> ---------------------------
>
> Key: HIVE-23993
> URL: https://issues.apache.org/jira/browse/HIVE-23993
> Project: Hive
> Issue Type: Task
> Reporter: Aasha Medhi
> Assignee: Aasha Medhi
> Priority: Major
> Labels: pull-request-available
> Attachments: HIVE-23993.01.patch, HIVE-23993.02.patch, Retry Logic
> for Replication.pdf
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)