hive git commit: HIVE-19130: NPE is thrown when REPL LOAD applied drop partition event (Sankar Hariappan, reviewed by Mahesh Kumar Behera, Thejas M Nair)

2018-04-13 Thread sankarh
Repository: hive
Updated Branches:
  refs/heads/branch-3 50f144d1f -> 150e35167


HIVE-19130: NPE is thrown when REPL LOAD applied drop partition event (Sankar 
Hariappan, reviewed by Mahesh Kumar Behera, Thejas M Nair)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/150e3516
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/150e3516
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/150e3516

Branch: refs/heads/branch-3
Commit: 150e35167ab49135fd808a987bfa7fb582a531ba
Parents: 50f144d
Author: Sankar Hariappan 
Authored: Fri Apr 13 11:28:49 2018 +0530
Committer: Sankar Hariappan 
Committed: Fri Apr 13 11:28:49 2018 +0530

--
 ...TestReplicationScenariosAcrossInstances.java | 55 
 .../hadoop/hive/ql/parse/WarehouseInstance.java |  5 ++
 .../org/apache/hadoop/hive/ql/exec/DDLTask.java |  8 ++-
 .../apache/hadoop/hive/ql/parse/EximUtil.java   | 10 
 .../hive/ql/parse/ImportSemanticAnalyzer.java   | 31 +--
 .../parse/repl/load/message/TableHandler.java   |  1 +
 6 files changed, 106 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hive/blob/150e3516/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java
--
diff --git 
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java
 
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java
index 689ca76..70e1aa7 100644
--- 
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java
+++ 
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java
@@ -620,4 +620,59 @@ public class TestReplicationScenariosAcrossInstances {
 .run("show functions like '" + replicatedDbName + "*'")
 .verifyResult(null);
   }
+
+  @Test
+  public void testIncrementalReplWithEventsBatchHavingDropCreateTable() throws 
Throwable {
+// Bootstrap dump with empty db
+WarehouseInstance.Tuple bootstrapTuple = primary.dump(primaryDbName, null);
+
+// Bootstrap load in replica
+replica.load(replicatedDbName, bootstrapTuple.dumpLocation)
+.status(replicatedDbName)
+.verifyResult(bootstrapTuple.lastReplicationId);
+
+// First incremental dump
+WarehouseInstance.Tuple firstIncremental = primary.run("use " + 
primaryDbName)
+.run("create table table1 (i int)")
+.run("create table table2 (id int) partitioned by (country 
string)")
+.run("insert into table1 values (1)")
+.run("insert into table2 partition(country='india') values(1)")
+.dump(primaryDbName, bootstrapTuple.lastReplicationId);
+
+// Second incremental dump
+WarehouseInstance.Tuple secondIncremental = primary.run("use " + 
primaryDbName)
+.run("drop table table1")
+.run("drop table table2")
+.run("create table table2 (id int) partitioned by (country 
string)")
+.run("alter table table2 add partition(country='india')")
+.run("alter table table2 drop partition(country='india')")
+.run("insert into table2 partition(country='us') values(2)")
+.run("create table table1 (i int)")
+.run("insert into table1 values (2)")
+.dump(primaryDbName, firstIncremental.lastReplicationId);
+
+// First incremental load
+replica.load(replicatedDbName, firstIncremental.dumpLocation)
+.status(replicatedDbName)
+.verifyResult(firstIncremental.lastReplicationId)
+.run("use " + replicatedDbName)
+.run("show tables")
+.verifyResults(new String[] {"table1", "table2"})
+.run("select * from table1")
+.verifyResults(new String[] {"1"})
+.run("select id from table2 order by id")
+.verifyResults(new String[] {"1"});
+
+// Second incremental load
+replica.load(replicatedDbName, secondIncremental.dumpLocation)
+.status(replicatedDbName)
+.verifyResult(secondIncremental.lastReplicationId)
+.run("use " + replicatedDbName)
+.run("show tables")
+.verifyResults(new String[] {"table1", "table2"})
+.run("select * from table1")
+.verifyResults(new String[] {"2"})
+.run("select id from table2 order by id")
+.verifyResults(new String[] {"2"});
+  }
 }


