-
Notifications
You must be signed in to change notification settings - Fork 333
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
Frontend: UpdateBackfill and DeleteBackfill handlers #1292
Frontend: UpdateBackfill and DeleteBackfill handlers #1292
Conversation
fdbeaaa
to
9f970a7
Compare
if req.Backfill == nil { | ||
return nil, status.Errorf(codes.InvalidArgument, ".backfill is required") | ||
} | ||
if req.Backfill.CreateTime != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this check required? If we look at doCreateBackfill it always assigns new value to CreateTime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if _, err = m.Unlock(ctx); err != nil { | ||
|
||
logger.WithFields(logrus.Fields{ | ||
"error": err.Error(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it is better to use WithError and specify fields such as backfill_id?
c19f681
to
c60a4f6
Compare
Unrelated to the change CI failure:
|
Generate ID, store into Redis, add telemetry.
Add lock/unlock to Frontend Create method.
Create and GetBackfill E2E test.
Add CreateBackfill validation check. Extend E2E test.
We need to create a new statestore, so cancel() would always succeed.
New frontend methods with locks and tests.
Fixing error handling adding UT similar to CreateBackfill.
c60a4f6
to
1252491
Compare
return nil, err | ||
} | ||
|
||
err = s.store.DeleteTicketsFromPendingRelease(ctx, associatedTickets) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This must be done after the ticket is updated:
If the server performs this action, then dies, the tickets will think they can return to the active pool and find other matches, but the backfill will still think it can put tickets in this backfill, potentially assigning them twice.
The other way around, the backfill will release it's claim in the tickets, and if this server dies, then the tickets will just time out and then re-enter the pool.
return nil, status.Errorf(codes.InvalidArgument, ".backfill is required") | ||
} | ||
|
||
backfill, ok := proto.Clone(req.Backfill).(*pb.Backfill) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The update here should be done defensively, currently you perform the get, but use the backfill passed in as the source of truth. Instead start with the backfill from the get, and then update each field which should be updated. Eg, create time would be overwritten if the wrong value were sent here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the code with:
// Update generation here, because Frontend is used by GameServer only
bfStored.Generation++
bfStored.SearchFields = backfill.SearchFields
bfStored.Extensions = backfill.Extensions
require.Nil(t, err) | ||
|
||
createdBf.SearchFields.StringArgs["key"] = "val" | ||
updatedBf, err := om.Frontend().UpdateBackfill(ctx, &pb.UpdateBackfillRequest{Backfill: createdBf}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To better test this method, send an entirely new Backfill protobuf object, with the new value but setting the ID to the one from createdBf.
As it is, this test incorrectly thinks it verifies CreateTime can't be updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also it would be a better way to show that generation doesn't need to be right.
}, | ||
}, | ||
} | ||
createdBf, err := om.Frontend().CreateBackfill(ctx, &pb.CreateBackfillRequest{Backfill: bf}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test generation values?
Generation, CreateTime is ignored on Backfill updates, fixing test to check that.
All comments are resolved. |
/gcprun |
/gcbrun |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra comment should be removed, but a few things are depending on this so I'll merge it if the tests pass.
Tests are still failing.... |
99bd1b7
to
4f0b5c1
Compare
What this PR does / Why we need it:
UD methods for Backfill structure.
Which issue(s) this PR fixes:
Work on #1240
Special notes for your reviewer:
This PR contains another PR with CRud part of Frontend: #1279
So review please only changes from this commit and later commits:
9f970a7