diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/AddPartitionHandler.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/AddPartitionHandler.java index 72368af83b..94875809f7 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/AddPartitionHandler.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/AddPartitionHandler.java @@ -58,6 +58,11 @@ public void handle(Context withinContext) throws Exception { } final Table qlMdTable = new Table(tobj); + + if (!EximUtil.shouldExportTable(withinContext.replicationSpec, qlMdTable)) { + return; + } + Iterable qlPtns = Iterables.transform( ptns, new Function() { diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/AlterPartitionHandler.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/AlterPartitionHandler.java index a9db135dc2..1d0ad72542 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/AlterPartitionHandler.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/AlterPartitionHandler.java @@ -90,6 +90,11 @@ public void handle(Context withinContext) throws Exception { if (Scenario.ALTER == scenario) { withinContext.replicationSpec.setIsMetadataOnly(true); Table qlMdTable = new Table(tableObject); + + if (!EximUtil.shouldExportTable(withinContext.replicationSpec, qlMdTable)) { + return; + } + List partitions = new ArrayList<>(); partitions.add(new Partition(qlMdTable, after)); Path metaDataPath = new Path(withinContext.eventRoot, EximUtil.METADATA_NAME); diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/AlterTableHandler.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/AlterTableHandler.java index ab9a9de373..49c6f7a98e 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/AlterTableHandler.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/AlterTableHandler.java @@ -76,19 +76,22 @@ private Scenario scenarioType(org.apache.hadoop.hive.metastore.api.Table before, @Override public void handle(Context withinContext) throws Exception { - { - LOG.info("Processing#{} ALTER_TABLE message : {}", fromEventId(), event.getMessage()); - if (Scenario.ALTER == scenario) { - withinContext.replicationSpec.setIsMetadataOnly(true); - Table qlMdTableAfter = new Table(after); - Path metaDataPath = new Path(withinContext.eventRoot, EximUtil.METADATA_NAME); - EximUtil.createExportDump( - metaDataPath.getFileSystem(withinContext.hiveConf), - metaDataPath, - qlMdTableAfter, - null, - withinContext.replicationSpec); + LOG.info("Processing#{} ALTER_TABLE message : {}", fromEventId(), event.getMessage()); + if (Scenario.ALTER == scenario) { + withinContext.replicationSpec.setIsMetadataOnly(true); + Table qlMdTableAfter = new Table(after); + + if (!EximUtil.shouldExportTable(withinContext.replicationSpec, qlMdTableAfter)) { + return; } + + Path metaDataPath = new Path(withinContext.eventRoot, EximUtil.METADATA_NAME); + EximUtil.createExportDump( + metaDataPath.getFileSystem(withinContext.hiveConf), + metaDataPath, + qlMdTableAfter, + null, + withinContext.replicationSpec); DumpMetaData dmd = withinContext.createDmd(this); dmd.setPayload(event.getMessage()); dmd.write(); diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/InsertHandler.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/InsertHandler.java index 956bb08050..df852a3dce 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/InsertHandler.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/events/InsertHandler.java @@ -43,6 +43,11 @@ public void handle(Context withinContext) throws Exception { InsertMessage insertMsg = deserializer.getInsertMessage(event.getMessage()); org.apache.hadoop.hive.ql.metadata.Table qlMdTable = tableObject(insertMsg); + + if (!EximUtil.shouldExportTable(withinContext.replicationSpec, qlMdTable)) { + return; + } + List qlPtns = null; if (qlMdTable.isPartitioned() && (null != insertMsg.getPtnObj())) { qlPtns = Collections.singletonList(partitionObject(qlMdTable, insertMsg));