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

Data loses when reusing persistent objects #219

Open
polsm91 opened this issue Mar 19, 2019 · 0 comments
Open

Data loses when reusing persistent objects #219

polsm91 opened this issue Mar 19, 2019 · 0 comments
Labels

Comments

@polsm91
Copy link
Collaborator

polsm91 commented Mar 19, 2019

If we assign two StorageObj to an in-memory StorageDict, and then call make_persistent their data is overlapped. The storage dict value name is used to generate the UUIDs, therefore, all entries get the same name and same UUID. They clash and overwrite each other.

In [2]: from hecuba import StorageObj

In [3]: from hecuba import StorageDict
    ...: class SObj(StorageObj):
    ...:     '''
    ...:     @ClassField none int
    ...:     '''
    ...:     
    ...: class Test(StorageDict):
    ...:     '''
    ...:     @TypeSpec dict<<lat:double>,val:__main__.SObj>
    ...:     '''


In [7]: a = SObj()

In [8]: a.none = 123

In [9]: b = SObj()

In [10]: b.none=256

In [15]: c = Test()

In [17]: c[0]=a

In [18]: c[1]=b

In [19]: c.make_persistent('name')

In Cassandra we have:

cqlsh> SELECT * FROM my_app.name;

 lat | val
-----+--------------------------------------
   1 | 66aaef29-4046-3827-9710-37073d04dda0
   0 | 66aaef29-4046-3827-9710-37073d04dda0

(2 rows)

cqlsh> SELECT * FROM my_app.name_val ;

 storage_id                           | none
--------------------------------------+------
 66aaef29-4046-3827-9710-37073d04dda0 |  256

(1 rows)
@polsm91 polsm91 added the bug label Mar 19, 2019
@polsm91 polsm91 changed the title Overriden values when dict is persisted at a later stage Data loses when reusing persistent objects Jul 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant