Replies: 1 comment
-
Yes - don't run stress tests :-) Under such situations, you will get duplicates. This is because Netbox doesn't always use database unique constraints; it uses Django model-level checks, which are inherently subject to races. They basically do a read to check uniqueness, followed by a write. (Aside: it would be possible for Netbox to use postgres unique indexes, even for selective uniqueness like per-VRF uniqueness, by taking advantage of the fact that a composite index is only unique if all its elements are not-NULL) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have netbox (v2.10.4) configured with VRF unique set, global unique not set.
Our client uses go-netbox. The process first asks for available IPs with
IpamPrefixesAvailableIpsRead
- We then select randomly from the list, and attempt to create an IP withIpamIPAddressesCreate
- If we get an error, we repeat both steps a few times before giving up.Under stress testing, simulating 90 sessions at once requesting IP addresses - we've managed to get the occasional duplicate IP in the same VRF.
Does anyone have any suggestions? We can't manually create duplicate IPs via the UI, so clearly we're exercising some race condition.
Beta Was this translation helpful? Give feedback.
All reactions