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

Compaction state written even if not used #72

Open
arj03 opened this issue May 19, 2022 · 1 comment
Open

Compaction state written even if not used #72

arj03 opened this issue May 19, 2022 · 1 comment

Comments

@arj03
Copy link
Member

arj03 commented May 19, 2022

I was checking out the latest db2 changes in the browser and things are not working because the compaction module has a few things that needs fixing before it can. The first is stateFileExists() because it uses fs directly. I was working around that, it requires the function to be async, but that seems to be okay. Then I ran into another problem with writeUInt32LE not being available (callstack is save() & stop()). This seems to be because browserify is using an old version of the buffer module. In any case, I was wondering why it was even try to write this file in the first place. I havn't used the API, so I didn't expect this to do anything. Maybe it would be good to change so doesn't write the file if the file doesn't exist in the first place? Just checking my assumptions about this before making changes :)

@staltz
Copy link
Member

staltz commented May 19, 2022

Yes, agreed! About StateFileExists being called at the beginning, it's currently important that it's sync, to prevent race conditions. It's fine if you change it to be async, just be careful about the race conditions (i.e. ssb-db2 compaction-related code running before StateFileExists in AAOL would be a problem).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants