Project

General

Profile

Actions

Bug #9831

closed

[API] Fix ensure_unique_name so finding the right N for "original name (N)" does not take N database queries

Added by Tom Clegg over 7 years ago. Updated over 7 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
API
Target version:
Story points:
0.5

Description

Current code uses 6 seconds of database time to save this tiny collection:

{"method":"POST","path":"/arvados/v1/collections","format":"*/*","controller":"arvados/v1/collections","action":"create","status":200,"duration":13288.24,"view":0.29,"db":6257.93,"params":{"collection":"{\"owner_uuid\":\"4xphq-tpzed-8i6n6lswodedghy\",\"name\":\"diagnostics hash output\",\"portable_data_hash\":\"147249c1018bc6803b7b0fe26050b558+54\",\"manifest_text\":\". 2e4088cf8ddfd7eed5700fd1e9c946ae+87+A4049ccbde97ae393d6fa984031c8c3dc98feda78@57cdb846 0:87:md5sum.txt\\n\"}","ensure_unique_name":"true"},"@timestamp":"2016-08-22T18:24:20Z","@version":"1","message":"[200] POST /arvados/v1/collections (arvados/v1/collections#create)"}

Proposed solution

If the provided name is in use:
  • Use "name (timestamp)" where timestamp is rfc3339 with milliseconds.
  • If the chosen name is already taken due to a race with a concurrent request, try again, but give up after 10 attempts.

Subtasks 1 (0 open1 closed)

Task #10873: Review 9831-faster-unique-nameResolvedRadhika Chippada01/12/2017Actions
Actions

Also available in: Atom PDF