Commit d9e9ab2
authored
fix(model): Ensure repeated props have same kind when converting from ds (#824)
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)1 parent 56608f2 commit d9e9ab2
File tree
2 files changed
+41
-2
lines changed- packages/google-cloud-ndb
- google/cloud/ndb
- tests/unit
2 files changed
+41
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
543 | 543 | | |
544 | 544 | | |
545 | 545 | | |
| 546 | + | |
546 | 547 | | |
547 | 548 | | |
548 | 549 | | |
| |||
623 | 624 | | |
624 | 625 | | |
625 | 626 | | |
626 | | - | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
627 | 630 | | |
628 | 631 | | |
629 | | - | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
630 | 635 | | |
631 | 636 | | |
632 | 637 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5606 | 5606 | | |
5607 | 5607 | | |
5608 | 5608 | | |
| 5609 | + | |
| 5610 | + | |
| 5611 | + | |
| 5612 | + | |
| 5613 | + | |
| 5614 | + | |
| 5615 | + | |
| 5616 | + | |
| 5617 | + | |
| 5618 | + | |
| 5619 | + | |
| 5620 | + | |
| 5621 | + | |
| 5622 | + | |
| 5623 | + | |
| 5624 | + | |
| 5625 | + | |
| 5626 | + | |
| 5627 | + | |
| 5628 | + | |
| 5629 | + | |
| 5630 | + | |
| 5631 | + | |
| 5632 | + | |
| 5633 | + | |
| 5634 | + | |
| 5635 | + | |
| 5636 | + | |
| 5637 | + | |
| 5638 | + | |
| 5639 | + | |
| 5640 | + | |
| 5641 | + | |
| 5642 | + | |
5609 | 5643 | | |
5610 | 5644 | | |
5611 | 5645 | | |
| |||
0 commit comments