summaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/query/profile/OverridableQueryProfile.java
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-10-30 16:31:38 +0200
committerGitHub <noreply@github.com>2021-10-30 16:31:38 +0200
commit1da6754a571bb380cc32d77b7aa76fe5ebaa24b0 (patch)
tree127022f9f9fe999f2db5666312d19d2be39ece82 /container-search/src/main/java/com/yahoo/search/query/profile/OverridableQueryProfile.java
parentd8970d73872e5386f36aaa73e2dc6b0e881069bf (diff)
parentc702f4874ea9f0cb263a3e54471eef5bb1c71d8c (diff)
Merge pull request #19792 from vespa-engine/bratseth/stable-query-profile-idsv7.492.78
Bratseth/stable query profile ids
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/query/profile/OverridableQueryProfile.java')
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/OverridableQueryProfile.java18
1 files changed, 12 insertions, 6 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/OverridableQueryProfile.java b/container-search/src/main/java/com/yahoo/search/query/profile/OverridableQueryProfile.java
index b8de533dfbe..ac0712eeb63 100644
--- a/container-search/src/main/java/com/yahoo/search/query/profile/OverridableQueryProfile.java
+++ b/container-search/src/main/java/com/yahoo/search/query/profile/OverridableQueryProfile.java
@@ -16,12 +16,12 @@ public class OverridableQueryProfile extends QueryProfile {
private static final String simpleClassName = OverridableQueryProfile.class.getSimpleName();
/** Creates an unbacked overridable query profile */
- protected OverridableQueryProfile() {
- this("");
+ protected OverridableQueryProfile(QueryProfileRegistry owner) {
+ this("", owner);
}
- protected OverridableQueryProfile(String sourceName) {
- super(ComponentId.createAnonymousComponentId(simpleClassName), sourceName);
+ protected OverridableQueryProfile(String sourceName, QueryProfileRegistry owner) {
+ super(createAnonymousId(owner), sourceName, owner);
}
@Override
@@ -35,7 +35,8 @@ public class OverridableQueryProfile extends QueryProfile {
@Override
protected QueryProfile createSubProfile(String name, DimensionBinding binding) {
- return new OverridableQueryProfile(getSource()); // Nothing is set in this branch, so nothing to override, but need override checking
+ // Nothing is set in this branch, so nothing to override, but need override checking
+ return new OverridableQueryProfile(getSource(), getOwner());
}
/** Returns a clone of this which can be independently overridden */
@@ -43,7 +44,7 @@ public class OverridableQueryProfile extends QueryProfile {
public OverridableQueryProfile clone() {
if (isFrozen()) return this;
OverridableQueryProfile clone = (OverridableQueryProfile)super.clone();
- clone.initId(ComponentId.createAnonymousComponentId(simpleClassName));
+ clone.initId(createAnonymousId(getOwner()));
return clone;
}
@@ -52,4 +53,9 @@ public class OverridableQueryProfile extends QueryProfile {
return "an overridable query profile with no backing";
}
+ private static ComponentId createAnonymousId(QueryProfileRegistry owner) {
+ return owner != null ? owner.createAnonymousId(simpleClassName)
+ : ComponentId.createAnonymousComponentId(simpleClassName);
+ }
+
}