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

Fix retry for UniqueConstraintViolation in RouteCreate (v3) #3697

Merged

Commits on Mar 25, 2024

  1. Fix retry for UniqueConstraintViolation in RouteCreate (v3)

    The creation of internal routes depends on finding the next vip_offset.
    When creating multiple routes in parallel, they find the same vip_offset
    and only the very first write operation succeeds. All the others fail
    with a UniqueConstraintViolation error. For this error a retry is
    triggered in the VCAP::CloudController::RouteCreate action (v3).
    
    This retry did not work due to a bug ("undefined local variable or
    method 'user_audit_info'"). Besides fixing this bug a test has been
    added to ensure that the parallel creation of internal routes is
    working.
    
    When running 5 parallel threads and each thread is creating an internal
    route, the following logs are produced:
    
      Duplicate entry '1' for key 'routes.routes_vip_offset_index', retrying
      Duplicate entry '1' for key 'routes.routes_vip_offset_index', retrying
      Duplicate entry '1' for key 'routes.routes_vip_offset_index', retrying
      Duplicate entry '1' for key 'routes.routes_vip_offset_index', retrying
      Duplicate entry '2' for key 'routes.routes_vip_offset_index', retrying
      Duplicate entry '2' for key 'routes.routes_vip_offset_index', retrying
      Duplicate entry '2' for key 'routes.routes_vip_offset_index', retrying
      Duplicate entry '3' for key 'routes.routes_vip_offset_index', retrying
      Duplicate entry '3' for key 'routes.routes_vip_offset_index', retrying
      Duplicate entry '4' for key 'routes.routes_vip_offset_index', retrying
    
    This indicates that all the write operations are being executed at the
    same point in time and only one of them succeeds whereas the others are
    failing, i.e. 4 out of 5. For each retry there is one conflicting route
    less, so the number of errors goes down from 4 to 3 to 2 to 1 until the
    last route could be saved (after 4 retries).
    philippthun committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    a8fe74e View commit details
    Browse the repository at this point in the history