threefoldtecharchive / jumpscaleX_core

Apache License 2.0
1 stars 6 forks source link

BCDB import/export [development_importexport] #413

Closed waleedhammam closed 4 years ago

waleedhammam commented 4 years ago

Testing on one bcdb instance

@url = world.ship.window sn = 1 (I)"""

h = j.data.bcdb.get("hellobcdb") m = h.model_get(schema=s) o = h.models.world__ship.new()
o.n = 1 o.sub.sn = 4 o.save()

- check the data
`j.data.bcdb.get("hellobcdb").get_all() # will be there`

- Export the data
`j.data.bcdb.hellobcdb.export(path="/test_export/") `

- now try to import
`j.data.bcdb.get("hellobcdb").import_("/test_export")`
This will return empty result cause in the code it looks for another files extensions in the encrypted state. it will work if we pass  encrypt=False in exporting.

**Testing on multiple bcdb instances**

`j.data.bcdb.export(path="/test_export")`  This will work OK and data is exported but when importing using:
`j.data.bcdb.import_()`

will give us this error:
```bash
JSX> j.data.bcdb.import_()                                                                               
no server running need to start
++ '[' start == kill ']'
++ tmux -f /sandbox/cfg/.tmux.conf has-session -t main
no server running on /tmp/tmux-0/default
++ '[' 1 -eq 1 ']'
++ echo 'no server running need to start'
++ tmux -f /sandbox/cfg/.tmux.conf new -s main -d 'bash --rcfile /sandbox/bin/env_tmux_detach.sh'
++ '[' start '!=' start ']'
Thu 09 16:56:11 /bcdb/BCDBFactory.py - 474 - get_for_threebot                   : EXCEPTION: 
    ttype can only be zdb or sqlite
--TRACEBACK------------------
<stdin> in <module>
    1    
/sandbox/lib/jumpscale/Jumpscale/data/bcdb/BCDBFactory.py in import_
    363    self.import_(name, path=path)
/sandbox/lib/jumpscale/Jumpscale/data/bcdb/BCDBFactory.py in import_
    378    bcdb = self.get_for_threebot(name, namespace=config["namespace"], ttype=config["type"])
/sandbox/lib/jumpscale/Jumpscale/data/bcdb/BCDBFactory.py in get_for_threebot
    474    raise j.exceptions.Input("ttype can only be zdb or sqlite")
-----------------------------

None
serboctor commented 4 years ago

@despiegk I checked the history, and it seems you did some changes to export/import today. I can see that when the data is encrypted the extension you're exporting to is different from the extension you check on while importing.

waleedhammam commented 4 years ago

Encountered bug:

1- Do j.data.bcdb.export() then j.data.bcdb.import_()

gives namespace error key not found when namespace = sdb

image

in this example was myjobs db

image

waleedhammam commented 4 years ago

Encountered bug 2:

If setting unknown namespace with none gives this error

image

waleedhammam commented 4 years ago

Encountered bug 3:

on another machine I found this error

Screenshot from 2020-01-13 16-52-02

despiegk commented 4 years ago

is the next_internal_id always available?

waleedhammam commented 4 years ago

Yes, it was added in zdb 2 weeks ago or so that zdb knows the next_internal_id

serboctor commented 4 years ago

@waleedhammam for bug 3 this simply means that this machine doesnt have the latest zdb. A reinstall would fix it.

waleedhammam commented 4 years ago

@waleedhammam for bug 3 this simply means that this machine doesnt have the latest zdb. A reinstall would fix it.

Yes, Thanks

waleedhammam commented 4 years ago

Updates

Currently if we are using zdb as backend namespace not found error is encountered, this happens because only admin client can create namespace, in the import script it's normal client Screenshot from 2020-01-16 15-28-06

After that there's a weird error occurs that there's a schema missing Screenshot from 2020-01-16 15-28-37

there may be something missing from the export which is not exporting all related nested schemas

waleedhammam commented 4 years ago

for the export bug. I tried with explorer stress test, for urls like tfgrid.workloads.reservation.signing.request.1:

exporting nested schemes, it should be recursive or something like graph, to evaluate each dependency in each level before getting the root schema

image

waleedhammam commented 4 years ago

Branch: [development_importexport]

Related fixes: https://github.com/threefoldtech/jumpscaleX_core/commit/dc69592a21de86c3df871da0d00c23f84a319e32, https://github.com/threefoldtech/jumpscaleX_core/commit/afb959a7f48aa597c87a3762a36fb149d6ae8234

waleedhammam commented 4 years ago

Branch: [development_importexport]

Related fixes https://github.com/threefoldtech/jumpscaleX_core/commit/bf7f194217148622673c5464ff91786b93306a27, https://github.com/threefoldtech/jumpscaleX_core/commit/66cc68d9fb880bf2b0565215b09dcb15ac281b2f

Changelog

to run the test kosmos -p -m 'j.data.bcdb.test(name="export")'

waleedhammam commented 4 years ago

TODO: fix encrypted import export

waleedhammam commented 4 years ago

TODO: fix encrypted import export

Fixed at: https://github.com/threefoldtech/jumpscaleX_core/commit/d5bdf16112ad39c7ace9333d21c7f5256f5c61cf

Dina-Abd-Elrahman commented 4 years ago