System Design Atlas

Property rentals and service charge statements

07 / 10Worked example

Critical flow

How can “a lost answer does not generate a second receivable” be proven in the specific case?

The commit of A-39 succeeds; immediately thereafter the connection breaks off.

Starting point A delivery worker processes durably stored commands outside the approval transaction.

Assumptions for the example case

Fictitious design for a house, a completed annual period and a contractually specified area key. The application documents released billings and correction versions; the legal examination of individual costs remains with property management. All quantities, thresholds and operational targets are illustrative assumptions. The signed amount due equals the allocated cost share minus advance payments already accounted for. A separate immutable payment ledger records only additional positive payments received later. Outstanding balance = current amount due minus the sum of these additional payments. A positive balance is the remaining amount due, zero means settled, and a negative balance is a credit equal to its absolute value. Corrections replace the amount due, retain all payments and post only the difference from the previous amount due. They remain permitted after settlement and for credit balances. Actual positive payments are accepted and deduplicated even when they exceed the remaining amount due or arrive after settlement. Advance payments are not counted again in the additional ledger. Refunds are outside this case; a credit documents a balance and does not receivable a payout.

Release against correction

Release against correction · Compare-and-set and loss of response

Release X and correction Y start with expected=3. The first commit sets version 4; the second command gets conflict.

Property management
Settlement API
Contention
Delivery worker
  1. 01 Property management → Settlement APIX · expected = 3 · 2000 cents
  2. 02 Settlement API → ContentionCompare version 3
  3. 03 Settlement API → ContentionDocument + claim + shipment commit
  4. 04 Contention → Settlement APIVersion 4 is permanent
  5. 05 Settlement API · Local processingAnswer to administration is lost
  6. 06 Property management → Settlement APIRepeat X identically
  7. 07 Settlement API → ContentionReading the stored result
  8. 08 Settlement API → Property managementVersion 4 · 2,000 cents
  9. 09 Property management → Settlement APIY · expected = 3
  10. 10 Settlement API → Property managementVersion conflict · No write effect
  11. 11 Delivery worker → ContentionRead committed delivery request

Result: Exactly one version 4 and one demand; the repetition reads the existing result.

The commit point is before the answer. A repetition reads version 4; a competing state expected=3 loses.

Lifelines management, API, inventory, delivery workers. Compare-and-set and joint commit; loss of response thereafter; repeated command reads result.

Commit, response loss and resumption

Before the commit
Property management submits A-39 with version 3. The application protects the version comparison with a lock; the document manifest, receivable and delivery request are stored together.
Response loss
After commit, the response is lost. Repeat of the same key reads version 4; it does not generate a second delivery request.
External service
A missing delivery response remains unclear. Only an authenticated proof for the specific document version ends the delivery request.

A lost response does not create a second receivable.

A lost response does not create a second receivable.

The repeated call reads the stored approval result.

The commit of A-39 succeeds; immediately thereafter the connection breaks off.

The commit point is before the response; therefore, the restart shows version 4 and exactly one delivery request. In the event of a crash before commit, the repeat call does not find an order and may release once; after commit, it delivers the existing result.

Alternative considered
A recalculation can now include other supporting documents.
Trade-off
The client must keep the key until the result.
Reassess
A delivery service without query capability requires a manual matching path.

Try it yourself

Interrupt a release once before commit and once after commit before reply. For both cases, predict what an identical repeat call and the delivery worker will see.

A hint for your attempt

Track the released billing up to the documented result; note the time of the loss of response.

Compare with a possible solution
Before commit
There is neither released version nor change in the amount due or delivery request. The repeat call may complete the process once; the worker does not see a task beforehand.
After commit
Version, amount due and delivery request are available. Replay reads the saved result and does not generate anything else; the worker processes exactly the existing delivery request.

Apply to your project

What decision do you need in your project for a crash after commit?

Step 8: How can “document calculation leaves the lock scope” be proven in the specific case?