sankarh commented on a change in pull request #673: HIVE-21763: Incremental
replication to allow changing include/exclude tables list in replication policy.
URL: https://github.com/apache/hive/pull/673#discussion_r294704914
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ReplLoadTask.java
##########
@@ -364,6 +367,35 @@ private void cleanTablesFromBootstrap() throws
HiveException, IOException, Inval
}
}
+ /**
+ * If replication policy is changed between previous and current load, then
the excluded tables in
+ * the new replication policy will be dropped.
+ * @throws HiveException Failed to get/drop the tables.
+ */
+ private void dropTablesExcludedInReplScope(ReplScope replScope) throws
HiveException {
+ // If all tables are included in replication scope, then nothing to be
dropped.
+ if ((replScope == null) || replScope.includeAllTables()) {
+ return;
+ }
+
+ Hive db = getHive();
+ String dbName = replScope.getDbName();
+
+ // List all the tables that are excluded in the current repl scope.
+ Iterable<String> tableNames = Collections2.filter(db.getAllTables(dbName),
+ tableName -> {
+ assert(tableName != null);
+ return !tableName.toLowerCase().startsWith(
Review comment:
I got your point... But this is Iterable. We list from getAllTables and then
the below loop iterate and just drop when found a match. So, it is ideally the
same as what you expect. Also, not sure if we can handle exceptions in filter
method. Anyways, this is same as we don't have any double loops.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]