~learn.
0:00 / 1:36
Side quest 19 · YouTube

Your upload dies at 1.1 GB. Where does it resume?

transcript

Asha uploads 1 point 8 gigabytes of video on a Mumbai local train. At 1 point 1 gigabytes, the train hits a cutting. No signal.

The naive way: one long request with the whole file. It drops. The request is gone. Start again from zero, on the same train. So open a session instead. Get a URI. Send 8 megabyte chunks. On reconnect, ask the server: how far did you get?

But here's the catch. Her phone had sent 1,104 megabytes. The front end had received 1,102. Storage held 1,100. All true. Which one do you report?

Report 1,104? The file has a 4 megabyte hole. Those bytes never arrived. 1,102? Two megabytes sat in the front end's memory. That's gone. 1,100. Only durable bytes count. Resending a little is harmless.

So one rule. Each chunk is written to storage first. Only then does the stored offset move. It lives in a session table, not a socket. Any front end can answer. Signal's back. Ask for status. The answer is 308, with a range. Resume right there.

Last byte in? A checksum of the whole file must match. Then it's sealed. That original is kept forever. It's the only thing you can't rebuild.

One rule makes resumable uploads correct. The offset moves only after a durable write.

Full breakdown in the lecture.