perf(migration): batch endpoint tags and restore inheritance#15311
Open
AKSHATSPAR wants to merge 1 commit into
Open
perf(migration): batch endpoint tags and restore inheritance#15311AKSHATSPAR wants to merge 1 commit into
AKSHATSPAR wants to merge 1 commit into
Conversation
AKSHATSPAR
force-pushed
the
fix/15124-bulk-migration-tags
branch
from
July 22, 2026 01:56
da71a5e to
16c9792
Compare
AKSHATSPAR
marked this pull request as ready for review
July 22, 2026 05:54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a bug fix for #15124, not a new enhancement.
Description
Addresses #15124.
In the reporter's completed migration of roughly 65,000 Endpoints, the benchmark summary attributed 115,317.36 seconds (99.8% of its measured phase time) to tags. The run needed several restarts, and the reporter identified tag creation as the apparent bottleneck. The command currently copies tags separately for each tagged Endpoint; on a rerun, those writes can also increase Tagulous counters without creating new relationships.
This PR:
bulk_add_tag_mapping;LocationManager._bulk_inherit_tagscall removed by perf(tag inheritance): batch_mode + per-batch bulk during import + reorganize #14877, restoring first-pass product-tag inheritance when it is enabled.Tests
Added three focused migration tests covering:
Local Docker validation:
Controlled comparison
I compared the pre-change and patched commands in separate fresh databases on the same local PostgreSQL 18 instance. The workload contained 1,000 Endpoints, five direct tags per Endpoint (14 unique direct tags), and one inherited product tag. Both runs used
--batch-size 100 --benchmark --query-count.The patched runs had no tag or inheritance mismatches. After the rerun, all 6,000
Location.tagsrows, 1,000Location.inherited_tagsrows, and all 15 Location-tag counters remained correct.This controlled workload is not an exact reproduction of the reporter's 65,194-Endpoint deployment, so it does not establish the same improvement for every tag distribution or at that scale.
Documentation
No documentation change is needed because the command interface and user workflow are unchanged.
Checklist
bugfixbranch.performance/bugfix.