RaasAhsan / sion

Distributed file system for many large files
1 stars 0 forks source link

Ensure consistency of chunks #14

Open RaasAhsan opened 2 years ago

RaasAhsan commented 2 years ago

The failure domain we are interested in is: what happens if a client or storage server shuts down in the middle of an ongoing chunk upload?

Some approaches:

  1. Since the file system is append-only, we can track metadata for each chunk that represents the committed chunk size i.e. the offset in the chunk up to which we know is durable. After a write completes, and before acknowledging success to the client, the metadata should be updated to reflect the new committed offset.
  2. Capture the correct chunk offset in a log file + in-memory.
RaasAhsan commented 2 years ago

Concerning client shutdown in the middle of transfer:

  1. Only commit new chunk length once the client stops sending. Whenever another client writes, they will seek to the previous length and begin writing from there. Note that we can't rely on append mode of files in this situation, so we need to enforce some sort of synchronization while a client is writing.
  2. Set an appropriate maximum size on (short) appends, which depends on pipe buffer size of the system (I don't see a reliable way to determine this or even set it). As long as we receive the full buffer before writing, we can be confident that if the write succeeds, it will be durable, and that the client is no longer sending any more data.