Skip to content

Revert in-memory changes when siafile methods fail + panic when applying updates files at runtime to prevent corruption

Christopher Schinnerl requested to merge hardening-siafile-acid-properties into master

MERGE REQUEST

Overview

I tried to find all the methods where we potentially return early in case of an error to make sure we reset the in-memory if an error occurs to prevent the state on disk and in-memory from going out of sync.

Note to reviewers:

  • pls be extra careful that no fields were missed
  • double check that no shallow copies were created which actually don't restore the state

I double checked myself but we need to be extra safe.

This MR also changes createAndApplyTransaction to panic while in the critical section where WAL updates are written to disk but not marked as applied yet.

Checklist

Review and complete the checklist to ensure that the MR is complete before assigned to an approver.

  • All new methods or updated methods have clear docstrings
  • Testing added or updated for new methods
  • Any new packages are added to Makefile and .gitlab-ci.yml
  • API documentation updated for API updates
  • Module README.md updated for changes to workflow
  • Issue added to Sia-UI repo for new supporting features
  • Changelog File Created

Issues Closed

Closes #3962 (closed)

Edited by Christopher Schinnerl

Merge request reports