ChinmaySKulkarni commented on a change in pull request #710: PHOENIX-5673 : The
mutation state is silently getting cleared on the …
URL: https://github.com/apache/phoenix/pull/710#discussion_r383444422
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
##########
@@ -2166,4 +2169,26 @@ private void
throwIfUnallowedUserDefinedFunctions(Map<String, UDFParseNode> udfP
}
}
+ /**
+ * Check if the statement is a DDL and if there are any uncommitted
mutations Throw or log the
+ * message
+ */
+ private void checkIfDDLStatementandMutationState(final CompilableStatement
stmt,
+ MutationState state) throws SQLException {
+ boolean throwUncommittedMutation =
+ connection.getQueryServices().getProps().getBoolean(
+ QueryServices.PENDING_MUTATIONS_DDL_THROW_ATTRIB,
+ QueryServicesOptions.DEFAULT_PENDING_MUTATIONS_DDL_THROW);
+ if (stmt instanceof MutableStatement && !(stmt instanceof DMLStatement)
+ && state.getNumRows() > 0) {
+ if (throwUncommittedMutation) {
+ throw new SQLExceptionInfo.Builder(
+
SQLExceptionCode.CANNOT_PERFORM_DDL_WITH_PENDING_MUTATIONS).build()
+ .buildException();
+ } else {
+ LOGGER.info(
Review comment:
Can we change this to `warn` level?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services