Skip to content

feat: add atomic-update bug scenario #1

Description

@jaeyeopme

Shared counters (like-counts, stock quantities, view counters) lose updates under concurrent writes when the application reads, increments in memory, and writes back. The classic read-modify-write race.

This module should reproduce lost updates on a shared counter, then fix them using compare-and-swap at the SQL level (UPDATE ... SET count = count + 1 or CAS with expected-value checks) — no explicit row locking needed.

What to build:

  • Baseline test showing lost updates with naive read-modify-write
  • At least 3 strategies: naive (buggy), SQL-level atomic increment, CAS with retry
  • k6 benchmarks comparing throughput under contention
  • Correctness invariant: final counter value == number of successful increments

Satisfies AC-1 through AC-5 from the PRD. Module follows the standard structure: docs/, compose.yml, integration tests extending AbstractIntegrationTest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions