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

Broker can receive checkpoint create command from the gateway #9726

Closed
Tracked by #9606
deepthidevaki opened this issue Jul 7, 2022 · 1 comment · Fixed by #9936
Closed
Tracked by #9606

Broker can receive checkpoint create command from the gateway #9726

deepthidevaki opened this issue Jul 7, 2022 · 1 comment · Fixed by #9936
Assignees
Labels
version:8.1.0-alpha5 Marks an issue as being completely or in parts released in 8.1.0-alpha5 version:8.1.0 Marks an issue as being completely or in parts released in 8.1.0

Comments

@deepthidevaki
Copy link
Contributor

deepthidevaki commented Jul 7, 2022

Depends on #9719

Broker can receive a checkpoint request from the gateway.

  • Decide if command-api will receive the command or we create a new end-point.
  • Writes the command to the logstream
  • Similar to other commands
    • should send the response back after it is processed by the StreamProcessor
    • should go through the backpressure.
@deepthidevaki
Copy link
Contributor Author

I discussed with @oleschoenburg the following options.

  1. Use CommandApiHandler to receive take-backup command and write to the logstream. But define a new BackupApiHandler to process other backup requests like status query and delete.
  • Pro:
    • Take-backup is processed like any other command. It is written to the logstream and the response is send by the StreamProcessor
    • We can apply backpressure if needed.
  • Cons:
    • Backup requests are handled in two different places
  1. Define a new BackupApiHandler to receive all backup commands including take-backup. We will define a new RequestType.BACKUP. In this option, there are several way to handle the take-backup request.
    a. BackupApiHandler receive take-backup command, write the checkpoint record to the logstream and immediately send success response to the gateway, without waiting for it to be processed/committed. Gateway/User then must query the status of the backup and retry if needed (in case the backup was not triggered, because the command was lost due to a leader change).
    b. BackupApiHandler receives take-backup command, write the checkpoint record to the logstream, wait until the record is processed and send success response to the gateway. Here BackupApiHandler should somehow wait for the record is to be processed, but it wouldn't know what is the result of the processing. So it can only send an empty success response.
    c. BackupApiHandler receives take-backup command, write the checkpoint record to the logstream, and do not send the response. The response will be send by the streamprocessor after the record is processed.

We decided to go with 2c because:

  1. All backup requests are handled at a single point.
  2. By letting StreamProcessor sending the response backup, we follow the usual command processing pattern.
  3. CheckpointRecordProcessor can then send either a success response (backup is triggered) or a response that indicates a checkpoint already exists, so no backup will be triggered.
  4. Other backup requests will be responded by the BackupApiHandler itself, but each request can define its own response types.

zeebe-bors-camunda bot added a commit that referenced this issue Aug 1, 2022
9907: Add request handler to process take backup command  r=deepthidevaki a=deepthidevaki

## Description

- Adds `BackupApiRequestHandler`
- Handles TAKE_BACKUP command
 
The handler receives TAKE_BACKUP request, writes and new record to the logstream. The handler will not sent the response back to the gateway. The response will be sent by the processor after processing this record. This way the gateway knows that the request was processed and there is no need to retry.

We have also added a BackupResponse which is unused now. This will used by the other backup related commands which will be added later. For those requests, the response will be sent by this handler. For that BackupApiResponseWriter must be extended to allow returning a response. 

Adding a PartitionTransitionStep to install the new handler will be done in a follow up PR.

## Related issues

related #9726



Co-authored-by: Deepthi Devaki Akkoorath <deepthidevaki@gmail.com>
@Zelldon Zelldon added the version:8.1.0 Marks an issue as being completely or in parts released in 8.1.0 label Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
version:8.1.0-alpha5 Marks an issue as being completely or in parts released in 8.1.0-alpha5 version:8.1.0 Marks an issue as being completely or in parts released in 8.1.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants