0-db icon indicating copy to clipboard operation
0-db copied to clipboard

hook: improve shutdown/starting to save and restore database

Open maxux opened this issue 4 years ago • 0 comments

Current hook system allows immutable file upload/download but doesn't fully covers database loading/closing.

Engine expect database to be sane before starting, a sane database is: a full index present and the last datafile (not immutable) present. All other datafiles can be offloaded safely.

Except with some hack, there is no clean way to restore database or save database when zdb starts/stop. Here is a suggestion:

  • Create a new hook per namespace when zdb stops, triggering hook with namespace name, dirty index list, current active indexfile and datafile.
    • This hook will allows 3rd party script to save the exact state of the database, when closing.
  • Create a new hook called on zdb initialization, before trying to load any namespace.
    • This hook will allows 3rd party script to restore full index and last datafile before starting.

In addition for extra information, the current index and datafile will be added to NSINFO aswell. (cc @OmarElawady for qsfs)

maxux avatar Dec 13 '21 14:12 maxux