Change query metric hash from MD5 of sql + name + loc to Checksum of sql

This commit is contained in:
rbygrave
2021-08-06 11:52:38 +12:00
parent f34e0f5f2b
commit 7ca72a39b1
14 changed files with 36 additions and 108 deletions
@@ -23,6 +23,6 @@ public interface MetaQueryMetric extends MetaTimedMetric {
/**
* Return the hash of the plan.
*/
String getHash();
long getHash();
}
@@ -30,7 +30,7 @@ public interface MetaQueryPlan {
/**
* Return the hash of the plan.
*/
String getHash();
long getHash();
/**
* Return a description of the bind values.
@@ -6,7 +6,7 @@ package io.ebean.meta;
public class MetricData {
private String name;
private String hash;
private long hash;
private String loc;
private String sql;
@@ -30,11 +30,11 @@ public class MetricData {
this.name = name;
}
public String getHash() {
public long getHash() {
return hash;
}
public void setHash(String hash) {
public void setHash(long hash) {
this.hash = hash;
}
@@ -10,7 +10,7 @@ public class QueryPlanInit {
private boolean all;
private Set<String> hashes = new HashSet<>();
private Set<Long> hashes = new HashSet<>();
private long thresholdMicros;
@@ -47,21 +47,21 @@ public class QueryPlanInit {
/**
* Return true if the query plan should be initiated based on it's hash.
*/
public boolean includeHash(String hash) {
return all || hashes.contains(hash);
public boolean includeHash(long sqlHash) {
return all || hashes.contains(sqlHash);
}
/**
* Return the specific hashes that we want to collect query plans on.
*/
public Set<String> getHashes() {
public Set<Long> getHashes() {
return hashes;
}
/**
* Set the specific hashes that we want to collect query plans on.
*/
public void setHashes(Set<String> hashes) {
public void setHashes(Set<Long> hashes) {
this.hashes = hashes;
}
}