Repair Ticket Confirmation Across Database State and Redis Holds

Quick Overview

Repair ticket confirmation with exact validation errors, atomic inventory updates, Redis hold deletion, expiry-race protection, and reliable sellout checks.

Repair Ticket Confirmation Across Database State and Redis Holds

Company: Adobe

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Online Assessment

Repair a ticket-confirmation flow so a held ticket becomes confirmed while inventory counters, hold expiry, Redis hold state, and event sellout state remain consistent. The ticket must belong to the current user, be in `held` status, and have an unexpired hold. Return 404 with `ticket not found` for a missing ticket or ownership mismatch; 400 with `only held tickets can be confirmed` for another status; and 400 with `ticket hold has expired` for expiry. On success, set status to `confirmed`, clear `hold_expires_at`, decrement the section's held count, increment its sold count, delete the actual Redis hold key, and check whether the event is sold out. Report success only after these required actions, including actual Redis deletion and the sellout check, have completed. ### Clarifying Questions to Ask - Does expiry at exactly the current time count as expired? Assume yes. - Can a hold-expiration worker run concurrently with confirmation? - Which store is authoritative if Redis deletion fails after the database commits? ```hint Constructing a key is not deleting it Trace both the state transition and the actual Redis command, then consider which changes can share a transaction. ``` ### What a Strong Answer Covers - Ownership-first validation and the exact required error responses. - Locked/conditional database transition with atomic counter updates. - Real Redis deletion after durable state change and a retryable consistency mechanism. - A sellout check that is safe under concurrent confirmations. ### Follow-up Questions - How would you prevent an expiry worker from undoing a confirmed ticket? - What happens if the process crashes between the database commit and Redis deletion?

Overview: Repair ticket confirmation with exact validation errors, atomic inventory updates, Redis hold deletion, expiry-race protection, and reliable sellout checks.

Read the full Adobe Software Engineer interview experience this question came from

Adobe logo
Adobe
Jul 24, 2026
mediumSoftware EngineerOnline AssessmentSoftware Engineering Fundamentals
1
0

Repair a ticket-confirmation flow so a held ticket becomes confirmed while inventory counters, hold expiry, Redis hold state, and event sellout state remain consistent.

The ticket must belong to the current user, be in held status, and have an unexpired hold. Return 404 with ticket not found for a missing ticket or ownership mismatch; 400 with only held tickets can be confirmed for another status; and 400 with ticket hold has expired for expiry.

On success, set status to confirmed, clear hold_expires_at, decrement the section's held count, increment its sold count, delete the actual Redis hold key, and check whether the event is sold out. Report success only after these required actions, including actual Redis deletion and the sellout check, have completed.

Clarifying Questions to Ask Guidance

  • Does expiry at exactly the current time count as expired? Assume yes.
  • Can a hold-expiration worker run concurrently with confirmation?
  • Which store is authoritative if Redis deletion fails after the database commits?

What a Strong Answer Covers Guidance

  • Ownership-first validation and the exact required error responses.
  • Locked/conditional database transition with atomic counter updates.
  • Real Redis deletion after durable state change and a retryable consistency mechanism.
  • A sellout check that is safe under concurrent confirmations.

Follow-up Questions Guidance

  • How would you prevent an expiry worker from undoing a confirmed ticket?
  • What happens if the process crashes between the database commit and Redis deletion?