peerdb icon indicating copy to clipboard operation
peerdb copied to clipboard

Flow API: Custom resume endpoint

Open Amogh-Bharadwaj opened this issue 9 months ago • 0 comments

API Endpoint to Resume Mirror With Specified Syncs

This PR introduces an endpoint in our Flow API to resume mirrors with a request of custom number of syncs. The number of syncs the client can request is, for now, a number between 1 and the MaxSyncsPerCDCFlow which is currently 32. Syncs in this case refers to one sync flow - normalise flow pair. This endpoint requires the mirror to be paused before hand. Request validation checks the above along with whether the mirror name exists, etc.

Implementation:

  • Changes the type of CDCFlowSignal to now be CDCFlowSignalProperties, which has two fields -
type CDCFlowSignalProperties struct {
	Signal              CDCFlowSignal
	CustomNumberOfSyncs int
}
  • The branch of the FlowStateChange endpoint which handles mirror resume now sends the above signal with the custom sync number information.
  • This information is picked up in cdc_flow.go .
  • I've included the limit check here in the selector for normalise-result channel which sends normalise-done signal

Functional testing:

  • Tested with a paused mirror with low sync interval via HTTP requests to this endpoint
  • Resume mirror via the normal UI button route will stick to existing behaviour of MaxSyncsPerCDCFlow=32 sync flows.
Screenshot 2024-05-10 at 5 25 18 PM Screenshot 2024-05-10 at 5 25 42 PM Screenshot 2024-05-10 at 5 27 36 PM

Amogh-Bharadwaj avatar May 13 '24 07:05 Amogh-Bharadwaj