[ https://issues.apache.org/jira/browse/HIVE-24933?focusedWorklogId=798172&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-798172 ]
ASF GitHub Bot logged work on HIVE-24933: ----------------------------------------- Author: ASF GitHub Bot Created on: 04/Aug/22 20:51 Start Date: 04/Aug/22 20:51 Worklog Time Spent: 10m Work Description: cmunkey commented on code in PR #3435: URL: https://github.com/apache/hive/pull/3435#discussion_r938223551 ########## ql/src/java/org/apache/hadoop/hive/ql/exec/ReplCopyTask.java: ########## @@ -166,6 +169,12 @@ public int execute() { } } + private void setupWork() throws HiveException { Review Comment: All of these setupWork() implementations are basically the same, can they be moved to base class Task? ########## ql/src/java/org/apache/hadoop/hive/ql/plan/DeferredWorkHelper.java: ########## @@ -0,0 +1,27 @@ +/* + * 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.plan; + +import org.apache.hadoop.hive.ql.metadata.HiveException; + +public interface DeferredWorkHelper { + void setupWork(CopyWork copyWork) throws HiveException; + void setupWork(ReplCopyWork replCopyWork) throws HiveException; + void setupWork(MoveWork moveWork) throws HiveException; Review Comment: If you have interface or abstract that is common to CopyWork, ReplCopyWork, and Move work. And a setupWork() in each of those works. This can use be just be one setupWork(DeferredWorkHelper helper). Interface BaseWork, CopyWork, ReplCopyWork and Move work all implement. BaseWork.setupWork(DeferredWorkHelper helper) is the method that they all have to implement. For instance CopyWork.setupWork(DeferredWorkHelper helper) { ImportSemanticAnalyzer.evaluate(helper.getReplace(), helper.getTgtPath(), helper.getWriteId(), helper.getStmtId(), helper.getHive(), helper.getCtx(), helper.getTblDesc(), helper.getInReplScope(), helper); this.setToPath(new Path[] { destPath }); } } ########## itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcidTables.java: ########## @@ -3408,4 +3411,83 @@ public void testTableWithPartitionsInBatch() throws Throwable { .verifyResults(new String[] { "bangalore", "paris", "sydney" }) .verifyReplTargetProperty(replicatedDbName); } + + + @Test + public void testTxnTblReplWithSameNameAsDroppedNonTxnTbl() throws Throwable { + List<String> withClauseOptions = new LinkedList<>(); + withClauseOptions.add("'" + HiveConf.ConfVars.HIVE_DISTCP_DOAS_USER.varname + + "'='" + UserGroupInformation.getCurrentUser().getUserName() + "'"); + + String tbl = "t1"; + primary + .run("use " + primaryDbName) + .run("create table " + tbl + " (id int)") + .run("insert into table " + tbl + " values (1)") + .dump(primaryDbName, withClauseOptions); + + replica + .load(replicatedDbName, primaryDbName) + .run("use " + replicatedDbName) + .run("select id from " + tbl) + .verifyResults(new String[] {"1"}); + + assertFalse(AcidUtils.isTransactionalTable(replica.getTable(replicatedDbName, tbl))); + + primary + .run("use " + primaryDbName) + .run("drop table " + tbl) + .run("create table " + tbl + " (id int) clustered by(id) into 3 buckets stored as orc " + + "tblproperties (\"transactional\"=\"true\")") + .run("insert into table " + tbl + " values (2)") + .dump(primaryDbName, withClauseOptions); + + replica + .load(replicatedDbName, primaryDbName) + .run("use " + replicatedDbName) + .run("select id from " + tbl) + .verifyResults(new String[] {"2"}); + + assertTrue(AcidUtils.isTransactionalTable(replica.getTable(replicatedDbName, tbl))); + } + + @Test + public void testTxnTblReplWithSameNameAsDroppedExtTbl() throws Throwable { Review Comment: What type is the table dropped in testTxnTblReplWithSameNameAsDroppedNonTxnTbl? Here it is external, is there a managed one? Issue Time Tracking ------------------- Worklog Id: (was: 798172) Time Spent: 2h 50m (was: 2h 40m) > Replication fails for transactional tables having same name as dropped > non-transactional table > ---------------------------------------------------------------------------------------------- > > Key: HIVE-24933 > URL: https://issues.apache.org/jira/browse/HIVE-24933 > Project: Hive > Issue Type: Bug > Reporter: Pratyush Madhukar > Assignee: Pratyush Madhukar > Priority: Major > Labels: pull-request-available > Time Spent: 2h 50m > Remaining Estimate: 0h > -- This message was sent by Atlassian Jira (v8.20.10#820010)