canonical / microceph

Ceph for a one-rack cluster and appliances

Home Page:https://snapcraft.io/microceph

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Race in adding disks

sabaini opened this issue · comments

When adding OSDs on several member nodes at once one can trigger a race in OSD id generation which will manifest with something like:

Error: Failed adding new disk: Failed to record disk: Failed to create "disks" entry: UNIQUE constraint failed: disks.osd

In #95 work was done to make the window for those races smaller, but it's still there -- determining an OSD id in nextOSD() and recording that OSD are happening in two different transactions. The current logic does separate transactions for determining a "free" ID from a DB and Ceph perspective, and subsequently recording that ID in the DB.

I'm tempted to avoid this gap by making the DB the single source of truth for OSD ids and calculating in a single DB transaction, ideally by making the OSD field an AUTOINCREMENT type.

Fixed in #253