hive git commit: HIVE-19130: NPE is thrown when REPL LOAD applied drop partition event (Sankar Hariappan, reviewed by Mahesh Kumar Behera, Thejas M Nair)

2018-04-11 Thread sankarh
Repository: hive
Updated Branches:
  refs/heads/master 244ca8e5c -> d9fae0493


HIVE-19130: NPE is thrown when REPL LOAD applied drop partition event (Sankar 
Hariappan, reviewed by Mahesh Kumar Behera, Thejas M Nair)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/d9fae049
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/d9fae049
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/d9fae049

Branch: refs/heads/master
Commit: d9fae049305e20ec8a72e581a2fc938028523402
Parents: 244ca8e
Author: Sankar Hariappan 
Authored: Thu Apr 12 10:29:47 2018 +0530
Committer: Sankar Hariappan 
Committed: Thu Apr 12 10:29:47 2018 +0530

--
 ...TestReplicationScenariosAcrossInstances.java | 55 
 .../hadoop/hive/ql/parse/WarehouseInstance.java |  5 ++
 .../org/apache/hadoop/hive/ql/exec/DDLTask.java |  8 ++-
 .../apache/hadoop/hive/ql/parse/EximUtil.java   | 10 
 .../hive/ql/parse/ImportSemanticAnalyzer.java   | 31 +--
 .../parse/repl/load/message/TableHandler.java   |  1 +
 6 files changed, 106 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hive/blob/d9fae049/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java
--
diff --git 
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java
 
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java
index 689ca76..70e1aa7 100644
--- 
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java
+++ 
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosAcrossInstances.java
@@ -620,4 +620,59 @@ public class TestReplicationScenariosAcrossInstances {
 .run("show functions like '" + replicatedDbName + "*'")
 .verifyResult(null);
   }
+
+  @Test
+  public void testIncrementalReplWithEventsBatchHavingDropCreateTable() throws 
Throwable {
+// Bootstrap dump with empty db
+WarehouseInstance.Tuple bootstrapTuple = primary.dump(primaryDbName, null);
+
+// Bootstrap load in replica
+replica.load(replicatedDbName, bootstrapTuple.dumpLocation)
+.status(replicatedDbName)
+.verifyResult(bootstrapTuple.lastReplicationId);
+
+// First incremental dump
+WarehouseInstance.Tuple firstIncremental = primary.run("use " + 
primaryDbName)
+.run("create table table1 (i int)")
+.run("create table table2 (id int) partitioned by (country 
string)")
+.run("insert into table1 values (1)")
+.run("insert into table2 partition(country='india') values(1)")
+.dump(primaryDbName, bootstrapTuple.lastReplicationId);
+
+// Second incremental dump
+WarehouseInstance.Tuple secondIncremental = primary.run("use " + 
primaryDbName)
+.run("drop table table1")
+.run("drop table table2")
+.run("create table table2 (id int) partitioned by (country 
string)")
+.run("alter table table2 add partition(country='india')")
+.run("alter table table2 drop partition(country='india')")
+.run("insert into table2 partition(country='us') values(2)")
+.run("create table table1 (i int)")
+.run("insert into table1 values (2)")
+.dump(primaryDbName, firstIncremental.lastReplicationId);
+
+// First incremental load
+replica.load(replicatedDbName, firstIncremental.dumpLocation)
+.status(replicatedDbName)
+.verifyResult(firstIncremental.lastReplicationId)
+.run("use " + replicatedDbName)
+.run("show tables")
+.verifyResults(new String[] {"table1", "table2"})
+.run("select * from table1")
+.verifyResults(new String[] {"1"})
+.run("select id from table2 order by id")
+.verifyResults(new String[] {"1"});
+
+// Second incremental load
+replica.load(replicatedDbName, secondIncremental.dumpLocation)
+.status(replicatedDbName)
+.verifyResult(secondIncremental.lastReplicationId)
+.run("use " + replicatedDbName)
+.run("show tables")
+.verifyResults(new String[] {"table1", "table2"})
+.run("select * from table1")
+.verifyResults(new String[] {"2"})
+.run("select id from table2 order by id")
+.verifyResults(new String[] {"2"});
+  }
 }

http://git-wip-us.apache.org/repos/asf/hive/blob/d9fae049/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/WarehouseInstance.java