Skip to content

reindexEncrypted needs to be crash-resistant #407

Open
@staltz

Description

@staltz

Context: ssbc/ssb-box2#22

There could be a feature in ssb-db2's reindexEncrypted where it is crash-resistant. Since reindexEncrypted takes no arguments, this is just a matter of storing a boolean in some file (or just the file existence can be the "true" boolean) and then once ssb-db2 starts up it resumes reindexEncrypted if that file exists. Note also that reindexEncrypted does not need to be atomic. Any subset of encrypted records that got decrypted is some partial progress, and then after app restart, the progress can continue.

Also, another thing I notice is that it seems reindexEncrypted is not very efficient, at least not with jitdb. If there are encrypted records at seq 6, 14, 18, 22, and assume max seq is 100 then it'll reindex jitdb from seq 6–100, then reindex 14–100, then 18–100, then 22–100. It could just pick the minimum (6) and do 6–100 once.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions