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

sql: parser and optimizer support FOR {UPDATE,SHARE} SKIP LOCKED #85720

Merged
merged 2 commits into from
Aug 10, 2022

Commits on Aug 9, 2022

  1. sql: enable the skip-locked wait policy

    Now that KV support this, we can pass the wait policy through.
    
    Fixes cockroachdb#40476
    
    Release note (sql change): SELECT ... FOR {UPDATE,SHARE} SKIP LOCKED
    is now supported. The option can be used to skip rows that cannot be
    immediately locked instead of blocking on contended row-level lock
    acquisition.
    nvanbenschoten authored and rytaft committed Aug 9, 2022
    Configuration menu
    Copy the full SHA
    338d7fe View commit details
    Browse the repository at this point in the history
  2. opt: optimizer updates for support of SKIP LOCKED

    For queries using SELECT FOR {SHARE,UPDATE} SKIP LOCKED, we need to disable
    optimizations that depend on preserved-multiplicity consistency of
    tables. When SKIP LOCKED is used, we will no longer use optimizations that
    assume:
    - a PK row exists for every secondary index row
    - a PK row exists for every referencing FK (if the PK table uses SKIP LOCKED)
    
    One result of this change is that we will no longer push limits into index
    joins if the primary index uses locking wait policy SKIP LOCKED.
    
    This commit also disallows use of multiple column families in tables scanned
    with SKIP LOCKED, since it could result in returning partial rows.
    
    Release note: None
    
    Co-authored-by: Michael Erickson <[email protected]>
    rytaft and michae2 committed Aug 9, 2022
    Configuration menu
    Copy the full SHA
    bfbaf64 View commit details
    Browse the repository at this point in the history