Efficient storage: how we went down from 50 PB to 32 PB

Metadata storage

  1. The system receives a request to delete an email.
  2. The system checks the email indexes.
  3. The system can see there’s an attachment (SHA-1).
  4. The system sends a request to delete a file.
  5. A crash occurs, so the email doesn’t get deleted.

File upload

  • inc(sha1, magic) — increments the counter. If a file doesn’t exist, returns an error. Let’s recall we also need a magic number that helps prevent incorrect file deletions.
  • upload(sha1, magic) — should be called if inc has returned an error, which means this file doesn’t exist and must be uploaded.
  • dec(sha1, magic) — called if a user deletes an email. The counter is decremented first.
  • GET /sha1 — downloads a file via HTTP.
decrement (sha1, magic){
counter--
current_magic –= magic

if (counter == 0 && current_magic == 0){
move(sha1, space1)
}
}

Valkyrie

Result

P.S. About SHA-1

--

--

CTO mail and portal services at Mail.ru

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store