simhadri-g commented on code in PR #4629: URL: https://github.com/apache/hive/pull/4629#discussion_r1308683542
########## ql/src/java/org/apache/hadoop/hive/ql/reexec/ReExecuteOptimisticConcurrentWritePlugin.java: ########## @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package org.apache.hadoop.hive.ql.reexec; + +import org.apache.hadoop.hive.ql.Driver; +import org.apache.hadoop.hive.ql.hooks.ExecuteWithHookContext; +import org.apache.hadoop.hive.ql.hooks.HookContext; +import org.apache.hadoop.hive.ql.plan.mapper.PlanMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.regex.Pattern; + +public class ReExecuteOptimisticConcurrentWritePlugin implements IReExecutionPlugin { Review Comment: I have renamed the class to "ReExecuteOnWriteConflictPlugin" > should we introduce a separate retry count config just for this strategy? Default value of HIVE_QUERY_MAX_RECOMPILATION_COUNT is 1. So i think we can reuse this conf instead of introducing a new one? https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/reexec/ReExecDriver.java#L110 ########## ql/src/java/org/apache/hadoop/hive/ql/reexec/ReExecuteOptimisticConcurrentWritePlugin.java: ########## @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package org.apache.hadoop.hive.ql.reexec; + +import org.apache.hadoop.hive.ql.Driver; +import org.apache.hadoop.hive.ql.hooks.ExecuteWithHookContext; +import org.apache.hadoop.hive.ql.hooks.HookContext; +import org.apache.hadoop.hive.ql.plan.mapper.PlanMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.regex.Pattern; + +public class ReExecuteOptimisticConcurrentWritePlugin implements IReExecutionPlugin { + private static final Logger LOG = LoggerFactory.getLogger(ReExecuteOptimisticConcurrentWritePlugin.class); + private boolean retryPossible; + + private final Pattern optimisticConcurrentWriteErrorPattern = + Pattern.compile(".*Found.*conflicting.* files .* records matching true.*"); + + class LocalHook implements ExecuteWithHookContext { + @Override + public void run(HookContext hookContext) throws Exception { + if (hookContext.getHookType() == HookContext.HookType.ON_FAILURE_HOOK) { + Throwable exception = hookContext.getException(); + + if (exception != null && exception.getMessage() != null && exception.getCause() != null) { + + String commitFailed = "Error committing job"; Review Comment: done -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
