-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dynamically add new tables to CDC mirrors (#1084)
1. Call an activity to add the new tables to the publication. 2. Kick off a child `CDCFlow` with only the new tables as input along with the `InitialCopyOnly` flag set. This runs enough of the `SetupFlow` and `SnapshotFlow` to be fine, but also skips over some checks regarding primary keys and replica identities. The current idea is to have them in the UI instead, just like in the create mirror interface. 3. Patch the config of the parent workflow with the new tables and then resume. Currently there is no way to interface with this feature, will add a way to signal this in a different PR. UI interface will be added subsequently. --------- Co-authored-by: Kaushik Iska <[email protected]>
- Loading branch information
1 parent
f504b1e
commit bc2dcdc
Showing
18 changed files
with
324 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package shared | ||
|
||
import ( | ||
"github.com/PeerDB-io/peer-flow/connectors/utils" | ||
"github.com/PeerDB-io/peer-flow/generated/protos" | ||
) | ||
|
||
func AdditionalTablesHasOverlap(currentTableMappings []*protos.TableMapping, | ||
additionalTableMappings []*protos.TableMapping, | ||
) bool { | ||
currentSrcTables := make([]string, 0, len(currentTableMappings)) | ||
currentDstTables := make([]string, 0, len(currentTableMappings)) | ||
additionalSrcTables := make([]string, 0, len(additionalTableMappings)) | ||
additionalDstTables := make([]string, 0, len(additionalTableMappings)) | ||
|
||
for _, currentTableMapping := range currentTableMappings { | ||
currentSrcTables = append(currentSrcTables, currentTableMapping.SourceTableIdentifier) | ||
currentDstTables = append(currentDstTables, currentTableMapping.DestinationTableIdentifier) | ||
} | ||
for _, additionalTableMapping := range additionalTableMappings { | ||
currentSrcTables = append(currentSrcTables, additionalTableMapping.SourceTableIdentifier) | ||
currentDstTables = append(currentDstTables, additionalTableMapping.DestinationTableIdentifier) | ||
} | ||
|
||
return utils.ArraysHaveOverlap(currentSrcTables, additionalSrcTables) || | ||
utils.ArraysHaveOverlap(currentDstTables, additionalDstTables) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.