lieuwex / LirsFS

MIT License
0 stars 0 forks source link

Figure out how to do reads/writes the best #35

Open lieuwex opened 1 year ago

lieuwex commented 1 year ago
    Reading is done using RPC, writing is done via raft, isn't it?

_Originally posted by @lieuwex in https://github.com/lieuwex/DDPS-2/pull/32#discussion_r1047670102_

sholtrop commented 1 year ago

Ah yes, I forgot that we do store write contents in Raft now. There's no other way afaik. So to confirm, the flow will be:

  1. WebDav gets write request, converts it to ClientToNodeOperation::Write and submits it
  2. In response to Write, every node sets the hash and size for that file to NULL and adds an outstanding_write for that file per keeper.
  3. Every keeper node additionally applies the write to its file, then submits NodeToNodeOperation::FileCommitSuccess (or fail if failed) with the new hash
  4. Every node updates the file's hash/size in response to a successful file commit. As there will be multiple FileCommitSuccess'es coming in, a node should write the new hash/size if the current one is NULL. Otherwise, it should check whether they are equal, to detect inconsistency.

Questions that remain:

lieuwex commented 1 year ago
  1. Oh yes I forgot also size should be NULL. Good catch.

Yes that all seems to be correct, and should work.

The open questions are indeed still open.