## Description When the DB is in persistent mode, DB's log files are read back to memory every time after DB restarts. However, some log records might cause the Log Reader's offset to grow larger than the block size.
This PR changed tolerate this corner case by resetting the offset to 0. As each record checks its own checksum during loading, this modification would not introduce data inconsistent issues. Another modification in this PR is optimizing the log writer logic. Instead of multiple file-writes for a single record, we use a temporal vector to hold the whole record and write the complete buffer to file in a single write operation. ## Type of change (select or add applied and delete the others) - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] API change with a documentation update - [ ] Additional test coverage - [ ] Code cleanup or just sync with upstream third-party crates ## How has this been tested? ## Checklist - [x] Fork the repo and create your branch from `master`. - [x] If you've added code that should be tested, add tests. - [x] If you've changed APIs, update the documentation. - [x] Ensure the tests pass (see CI results). - [x] Make sure your code lints/format. You can view, comment on, or merge this pull request online at: https://github.com/apache/incubator-teaclave/pull/587 -- Commit Summary -- * [Fix] Improve log writer and tolerate log reader -- File Changes -- M common/rusty_leveldb_sgx/src/log.rs (18) -- Patch Links -- https://github.com/apache/incubator-teaclave/pull/587.patch https://github.com/apache/incubator-teaclave/pull/587.diff -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/apache/incubator-teaclave/pull/587