IntermediateAbout 15 min

    Change Data Capture & Event Sourcing

    Read the full article on Substack

    7 min read.

    See dual writes leave a search index out of sync, then fix it by feeding every copy from the database’s change log, and rebuild state by replaying events.

    Think of it this way: A bank keeps one ledger of every deposit and withdrawal. Your balance, your monthly statement and the fraud team’s report are all worked out from that ledger. Nobody updates them separately, so they can be late but never contradict each other.

    User AidleUser Bidle
    Database

    color = green

    Search index

    color = green

    The app writes to the database and then to the search index itself. Two users change the same product at once.

    1/6

    Check your understanding

    Answer from memory before you scroll back up. Pulling an idea out of your head is what makes it stay there.

    Dual writes or change data capture?

    Sort

    Sort each trait into the approach it describes.

    Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.

    Dual writes

    Drop items here

    Change data capture

    Drop items here
    6 pieces left to place

    Quiz

    8 questions
    Question 1 of 8
    Score: 0

    Why can dual writes leave two systems disagreeing?

    Done with this lesson?

    Sign in free to keep your progress, streak and quiz scores.

    Keep going