-
Notifications
You must be signed in to change notification settings - Fork 246
DRIVERS-3123 Relaxes requirement on reads of the ignored bits of PACKED_BIT vectors. #1812
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
Conversation
…he given padding (those ignored) must be zero.
…s in bson binary vectors
…D_BIT with inconsistent padding
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.
LGTM with minor comments addressed.
Prose tests were run in the C driver here (excluding comparison, since the bson_vector_packed_bit_view_t
does not support comparison).
assert v2 != v1 # Also chosen to be unequal at BinaryVector level as [255] != [128] | ||
``` | ||
|
||
Drivers MAY skip this test if they choose not to implement a `Vector` type. |
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.
Drivers MAY skip this test if they choose not to implement a `Vector` type. | |
Drivers MAY skip this test if they choose not to implement a `Vector` type, or the type does not support comparison. |
Suggest permitting drivers skip this test if the Vector
type does not support comparison. The C driver bson_vector_packed_bit_view_t
(which I expect is the closest analog to the Vector
type) does not support comparison.
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.
Tracked in #1819.
assert b1 == Binary(b'\x10\x07\x80', subtype=9) # This is effectively a roundtrip. | ||
v1 = Binary.as_vector(b1) | ||
|
||
b2 = Binary.from_vector([0b11111111], BinaryVectorDtype.PACKED_BIT, padding=7) |
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.
I expect Binary.from_vector
would raise an exception for non-zero ignored bits. Suggest instead directly doing:
b1 = Binary(b'\x10\x07\x80', subtype=9)
b2 = Binary(b'\x10\x07\xff', subtype=9)
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.
Tracked in #1819.
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.
LGTM, however possibly another driver maintainer is worth looping in (up to you @caseyclements)
We have chosen not to require drivers to throw an error if data coming out of the server has non-zero ignored bits. This is for backwards-compatibility. The changes are the result of conversations with Dev Tools. The situation we want to avoid is that a non-technical user cannot get their data out. Imagine the situations of a user of Compass, who tries to look at her data, and gets nothing but exceptions. Instead, we require new writes to zero our data on writes, but allow freedom for drivers to migrate to the end goal of always requiring ignored bits to be zero according to their particular versioning and whether or not they've already implemented this feature.
Completed:
clusters).