Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix retry for UniqueConstraintViolation in RouteCreate (v3) (#3697)
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).
- Loading branch information