-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`PAUSE MIRROR` supports both CDC and QRep mirrors. This is implemented by signalling the Temporal workflow. A PauseSignal delivered to the workflow should pause it, while a NoopSignal delivered to the workflow should resume it. Signals that don't make sense for the current workflow state are ignored. Currently supported only via the query layer, not from the UI. The following caveats exist for now: 1) QRep mirrors cannot be paused during partition reading or replicating, only after a run completes successfully and the signals are read. This is usually not an issue but could be problematic for QRep runs with a lot of partitions are running. 2) CDC mirrors similarly will only process signals and pause after a pull + sync + normalize cycle is run. Due to 1), a CDC mirror cannot pause during the initial snapshot phase, which is implemented as a QRep mirror internally. This will be marked as unpausable in the UI.
- Loading branch information
1 parent
8f8fdbd
commit 319cde6
Showing
22 changed files
with
1,438 additions
and
196 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 util | ||
|
||
import ( | ||
"github.com/PeerDB-io/peer-flow/shared" | ||
"go.temporal.io/sdk/log" | ||
) | ||
|
||
func FlowSignalHandler(activeSignal shared.CDCFlowSignal, | ||
v shared.CDCFlowSignal, logger log.Logger) shared.CDCFlowSignal { | ||
if v == shared.ShutdownSignal { | ||
logger.Info("received shutdown signal") | ||
return v | ||
} else if v == shared.PauseSignal { | ||
logger.Info("received pause signal") | ||
if activeSignal == shared.NoopSignal { | ||
logger.Info("workflow was running, pausing it") | ||
return v | ||
} | ||
} else if v == shared.NoopSignal { | ||
logger.Info("received resume signal") | ||
if activeSignal == shared.PauseSignal { | ||
logger.Info("workflow was paused, resuming it") | ||
return v | ||
} | ||
} | ||
return activeSignal | ||
} |
Oops, something went wrong.