IPAM migration 0072 not performant with large number of existing prefixes #10672

Closed
opened 2025-12-29 21:34:34 +01:00 by adam · 2 comments
Owner

Originally created by @jeremystretch on GitHub (Jan 20, 2025).

Originally assigned to: @jeremystretch on GitHub.

Deployment Type

NetBox Cloud

NetBox Version

v4.2.2

Python Version

3.10

Steps to Reproduce

  1. Create a large number of prefixes (e.g. 20,000) in a previous NetBox release.
  2. Upgrade to NetBox v4.2.0 or later.

Expected Behavior

The database migrations should complete within a reasonable amount of time.

Observed Behavior

The 0072_prefix_cached_relations migration within the ipam app can take an excessively long time to complete when there exist many thousands of prefixes in the database. This is due to a missing batch_size parameter in the bulk_update() operation.

Originally created by @jeremystretch on GitHub (Jan 20, 2025). Originally assigned to: @jeremystretch on GitHub. ### Deployment Type NetBox Cloud ### NetBox Version v4.2.2 ### Python Version 3.10 ### Steps to Reproduce 1. Create a large number of prefixes (e.g. 20,000) in a previous NetBox release. 2. Upgrade to NetBox v4.2.0 or later. ### Expected Behavior The database migrations should complete within a reasonable amount of time. ### Observed Behavior The [`0072_prefix_cached_relations`](https://github.com/netbox-community/netbox/blob/main/netbox/ipam/migrations/0072_prefix_cached_relations.py) migration within the `ipam` app can take an excessively long time to complete when there exist many thousands of prefixes in the database. This is due to a missing `batch_size` parameter in the `bulk_update()` operation.
adam added the type: bugstatus: acceptedseverity: medium labels 2025-12-29 21:34:34 +01:00
adam closed this issue 2025-12-29 21:34:34 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jan 20, 2025):

I've found a similar issue with two other v4.2 migrations affecting clusters and circuit terminations.

@jeremystretch commented on GitHub (Jan 20, 2025): I've found a similar issue with two other v4.2 migrations affecting clusters and circuit terminations.
Author
Owner

@tyler-8 commented on GitHub (Jan 21, 2025):

Glad to see this as my environment has 50K+ prefixes and 12K+ circuits w/terminations.

@tyler-8 commented on GitHub (Jan 21, 2025): Glad to see this as my environment has 50K+ prefixes and 12K+ circuits w/terminations.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10672