Snapshot Isolation | Systems Design Interview: 0 to 1 with Google Software Engineer

Поделиться
HTML-код
  • Опубликовано: 27 янв 2025

Комментарии • 62

  • @NarendraMandalapu-p6g
    @NarendraMandalapu-p6g 8 месяцев назад +9

    thank you jodron. Best content in the internet for distributed systems. hoping to pass the interview tomorrow. I covered most of your videos :). Passing Good karma to you

    • @jordanhasnolife5163
      @jordanhasnolife5163  8 месяцев назад +11

      Best of luck, I believe you'll pass if you lern too spel bettur

    • @narendrachukka
      @narendrachukka 8 месяцев назад +1

      @@jordanhasnolife5163 hello jodron. Jokes apart, amazing content!

    • @hrithikbabbar5721
      @hrithikbabbar5721 2 месяца назад +1

      ​@@jordanhasnolife5163 jodron sounds transformerish name

  • @nishanthprince
    @nishanthprince 5 месяцев назад +4

    Bro is smart, funny and humble. W !

  • @ryan-bo2xi
    @ryan-bo2xi Год назад +3

    " i am a happy guy" .. i am repeating this to myself.

  • @hinata4661
    @hinata4661 11 месяцев назад +2

    At 2:45 you said writes do not block reads. Reads and write do block each other when using locks. Please correct me if I am missing something.

    • @jordanhasnolife5163
      @jordanhasnolife5163  11 месяцев назад +1

      You're right that a write would block reads, thanks

  • @susantaghosh504
    @susantaghosh504 Год назад +3

    hey Jordan, your videos are super helpful

  • @farce_knight9548
    @farce_knight9548 6 месяцев назад +2

    Great stuff, man 🐐

  • @business_central
    @business_central 2 дня назад +2

    can anyone enlighten me about the last example ? If we real all values from snapshot 15 and before, wouldn't the total value be different than 1 Million, and we will have an inconsistent read ?

    • @jordanhasnolife5163
      @jordanhasnolife5163  День назад +1

      The point here is just that when we make a read at a specific timestamp, and read many rows at once, we will see the DB in a consistent state.
      If we read many rows at once using different timestamps than we can expect to see things in an inconsistent state.

  • @giteshkhanna2633
    @giteshkhanna2633 28 дней назад +1

    Feels like a lot of stuff that the database needs to store per row then. I'm hoping there would be ways to trim older transactions per row, otherwise running the find operation at time T -- even if logarithmic using binary search, could be expensive both in memory requirements + time complexity.
    Very interesting though! Thanks for your content man.

    • @jordanhasnolife5163
      @jordanhasnolife5163  17 дней назад

      Yep! You can drop old versions of data as needed/do compaction

  • @haydencordeiro
    @haydencordeiro 2 года назад +1

    Amazing content as usual

  • @JLJConglomeration
    @JLJConglomeration 8 месяцев назад +1

    So it seems to be a tradeoff of never locking on reads, but reads may be slower since we now have to look at transaction history per row?

    • @jordanhasnolife5163
      @jordanhasnolife5163  8 месяцев назад

      Reads should still be pretty fast, we now have to store more data, basically all the transaction history of each row. Plus, snapshot isolation is still not perfectly serializable.

  • @zhonglin5985
    @zhonglin5985 10 месяцев назад +1

    The trick for snapshot isolation is storing the old values, which looks same as what we did for read committed, which also stores old values. What's the difference?

    • @jordanhasnolife5163
      @jordanhasnolife5163  10 месяцев назад +2

      In snapshot isolation, we store many old values, as opposed to just the most recent one in read committed isolation.

  • @VedanshBansal-y8f
    @VedanshBansal-y8f 7 месяцев назад +2

    Hi Jordan, So I was doing some readin about the differences between read committed isolation and snapshot isolation, and there was something that I couldn't fully understand.
    It said that Read committed isolation doesn't check conflicts at the commit time but whereas snapshot isolation does that. A bit unclear to me, hope you could help!

    • @jordanhasnolife5163
      @jordanhasnolife5163  7 месяцев назад +4

      I'm not really sure what you mean by conflicts in this sense.
      Read committed isolation will just ensure you aren't going to read any uncommitted data.
      Snapshot isolation will just ensure that if you read multiple rows, it was after one distinct transaction time, and you wouldn't ever see the database in a state where a transaction was only partially completed.

  • @cg-1322
    @cg-1322 Год назад +4

    I can’t believe you left out Kim

  • @jayshree7574
    @jayshree7574 11 месяцев назад +1

    amazing content so easy to understand by the kardashian reference, i have msft interview in 2 days

  • @ysh9419
    @ysh9419 8 дней назад +1

    is the snapshot taking the old values or new value? t1:100 means 100is the old value before transaction or new value after the transaction? thx

    • @jordanhasnolife5163
      @jordanhasnolife5163  7 дней назад

      The new values. t1:100 means transaction 1 is writing the value 100.

  • @rahullingala7311
    @rahullingala7311 Год назад +1

    So this means to read a value, we should not just read the row, but also the write ahead logs.
    How bad is this overhead?
    How do we know for which row we should even look into the write ahead logs?

    • @jordanhasnolife5163
      @jordanhasnolife5163  Год назад

      Not sure what you mean by this. In snapshot isolation, we store multiple values with their transaction number where we would typically store just one, and read from there.

    • @rahullingala7311
      @rahullingala7311 11 месяцев назад

      @@jordanhasnolife5163 I see, got it

  • @KratosProton
    @KratosProton 2 года назад +4

    Description 🗿

  • @dibll
    @dibll Год назад +1

    for Snapshot Isolation to be effective the read part needs to happen as part of some transaction, right? I can't just use multiple read statements without enclosing them in begin and end transactions block.

  • @hardikmenger4275
    @hardikmenger4275 2 года назад +2

    Is this a feature in normal eventually consistent databases like dynamodb or has to implemented bh the user? I hope the answer is the first thing.

    • @jordanhasnolife5163
      @jordanhasnolife5163  2 года назад

      This is one of those things that would be built into the database. Not sure if it's in dynamo truthfully

    • @hardikmenger4275
      @hardikmenger4275 2 года назад +1

      Thanks for clearing that out. I just wanted to suggest that you should share your videos on linkedin in “how would you solve this problem kinda format” with a link to the video it might help a lot.

    • @jordanhasnolife5163
      @jordanhasnolife5163  2 года назад +4

      @@hardikmenger4275 I appreciate the suggestion! While I may one day do this, I don't want to share on Linkedin just yet as I don't want people to know IRL finding out about these haha - I say too much dumb stuff

  • @chaitanyatanwar8151
    @chaitanyatanwar8151 16 дней назад +1

    Thanks you!

  • @Spreadlove5683
    @Spreadlove5683 Год назад +1

    So when do transactions run concurrently here? And when do transactions need to wait for a different transaction to complete?

    • @jordanhasnolife5163
      @jordanhasnolife5163  Год назад

      There's no locking in snapshot isolation, you're basically just guaranteed to be able to make reads from a consistent snapshot.

    • @Spreadlove5683
      @Spreadlove5683 Год назад +1

      @@jordanhasnolife5163 I really appreciate you answering questions on here. What about when other isolation level transactions interact with a snapshot isolation transaction?

    • @jordanhasnolife5163
      @jordanhasnolife5163  Год назад

      @@Spreadlove5683Not quite sure what you mean by this truthfully - typically databases will use one style of isolation at a time

    • @Spreadlove5683
      @Spreadlove5683 Год назад

      @@jordanhasnolife5163 Well, I'm not speaking from experience, but everything I read online says multiple transactions from more than one isolation level can run concurrently.

  • @StellasAdi18
    @StellasAdi18 2 года назад +1

    Curious, in distributed systems how do we generate monotonically increasing number for snapshot? Via Zookeeper type system?

    • @jordanhasnolife5163
      @jordanhasnolife5163  2 года назад +2

      Eventually that's how you'd do it yeah. But for the sake of a single node, just using a write ahead log is sufficient.

  • @Rahul-pr1zr
    @Rahul-pr1zr 10 месяцев назад +1

    Do all databases which avoid this race condition use Write Ahead Log?

    • @jordanhasnolife5163
      @jordanhasnolife5163  10 месяцев назад

      I guess they wouldn't have to but the write ahead log is very important for achieving atomicity and general fault tolerance

    • @Rahul-pr1zr
      @Rahul-pr1zr 10 месяцев назад

      @@jordanhasnolife5163 If they don't do it then do they store all transactions corresponding to individual entities/users because it seemed like that's how snapshots were being taken?

  • @Sranju23
    @Sranju23 11 месяцев назад +1

    haha, Keeping up with the Kardashians 😂

  • @abhishekraparti5691
    @abhishekraparti5691 8 месяцев назад +1

    subbing, so you better beat the tiktok girl .

  • @scottyjacobson4655
    @scottyjacobson4655 10 месяцев назад +2

    lol holy shit that israel palestine joke will age worse year by year

  • @tehkokhoe
    @tehkokhoe 3 месяца назад +1

    Kim fell off