GGraziadei opened a new pull request, #2133: URL: https://github.com/apache/stormcrawler/pull/2133
Fixes #2130. `MetadataTransfer.filter()` runs for every outlink. For each wildcard key (e.g. `cookie.*`) it called `Metadata.keySet(prefix)`, which streams over all the metadata keys and collects a new `Set`, then copied each matching key through `getValues()`/`setValues()` with key normalisation on both sides. ### Change The configured keys are compiled once into exact keys and wildcard prefixes (cached per set, rebuilt if a subclass modifies the set), and the matching entries are copied in a single pass over the metadata map. Value arrays are shared as before, keys are already normalised. Micro-benchmark on a 12-key metadata with 3 wildcards and 2 exact keys: ~780 ns to ~265 ns per outlink. ### Tests `MetadataTransferTest` gains a case checking that wildcard prefixes are matched case-insensitively and selectively (`Cookie.*` matches `cookie.id` but not `cookies`), existing cases unchanged. --- ### For all changes - [x] Is there a issue associated with this PR? Is it referenced in the commit message? - [x] Does your PR title start with `#XXXX` where `XXXX` is the issue number you are trying to resolve? - [x] Has your PR been rebased against the latest commit within the target branch (typically main)? - [x] Is your initial contribution a single, squashed commit? - [x] Is the code properly formatted with `mvn git-code-format:format-code -Dgcf.globPattern="**/*" -Dskip.format.code=false`? ### For code changes - [x] Have you ensured that the full suite of tests is executed via `mvn clean verify`? - [x] Have you written or updated unit tests to verify your changes? - [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? (no new dependencies) - [x] If applicable, have you updated the LICENSE file, including the main LICENSE file? (not applicable) - [x] If applicable, have you updated the NOTICE file, including the main NOTICE file? (not applicable) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
