Skip to content

Atomic transactions go to default database by default #19644

Closed
@arthanson

Description

@arthanson

Deployment Type

Self-hosted

NetBox Version

v4.3.1

Python Version

3.12

Steps to Reproduce

This is linked to the branching issue (netboxlabs/netbox-branching#271)

  1. Create and activate new branch.
  2. Select IPAM-> prefixes and bulk import
  3. put your bulk import data.
  4. In the middle of data make a mistake that the import would fail (lets say define wrong VRF)
    The same applies to some other objects where name/item uniqueness is not being checked (VRFs, Chassis and etc.).

Data set for import

prefix;status;vrf;vlan_group
192.168.100.0/22;active;abc;mygroup1
10.113.128.128/29;active;dbc;mygroup1
10.116.0.129/29;active;efg;mygroup1
10.1.29.0/24;active;ghj;mygroup1

Before you try this import:

  • make sure you have VLAN group "mygroup1" existing.
  • make sure you have all VRFs existing.
  • Make sure all prefixes do NOT exist.

When I try to do import in such conditions, I get following error:

Record 3 prefix: 10.116.0.129/29 is not a valid prefix. Did you mean 10.116.0.128/29?
But problem is that import for record 1 and 2 was still performed.

The root issue here is we are doing with transaction.atomic() which is always going to the default branch so the rollback in the case of errors is not working correctly.

Expected Behavior

None of the data should imported if there are any errors on data.

Observed Behavior

  • If the main branch is used then import failure behaves properly: none of data was imported

  • If doing that on any other branch:
    Data up to the the failing line is imported.
    Error where the failure occurred is shown for short time and then disappears.
    It is not clear which part of data import was successful (especially if you miss that error popup).
    If you try to load data again you get duplicate records (in this case prefixes) again till the failing line.

Metadata

Metadata

Assignees

Labels

severity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions