fix(model): Ensure repeated props have same kind when converting from ds by bw-yuhogg · Pull Request #824 · googleapis/python-ndb · GitHub
Skip to content
This repository was archived by the owner on May 6, 2026. It is now read-only.

fix(model): Ensure repeated props have same kind when converting from ds#824

Merged
parthea merged 1 commit into
googleapis:mainfrom
bw-yuhogg:fix-rep-prop-bug
Nov 16, 2022
Merged

fix(model): Ensure repeated props have same kind when converting from ds#824
parthea merged 1 commit into
googleapis:mainfrom
bw-yuhogg:fix-rep-prop-bug

Conversation

@bw-yuhogg

@bw-yuhogg bw-yuhogg commented Nov 14, 2022

Copy link
Copy Markdown
Contributor

Legacy NDB had a bug where, with repeated Expando properties, it could end up writing arrays of different length if some entities had missing values for certain subproperties. When Cloud NDB read this out, it might have only loaded entities corresponding to the shorter array length. See issue #129 .

To fix this, with PR #176 , we made Cloud NDB check if there are length differences and pad out the array as necessary.

However, depending on the order properties are returned from Datastore in, we may have accidentally padded with subentities of the wrong kind, because it was possible to skip over updating the kind if we alternated between updating repeated properties.

(Eg: A.a with 2 elements, B.b with 3 elements, A.c with 3 elements -> A would end up with an element of B's kind)

@bw-yuhogg bw-yuhogg requested review from a team November 14, 2022 21:02
@product-auto-label product-auto-label Bot added the api: datastore Issues related to the googleapis/python-ndb API. label Nov 14, 2022
Legacy NDB had a bug where, with repeated Expando properties, it could
end up writing arrays of different length if some entities had missing
values for certain subproperties. When Cloud NDB read this out, it might
have only loaded entities corresponding to the shorter array length.
See issue googleapis#129 .

To fix this, with PR googleapis#176 , we made Cloud NDB check if there are length
differences and pad out the array as necessary.

However, depending on the order properties are returned from Datastore in,
we may have accidentally padded with subentities of the wrong kind,
because it was possible to skip over updating the kind if we alternated
between updating repeated properties.

(Eg: A.a with 2 elements, B.b with 3 elements, A.c with 3 elements ->
A would end up with an element of B's kind)
@eddavisson

Copy link
Copy Markdown

@parthea parthea added the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 15, 2022
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 15, 2022
@parthea parthea merged commit 29f5a85 into googleapis:main Nov 16, 2022
@bw-yuhogg bw-yuhogg deleted the fix-rep-prop-bug branch November 16, 2022 14:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: datastore Issues related to the googleapis/python-ndb API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants