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

CBG-4309: add rollback hook for cbgt to call during rollback of pIndex #7295

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

gregns1
Copy link
Contributor

@gregns1 gregns1 commented Jan 15, 2025

CBG-4309

CBGT has notion of a rollback hook that is called during rollback of pIndex at different stages. CBFT uses this in different ways but it is advised we use the hook upon rollback completion to kick the Janitor to pick up rolled back pIndexes and restart streams to the vBuckets in these pIndexes.

I believe this should fix the issue where customers rolled back pIndexes weren’t being picked up by the janitor.

Pre-review checklist

  • Removed debug logging (fmt.Print, log.Print, ...)
  • Logging sensitive data? Make sure it's tagged (e.g. base.UD(docID), base.MD(dbName))
  • Updated relevant information in the API specifications (such as endpoint descriptions, schemas, ...) in docs/api

Integration Tests

@gregns1 gregns1 self-assigned this Jan 15, 2025
@@ -337,6 +337,16 @@ func initCBGTManager(ctx context.Context, bucket Bucket, spec BucketSpec, cfgSG
sourceUUID: bucketUUID,
}

// Define rollback hook to be called by cbgt during rollback. This is used to kick the janitor to reassign feeds
// after a full rollback of a pindex
cbgt.RollbackHook = func(phase cbgt.RollbackPhase, pindex *cbgt.PIndex) (err error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this modifies a global in cbgt, can we move this to init where we add the other globals?

func init() {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree this makes sense but we need access to the manager to kick the janitor, which doesn't look like it can be done there?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Then we need to figure out how to run a function that passes in a manager for a specific bucket initCBGTManager is called once per bucket and then a second database would overwrite this callback for the first.

I think we might be able to do something with a wrapper function to look up mgr based on pindex and store this globally, or we could ask cbgt team to change their API so this isn't required? I don't know if they have one manager per instance, but that seems wacky.

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