-
Notifications
You must be signed in to change notification settings - Fork 495
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
[aYPLiTQG] Remove isSchema check to be more performant #4150
Conversation
693a83a
to
7ad6b42
Compare
} else { | ||
// Periodic operations cannot be schema operations, so no need to check that here (will fail as invalid | ||
// query) | ||
if (isPeriodicOperation(stmt)) { |
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.
This check is not fool proof (it's another query string regex). Could we remove this branch?
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.
This is 4.4 extended, so I was just leaving the behaviour as it was to not break anything
Util.inTx(db, pools, threadTx -> { | ||
try (Result result = threadTx.execute(stmt, params)) { | ||
return consumeResult(result, queue, addStatistics, tx, fileName); | ||
} catch (Exception e) { | ||
collectError(queue, reportError, e, fileName); | ||
// APOC historically skips schema operations | ||
if (!e.getMessage().contains("Schema operations on database 'neo4j' are not allowed")) { |
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.
It would be nice if we could use the error code here instead of parsing the message, but I assume it's not possible?
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.
The error code was just for "forbidden" things, which felt kinda broad, I guess once the GQL status codes start we will be able to do that more :D
Util.inTx(db, pools, threadTx -> { | ||
try (Result result = threadTx.execute(stmt, params)) { | ||
return consumeResult(result, queue, addStatistics, tx, fileName); | ||
} catch (Exception e) { | ||
collectError(queue, reportError, e, fileName); | ||
// APOC historically skips schema operations | ||
if (!e.getMessage().contains("Schema operations on database 'neo4j' are not allowed")) { |
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.
on database 'neo4j'
, what about databases that has another name?
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.
Ah yes 🙈
7ad6b42
to
b6d57a9
Compare
cc @loveleif :) |
if (!(e.getMessage().contains("Schema operations on database") | ||
&& e.getMessage().contains("are not allowed"))) { |
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.
YOLO
RunFile is not allowed to run schema operations, in 4.4.0.9 the validation check for this was a regex that was very basic, then in 4.4.0.11 this was updated to be more accurate, what happens is that every query gets run through an explain which checks if the query is a Schema operation, and if it is, it will ignore it.
The problem I see with this is that it will now run this potentially time consuming check for every query in the file as well as actually running the query.
This PR removes this check and instead checks the errors thrown, if a schema error is thrown then it will handle this there to keep old behaviour.