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

Fix awaitData cursors #3961

Draft
wants to merge 97 commits into
base: main
Choose a base branch
from
Draft

Conversation

noisersup
Copy link
Member

@noisersup noisersup commented Jan 9, 2024

Description

Closes #3957.

Readiness checklist

  • I added/updated unit tests (and they pass).
  • I added/updated integration/compatibility tests (and they pass).
  • I added/updated comments and checked rendering.
  • I made spot refactorings.
  • I updated user documentation.
  • I ran task all, and it passed.
  • I ensured that PR title is good enough for the changelog.
  • (for maintainers only) I set Reviewers (@FerretDB/core), Milestone (Next), Labels, Project and project's Sprint fields.
  • I marked all done items in this checklist.

Copy link
Member

@AlekSi AlekSi left a comment

Choose a reason for hiding this comment

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

CI fails after merging #3940


collName := testutil.CollectionName(t)

ready <- struct{}{}
Copy link
Member

Choose a reason for hiding this comment

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

We are not ready with the setup yet at this point. This should be moved lower

@noisersup noisersup requested a review from AlekSi January 16, 2024 20:47
@@ -308,6 +308,122 @@ func TestCursorsTailableAwaitData(t *testing.T) {
})
}

func TestCursorsTailableAwaitDataAfterInsertStress(t *testing.T) {
if !setup.IsMongoDB(t) {
t.Skip("https://github.com/FerretDB/FerretDB/pull/3961")
Copy link
Member

Choose a reason for hiding this comment

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

We should link to issues, not to PRs.

And can we use expected failure instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Most of the subtests pass, and usually one of them fails, so not really

teststress.Stress(t, func(ready chan<- struct{}, start <-chan struct{}) {
testID := count.Add(1)

t.Run(fmt.Sprint(testID), func(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

t.Run doesn't run in parallel, effectively un-stressing the test

Copy link
Member Author

Choose a reason for hiding this comment

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

From my testing it seems it's not

Copy link
Member

Choose a reason for hiding this comment

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

Ok, please explain how t.Run works then

Comment on lines 357 to 358
var firstBatch *types.Array
firstBatch, cursorID = getFirstBatch(t, res)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
var firstBatch *types.Array
firstBatch, cursorID = getFirstBatch(t, res)
var firstBatch *types.Array
firstBatch, cursorID := getFirstBatch(t, res)

There is no need to define cursorID above either.

(I wonder why everyone suddenly started using var instead of short variables assignments…)

@noisersup noisersup changed the title Add stress test for awaitData cursors Fix awaitData cursors Jan 17, 2024
@noisersup noisersup requested a review from AlekSi January 17, 2024 19:12
@AlekSi
Copy link
Member

AlekSi commented Jan 29, 2024

On hold for now

@AlekSi AlekSi marked this pull request as draft January 29, 2024 07:51
auto-merge was automatically disabled January 29, 2024 07:51

Pull request was converted to draft

@AlekSi AlekSi modified the milestones: v1.19.0, Next Jan 29, 2024
@AlekSi AlekSi removed request for a team, AlekSi, henvic and rumyantseva January 29, 2024 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code/chore Code maintenance improvements
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Tailable cursor with awaitData should block and not error
2 participants