mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 09:22:49 -05:00
CreateDBCluster registers the new cluster only after the backing container is provisioned, and a cold-cache image pull holds that window open for about ninety seconds in the issue's log — long enough for the CLI's retry to pass the exists-check again and start a second container for the same identifier. Both containers then serve one cluster, with the cluster endpoint wired to one database and the instance endpoint to the other, and no error anywhere. CreateDBInstance has the identical check-then-provision-then-register race. Serialize creates per identifier with a provisioning sentinel: the wrapper claims the identifier before the exists-check and releases it after registration, so a duplicate arriving mid-provision fails fast with the same fault a completed create produces (DBClusterAlreadyExistsFault / DBInstanceAlreadyExists) instead of provisioning again. A failed create releases the identifier on the way out, so a clean retry still works — the failed path registers nothing, so a retained sentinel would wedge the identifier with no resource to delete. Cluster and instance identifiers stay independent namespaces, as in the issue's own reproduction, which provisions both under one name. The reject arm of the issue's suggested fix is deliberate: joining the in-flight create would park the retrying client's connection on the remainder of the pull, and CreateDBCluster is not documented as idempotent-return on AWS either. Closes #2051