Remix.run Logo
▲ sksksk an hour ago

I get you with needing a ledger, which most banks use.

I'm assuming Revolut do as well, but this engineer wasn't aware. Or perhaps it was a different question they thought they were asking, or maybe a misunderstanding.

But the two ATMs problem would be solved by securing a lock on the database before proceeding with the transaction?

▲mrkeen an hour ago | parent | next [-]

He suggester that they had both. My question was what to do when they disagree, and he wasn't able to either conceive of the 'two sources of truth problem' or wasn't able to suggest a solution. He pushed back saying: if they disagree then you've got buggy code, and that your job is to not write buggy code. "That's why we test". "For race conditions?" etc. etc.

Who owns the database in your locked example?

▲sksksk an hour ago | parent [-]

Revolut would own the database in my example.

How would a ledger work without having some kind of lock, how would you prevent a negative balance?

When someone checks their balance, would you to retrieve every transaction from the ledger and calculate the current balance?

▲ergl an hour ago | parent | prev [-]

> But the two ATMs problem would be solved by securing a lock on the database before proceeding with the transaction?

You can also let an overdraft occur. Now the user ows the bank some money and you can charge them interest for their debt.