Skip to content

Commit

Permalink
[PLAT-15148]: Set XCluster Table Status to DroppedFromTarget if table…
Browse files Browse the repository at this point in the history
… in replication is dropped from target only

Summary: Set XCluster Table Status to DroppedFromTarget if table in replication is dropped from target only.

Test Plan: Tested manually

Reviewers: hzare, jmak, cwang, sanketh

Reviewed By: hzare

Subscribers: yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D37708
  • Loading branch information
vipul-yb committed Sep 5, 2024
1 parent 40689bc commit 1655e69
Showing 1 changed file with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String> 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<XClusterTableConfig>, List<XClusterTableConfig>> tableConfigs =
getXClusterTableConfigNotInReplication(
Expand Down

0 comments on commit 1655e69

Please sign in to comment.