pasttheabstractEdition 4 · week of Oct 17

Four prompts, in order. Each builds on the last. Write as you go; your notes stay on this device and work offline.

  1. Rebuild it

    Build a toy GFS in one process: a master object that maps /logs/clicks to its chunks, three chunkserver objects S1, S2 and S3 that each keep a copy of the last chunk as a byte array, and a client library with record append. Scale it down so it runs instantly: 64-byte chunks and records of at most 16 bytes, a quarter of a chunk as in the paper. Make S1 the primary. Follow section 3.3: the client pushes the record to all three copies, then asks S1 to append; S1 picks the offset, pads the chunk and sends the client to the next chunk if the record would not fit, and otherwise tells S2 and S3 to write at its offset. Let a test make any copy fail a write, and have the client retry on failure. Give every record a checksum and a unique ID, and write J, a reader that skips bad checksums and repeated IDs. Test it two ways. First, script the story: R1 and R2 land one after the other, S3 fails R2, the retry lands after them, and J, reading any one copy, returns R1 and R2 exactly once. Then run a few thousand random seeds with many writers and random failures, and after every run assert that each append that reported success sits whole at the same offset on all three copies, and that J returns every acknowledged record once, from whichever copy it reads.

  2. Challenge it

    Section 3.1 says the master can safely make a new primary once the old lease has expired. That assumes the master and the old primary agree on when 60 seconds are up. Suppose S1 holds the lease on chunk 2 at version 5, the link between the master and S1 drops while W1 can still reach every copy, and S1's clock runs slow, so S1 believes it has 10 seconds left after the master's 60 seconds are over. The master grants S2 a new lease and raises S2 and S3 to version 6. Now W1, using its cached answer, sends an append to S1, and W2, with a fresh answer from the master, sends one to S2. Using sections 3.1 and 4.5, say whether anything stops S3 from taking offsets from both primaries, and what chunk 2 looks like if nothing does. Then say what check you would add, and how much clock drift (the rate at which one machine's clock gains or loses time against another's) the design can then tolerate.

  3. Stress it

    The paper never times a master failover. Try one: during the evening's busiest appends, the master's machine dies, and assume the monitoring outside GFS takes two minutes to start a new master elsewhere from the replicated log (section 5.1.3). Walk the click log through it. How long can W1 and W2 keep appending to chunk 2, given that lease extensions come from the master? What happens when chunk 2 fills and they need chunk 3? What can J still read, and who answers its lookups if its cached locations have expired? Then use section 6.2.2's restart times to say how long after the crash the first append succeeds again, and which of these steps you would shorten first.

  4. Compare it

    Put GFS next to the Raft edition. Raft keeps copies in step by electing a leader for each term, its numbered period of leadership, and commits an entry once a majority of servers have it. GFS's record append succeeds only when every copy has written the record, and its master is replaced from outside. First, map the parts: what in GFS plays the role of Raft's leader, its term and a follower whose log is behind? Then rerun the story's failed append in Raft: S1 leads a three-server group, and S3's write of R2 times out. Does W2 retry, does R2 end up duplicated, and what does S3 hold afterwards? Finally, say what GFS would gain by running its master replicas as a Raft group instead of relying on outside monitoring, and what the click log would lose if every append went through Raft.