diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/XClusterConfigTaskBase.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/XClusterConfigTaskBase.java index d8e1775ca84f..fed3071da935 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/XClusterConfigTaskBase.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/XClusterConfigTaskBase.java @@ -2235,8 +2235,25 @@ private static void addTransientTableConfigs( } }); - // Note: Tables dropped from target are already updated with status - // "UnableToFetch" as part of setReplicationStatus function. + Map sourceTableIdToTargetTableIdMap = + getSourceTableIdTargetTableIdMap(sourceTableInfoList, targetTableInfoList); + + // Update the status for tables that were previously being replicated but have been dropped from + // the target. + xClusterConfig.getTableDetails().stream() + .filter( + tableConfig -> + Arrays.asList( + XClusterTableConfig.Status.Running, + XClusterTableConfig.Status.UnableToFetch) + .contains(tableConfig.getStatus())) + .forEach( + tableConfig -> { + String targetTableId = sourceTableIdToTargetTableIdMap.get(tableConfig.getTableId()); + if (targetTableId == null) { + tableConfig.setStatus(XClusterTableConfig.Status.DroppedFromTarget); + } + }); Pair, List> tableConfigs = getXClusterTableConfigNotInReplication(