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

Backfill indexing #1290

Merged
merged 24 commits into from
Nov 30, 2020
Merged

Backfill indexing #1290

merged 24 commits into from
Nov 30, 2020

Conversation

hsorellana
Copy link
Contributor

@hsorellana hsorellana commented Nov 20, 2020

What this PR does / Why we need it:
This PR adds IndexBackfill, DeindexBackfill and GetIndexedBackfills funcs to the statestore, funcs used in QueryService but, for code sanity, it was decided to put them in a separate PR

Which issue(s) this PR fixes:
This is related to #1280 which is also related to #1240

@google-cla google-cla bot added the cla: yes label Nov 20, 2020
@hsorellana hsorellana marked this pull request as draft November 20, 2020 21:00
@hsorellana hsorellana marked this pull request as ready for review November 22, 2020 00:09
internal/statestore/backfill.go Outdated Show resolved Hide resolved
internal/statestore/backfill.go Outdated Show resolved Hide resolved
}
defer handleConnectionClose(&redisConn)

// TODO: review usage of version or stick with Generation

Choose a reason for hiding this comment

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

Here (and other todo) can you add a task on your backlog for this? I think generation is going to work here, so I'm worried nobody is going to look at this code and the todo will stick around...

Choose a reason for hiding this comment

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

Otherwise, create an issue on github, saying these todos need to be cleaned up, and reference the issue in the todo, eg

// TODO(#1234): clean the gutters

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, absolutely! I think there's a conversation needed to happen so about the Version/Generation issue, and as soon that clears, i'll delete the TODOs i've put

Copy link
Collaborator

@aLekSer aLekSer Nov 25, 2020

Choose a reason for hiding this comment

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

#1294 Was created, thanks Hugo

Choose a reason for hiding this comment

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

Remove the todo, and this can be merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Go for merging @Laremere 👍

// deindex one backfill, one backfill exist
err := service.DeindexBackfill(ctx, backfills[0].Id)
require.Nil(t, err)
verifyBackfills(service, backfills[1:2])
Copy link
Collaborator

@aLekSer aLekSer Nov 25, 2020

Choose a reason for hiding this comment

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

Could you please add one more test with updating Generation to see, if HSET and IndexBackfill would work as expected - BackfillID would be mapped to 1000 now.

newGen : = 1000
backfills[1].Generation = newGen
bf, service.UpdateBackfill(ctx, backfills[1], []string{}))
require.NoError(t, service.IndexBackfill(ctx, backfills[1]))

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 don't see exactly what you want tested here. If you are concerned about HSET the documentation says if the key already exists, it is overwritten with the new value. And the scenario you are proposing i have it tested in the backfill caching update tests

Redis documentation for HSET says:

If key does not exist, a new key holding a hash is created. If field already exists in the hash, it is overwritten.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, just wanted to test update the of the index, just to check it is updated

Copy link
Collaborator

@aLekSer aLekSer left a comment

Choose a reason for hiding this comment

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

Thanks for this PR, overall is great. But I think GetIndexedBackfills() result should be more properly unit tested.

Copy link
Collaborator

@aLekSer aLekSer left a comment

Choose a reason for hiding this comment

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

Thanks for updating UT, also great to see how this PR would be used in E2E test in QueryBackfills PR.

@Laremere Laremere merged commit 88cd95f into googleforgames:master Nov 30, 2020
@hsorellana hsorellana deleted the backfill-indexing branch November 30, 2020 13:07
@syntxerror syntxerror added this to the v1.2.0 milestone Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants