Update hrw handling of geo DB files to allow varying mmdb across rules.#13025
Draft
cmcfarlen wants to merge 3 commits intoapache:masterfrom
Draft
Update hrw handling of geo DB files to allow varying mmdb across rules.#13025cmcfarlen wants to merge 3 commits intoapache:masterfrom
cmcfarlen wants to merge 3 commits intoapache:masterfrom
Conversation
Contributor
Author
|
[approve ci autest 1 2] |
Contributor
Author
|
We'll have to fix this another way as this breaks the fix for running plugins. Converting to draft. |
Replace the single global geo DB handle with a cache of handles keyed by path, allowing different remap rules to use different MMDB files via --geo-db-path. The handle is threaded through RulesConfig -> Resources -> ConditionGeo::get_geo_*() methods. The cache deduplicates when multiple rules share the same path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
This last commit handles the geo db init completely differently, but avoids the call_once issue and allows for rules to vary the mmdb file used. |
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.
PR #12855 reintroduced a bug that would cause remap rules with header_rewrite plugins configured with mmdb files to never load the mmdb file. This is because the call_once utilitized to initialize the file is a global to the plugin, so applies to every remap instance. This means the first remap instance to load the mmdb will also set it for every other remap instance. If you call
call_oncewithout a path, then any remap instances that call mmdb after will silently fail to load.See $11812 and #12126
Edit:
I decided to try my idea for better handling of mmdb files. The last commit of this PR does just that and allows remap rules with hrw to specify different geo db files rather than the current "first wins" approach. It also avoids the call_once issue that has cause initialization issues in the past.