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 runCommand's inserts of documents without _ids #2574

Merged
merged 5 commits into from
May 8, 2023

Conversation

kropidlowsky
Copy link
Contributor

@kropidlowsky kropidlowsky commented May 7, 2023

Description

Closes #1714 .

  • Add _ids generation for runCommand insert.

IT DOES NOT WORK FULLY!
While running db.runCommand({ insert: "{collection}", documents: [ {v: "abc" } ]}) it fails:
clientconn/conn.go:164 expected length 95 (marshaled body size) + 16 (fixed marshaled header size) = 111, got 94.
However, when the FerretDB is run once again the inserted value appears in the collection.
Thank you in advance for help!

Readiness checklist

  • I added/updated unit tests.
  • I added/updated integration/compatibility tests.
  • 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), Labels, Project and project's Sprint fields.
  • I marked all done items in this checklist.

@kropidlowsky kropidlowsky requested a review from a team as a code owner May 7, 2023 21:51
@codecov
Copy link

codecov bot commented May 7, 2023

Codecov Report

Merging #2574 (61530ea) into main (2d6c82e) will decrease coverage by 0.02%.
The diff coverage is 52.63%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2574      +/-   ##
==========================================
- Coverage   65.61%   65.59%   -0.02%     
==========================================
  Files         411      411              
  Lines       20134    20148      +14     
==========================================
+ Hits        13210    13217       +7     
- Misses       5982     5989       +7     
  Partials      942      942              
Impacted Files Coverage Δ
internal/handlers/tigris/msg_insert.go 0.00% <0.00%> (ø)
internal/handlers/pg/msg_insert.go 82.10% <100.00%> (+1.42%) ⬆️

... and 1 file with indirect coverage changes

Flag Coverage Δ
integration 58.63% <52.63%> (-0.01%) ⬇️
mongodb 5.51% <0.00%> (-0.01%) ⬇️
pg 58.54% <52.63%> (-0.01%) ⬇️
unit 25.63% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@w84thesun
Copy link
Contributor

clientconn/conn.go:164 expected length 95 (marshaled body size) + 16 (fixed marshaled header size) = 111, got 94

That problem usually occurs when we modify the original message and then try to send it to a proxy. As a result of this
marshal function would fail.

I made the necessary changes to make it work.

@w84thesun w84thesun added the code/bug Some user-visible feature works incorrectly label May 8, 2023
@w84thesun w84thesun enabled auto-merge (squash) May 8, 2023 11:50
@w84thesun w84thesun changed the title Fix runCommand's inserts of documents without _ids Fix runCommand's inserts of documents without _ids May 8, 2023
@w84thesun w84thesun requested a review from rumyantseva May 8, 2023 16:29
Copy link
Contributor

@rumyantseva rumyantseva left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@w84thesun w84thesun left a comment

Choose a reason for hiding this comment

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

LGTM!

@w84thesun w84thesun merged commit 5386d51 into FerretDB:main May 8, 2023
@AlekSi AlekSi added this to the v1.1.0 milestone May 9, 2023
@AlekSi AlekSi modified the milestones: v1.1.0, v1.2.0 May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code/bug Some user-visible feature works incorrectly
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Fix inserts of documents without _ids
4 participants