ioBroker.js-controller icon indicating copy to clipboard operation
ioBroker.js-controller copied to clipboard

Question: Why saves iob backup ID values contents double in "value" and "doc"?

Open mcuiobroker opened this issue 2 years ago • 5 comments

In the backup.json there is for each ID the object "value" and object "doc" with the same Content? Is it possible to save storage space? Or is there an special reason for that saving? https://forum.iobroker.net/topic/27267/test-adapter-iobroker-backitup-v2-4-x/1956

mcuiobroker avatar May 27 '22 22:05 mcuiobroker

The content is not alwys the same ... but in fact I would say "this is historic" ... exact reasons would need to be deeply checked ... yes could save some megabytes :-)

Apollon77 avatar May 27 '22 22:05 Apollon77

It is the result from a getObjectList call and yes it should be 100 % identical https://github.com/ioBroker/ioBroker.js-controller/blob/128e8b10f7b78bc7142a708d467270b661cdf15a/packages/db-objects-redis/src/lib/objects/objectsInRedisClient.ts#L4434 probably only there for backward compatibility.

foxriver76 avatar Jun 06 '22 19:06 foxriver76

On a first look restore only uses doc, thus we could get rid of saving value without breaking backward compatibility.

https://github.com/ioBroker/ioBroker.js-controller/blob/128e8b10f7b78bc7142a708d467270b661cdf15a/packages/controller/lib/setup/setupBackup.js#L482

Edit: no here value is used too https://github.com/ioBroker/ioBroker.js-controller/blob/128e8b10f7b78bc7142a708d467270b661cdf15a/packages/controller/lib/setup/setupBackup.js#L803

So first step would be to harmonize to use either doc or value in restore so we can later on remove it from the backup creation process.

foxriver76 avatar Jun 06 '22 20:06 foxriver76

But maybe rewritable to use doc too?

Apollon77 avatar Jun 06 '22 20:06 Apollon77

But maybe rewritable to use doc too?

Yes, but then we cannot remove it from backup creation process yet without breaking backward compatibility, see my latest edit.

foxriver76 avatar Jun 06 '22 20:06 foxriver76