Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WalHeartBeat across peers #708

Merged
merged 10 commits into from
Nov 24, 2023
Merged

WalHeartBeat across peers #708

merged 10 commits into from
Nov 24, 2023

Conversation

Amogh-Bharadwaj
Copy link
Contributor

Redesign WAL Heartbeat Logic

  • Spawns a new Workflow when Flow API starts - called HeartbeatFlowWorkflow.
  • This workflow has just one activity which sends wal heartbeat commands every 10 minutes to every Postgres peer in the catalog
  • Before spawning this workflow, pre-existing HeartbearFlowWorkflows are cancelled.

Other: Fixes a typo in UI: snapshow -> snapshot

flow/cmd/api.go Outdated
@@ -58,6 +62,27 @@ func setupGRPCGatewayServer(args *APIServerParams) (*http.Server, error) {
return server, nil
}

func KillExistingHeartbeatFlows(ctx context.Context, tc client.Client, namespace string) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be private method

@@ -659,31 +663,79 @@ func (a *FlowableActivity) DropFlow(ctx context.Context, config *protos.Shutdown
return nil
}

func (a *FlowableActivity) SendWALHeartbeat(ctx context.Context, config *protos.FlowConnectionConfigs) error {
srcConn, err := connectors.GetCDCPullConnector(ctx, config.Source)
func GetPostgresPeerConfigs(ctx context.Context) ([]*protos.PostgresConfig, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be private.

}
defer catalogPool.Close()

optionRows, err := catalogPool.Query(ctx, "SELECT options FROM peers WHERE type=3")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to get 3 from proto like proto.Postgres.Type or something?

Copy link
Contributor

@iskakaushik iskakaushik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left some minor comments but overall lgtm

@iskakaushik iskakaushik merged commit 13c1c57 into main Nov 24, 2023
12 checks passed
@iskakaushik iskakaushik mentioned this pull request Dec 9, 2023
iskakaushik pushed a commit that referenced this pull request Dec 9, 2023
#708 makes this obsolete
@serprex serprex deleted the walheartbeat-for-peers branch July 19, 2024 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants