-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sai slow logging WIP DO NOT REVIEW OR MERGE #1285
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -250,6 +250,11 @@ public String toString() | |
return root.toString(); | ||
} | ||
|
||
public String toStringRedacted() | ||
{ | ||
return root.toStringRedacted(); | ||
} | ||
|
||
private void warnIfFilterIsATree() | ||
{ | ||
if (!root.children.isEmpty()) | ||
|
@@ -477,20 +482,38 @@ public boolean isSatisfiedBy(TableMetadata table, DecoratedKey key, Row row) | |
|
||
@Override | ||
public String toString() | ||
{ | ||
return toStringInternal(false); | ||
} | ||
|
||
public String toStringRedacted() | ||
{ | ||
return toStringInternal(true); | ||
} | ||
|
||
private String toStringInternal(boolean redacted) | ||
{ | ||
StringBuilder sb = new StringBuilder(); | ||
for (int i = 0; i < expressions.size(); i++) | ||
{ | ||
if (sb.length() > 0) | ||
sb.append(isDisjunction ? " OR " : " AND "); | ||
sb.append(expressions.get(i)); | ||
|
||
if (!redacted) | ||
sb.append(expressions.get(i)); | ||
else | ||
sb.append(expressions.get(i).toStringRedacted()); | ||
|
||
Comment on lines
+502
to
+506
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could use |
||
} | ||
for (int i = 0; i < children.size(); i++) | ||
{ | ||
if (sb.length() > 0) | ||
sb.append(isDisjunction ? " OR " : " AND "); | ||
sb.append("("); | ||
sb.append(children.get(i)); | ||
if (!redacted) | ||
sb.append(children.get(i)); | ||
else | ||
sb.append(children.get(i).toStringRedacted()); | ||
Comment on lines
+513
to
+516
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
sb.append(")"); | ||
} | ||
return sb.toString(); | ||
|
@@ -785,6 +808,16 @@ public boolean equals(Object o) | |
&& Objects.equal(this.value, that.value); | ||
} | ||
|
||
public String toString() | ||
{ | ||
return ""; | ||
} | ||
|
||
public String toStringRedacted() | ||
{ | ||
return "<redacted>"; | ||
} | ||
|
||
Comment on lines
+816
to
+820
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question: Why are we redacting all parameters? Parameter values contain important information about the query. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe we can keep the numbers, I think that the only "privacy sensitive" data are strings or collections/structures that may contain strings. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what happend with query with binding variables ? are they represented here with the actual value ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That sounds like a good idea. I will run it through Pushkala just in case |
||
@Override | ||
public int hashCode() | ||
{ | ||
|
@@ -1046,8 +1079,8 @@ private boolean containsKey(TableMetadata metadata, DecoratedKey partitionKey, R | |
} | ||
} | ||
|
||
@Override | ||
public String toString() | ||
|
||
private String toStringInternal(boolean redacted) | ||
{ | ||
AbstractType<?> type = column.type; | ||
switch (operator) | ||
|
@@ -1074,12 +1107,32 @@ public String toString() | |
default: | ||
break; | ||
} | ||
var valueString = type.getString(value); | ||
if (valueString.length() > 9) | ||
valueString = valueString.substring(0, 6) + "..."; | ||
|
||
String valueString; | ||
if(redacted) | ||
valueString = "<redacted>"; | ||
else | ||
{ | ||
valueString = type.getString(value); | ||
if (valueString.length() > 9) | ||
valueString = valueString.substring(0, 6) + "..."; | ||
} | ||
|
||
return String.format("%s %s %s", column.name, operator, valueString); | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return toStringInternal(false); | ||
} | ||
|
||
@Override | ||
public String toStringRedacted() | ||
{ | ||
return toStringInternal(true); | ||
} | ||
|
||
@Override | ||
protected Kind kind() | ||
{ | ||
|
@@ -1185,9 +1238,24 @@ private boolean isSatisfiedByEq(TableMetadata metadata, DecoratedKey partitionKe | |
|
||
@Override | ||
public String toString() | ||
{ | ||
return toStringInternal(false); | ||
} | ||
|
||
@Override | ||
public String toStringRedacted() | ||
{ | ||
return toStringInternal(true); | ||
} | ||
|
||
private String toStringInternal(boolean redacted) | ||
{ | ||
MapType<?, ?> mt = (MapType<?, ?>)column.type; | ||
return String.format("%s[%s] %s %s", column.name, mt.nameComparator().getString(key), operator, mt.valueComparator().getString(value)); | ||
|
||
if(!redacted) | ||
return String.format("%s[%s] %s %s", column.name, mt.nameComparator().getString(key), operator, mt.valueComparator().getString(value)); | ||
|
||
return String.format("%s[%s] %s %s", column.name, mt.nameComparator().getString(key), operator, "<redacted>"); | ||
} | ||
|
||
@Override | ||
|
@@ -1362,6 +1430,13 @@ public String toString() | |
distanceOperator, FloatType.instance.getString(distance)); | ||
} | ||
|
||
@Override | ||
public String toStringRedacted() | ||
{ | ||
return String.format("GEO_DISTANCE(%s, %s) %s %s", column.name, "<redacted>", | ||
distanceOperator, "<redacted>"); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) | ||
{ | ||
|
@@ -1432,6 +1507,7 @@ public ByteBuffer getValue() | |
return value; | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return String.format("expr(%s, %s)", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1s is a lot.
A laptop can sometimes perform 20-30k SAI queries per second.
This is not unlikely to overflow the buffer size, and also may keep many plans in memory.
Not sure why we need this delay at all.
Could we not trigger the task of processing this queue whenever we insert something to the queue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, especially when I forgot the lower bound check that we should not log anything below let's say 200ms (I think this is the default in DSE, for example).
I believe to reduce the contention? For reference - the DSE ticket I linked in the internal issue.