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 Packet size mismatch! error on collection drop #2813

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

Conversation

gedaiu
Copy link
Contributor

@gedaiu gedaiu commented Jan 11, 2025

fix #2812

@gedaiu
Copy link
Contributor Author

gedaiu commented Jan 16, 2025

@WebFreak001 @s-ludwig any thoughts on this pr?

@s-ludwig
Copy link
Member

The change looks good, but the code in the unittest needs to be moved to a test in "/tests/mongodb", as the regular CI runs do not have a MongoDB server available. It can probably just be moved to "/tests/mongodb/_connection/source/app.d"

@WebFreak001
Copy link
Contributor

sounds good but please don't put it in the fundamental _connection test, but rather in some (perhaps new) collection management test

@gedaiu gedaiu force-pushed the master branch 2 times, most recently from b2070ae to 8506c9c Compare January 27, 2025 12:01
@gedaiu
Copy link
Contributor Author

gedaiu commented Jan 27, 2025

@s-ludwig @WebFreak001 ready for another look

{
MongoClient client = connectMongoDB("127.0.0.1", port);

/// Drop a collection
Copy link
Contributor

Choose a reason for hiding this comment

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

is this test only testing dropping non-existent collections?

Should probably drop it twice just in case if it randomly existed beforehand on CI. It should behave the same both times after all.

Otherwise it might make sense to also create a collection here.

@gedaiu
Copy link
Contributor Author

gedaiu commented Jan 27, 2025 via email

@s-ludwig
Copy link
Member

I've just tested locally and for me the test passes when I insert just a single {_id: ...} entry into the collection beforehand. So I'd say let's just add a second drop to make it safe.

@WebFreak001
Copy link
Contributor

it does not matter if I do it once or twice.

prove it in the test then? :D

Right now the CI fails with command failed: ns not found in vibe.db.mongo.collection.MongoCollection.drop (../../../mongodb/vibe/db/mongo/collection.d:1238) on all MongoDB versions prior to 7.0

So it looks like in older MongoDB versions this didn't work.

Now we could either ignore this error on the vibe.d side to make it behave the same with all MongoDB versions (and perhaps return a boolean if we can extract it in >=7 as well and make it part of the API) or just say double free has unspecified behavior.

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.

"Packet size mismatch!" on dropping mongodb collection
3 participants