Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v23.1.x] Fix txn consume group issues leading to undefined behavior #12006

Merged

Commits on Jun 9, 2023

  1. txn: fix incorrect log messages

    (cherry picked from commit 7debd01)
    rystsov authored and vbotbuildovich committed Jun 9, 2023
    Configuration menu
    Copy the full SHA
    6250ee9 View commit details
    Browse the repository at this point in the history
  2. txn: update abort_old_txes to use locks

    An execution of abort_old_txes could span multiple terms so the so the
    method could modify new state assuming it's the old state resulting in
    undefined behavior
    
    (cherry picked from commit f7fc026)
    rystsov authored and vbotbuildovich committed Jun 9, 2023
    Configuration menu
    Copy the full SHA
    a1aa4bd View commit details
    Browse the repository at this point in the history
  3. txn: make group accept term

    Make group accept term to reduce scope of where reset_tx_state is used
    to easier track where the write lock is necessary
    
    (cherry picked from commit 93297d5)
    rystsov authored and vbotbuildovich committed Jun 9, 2023
    Configuration menu
    Copy the full SHA
    3fe916a View commit details
    Browse the repository at this point in the history

Commits on Jul 10, 2023

  1. txn: completely reset group state on term change

    When the consumer group log's term change we replay the whole log to
    reconstruct the state. We used to merge current and the replayed state
    but it's error prone. Reseting the whole txn state to have more deter-
    ministic behavior
    
    (cherry picked from commit 69c5392)
    rystsov committed Jul 10, 2023
    Configuration menu
    Copy the full SHA
    f68ff7b View commit details
    Browse the repository at this point in the history
  2. txn: step down on begin_tx & store_txn_offsets failures

    Transactions in kafka protocol are stateful: the processing of the
    requests depends on the previous commands executed by the same or
    even different producer. It makes the situations when the replica-
    tion fails with the indecisive errors such as timeout dangerous
    because the true state is unknown.
    
    Stepping down to resolve uncertainty by replaying the log
    
    (cherry picked from commit 7ca5707)
    rystsov committed Jul 10, 2023
    Configuration menu
    Copy the full SHA
    adaadce View commit details
    Browse the repository at this point in the history
  3. Revert "txn: update abort_old_txes to use locks"

    Fixes:
     - redpanda-data#11372
     - redpanda-data#11452
     - redpanda-data#11344
    
    This reverts commit f7fc026.
    
    (cherry picked from commit 6d86fc8)
    rystsov committed Jul 10, 2023
    Configuration menu
    Copy the full SHA
    f5b2017 View commit details
    Browse the repository at this point in the history
  4. utils: add units-based attempt-lock interface to rwlock

    (cherry picked from commit 0dabdff)
    rystsov committed Jul 10, 2023
    Configuration menu
    Copy the full SHA
    f8a398c View commit details
    Browse the repository at this point in the history
  5. test: add test for ssx::rwlock

    (cherry picked from commit 45675cc)
    rystsov committed Jul 10, 2023
    Configuration menu
    Copy the full SHA
    f8865d4 View commit details
    Browse the repository at this point in the history
  6. txn: update abort_old_txes to use locks

    An execution of abort_old_txes could span multiple terms so the so the
    method could modify new state assuming it's the old state resulting in
    undefined behavior.
    
    This commit is the rewrite of the reverted f7fc026 in 11474. The pro-
    blem was caused by:
    
      - do_detach_partition got blocked
      - RP ignored blocked do_detach_partition and attempted next op leading
        double registration of the consumer groups ntp
    
    The op was blocked by a deadlock:
    
      - do_abort_old_txes was waiting for read lock while holding _gate
      - do_detach_partition was holding write lock while waiting to the
        gate to be closed
    
    This version doesn't wait for the read lock to become available and exit
    do_abort_old_txes releasing the _gate.
    
    It still isn't clear why RP ignored a blocked op
    
    (cherry picked from commit 0b9b9fb)
    rystsov committed Jul 10, 2023
    Configuration menu
    Copy the full SHA
    15f575f View commit details
    Browse the repository at this point in the history