-
Notifications
You must be signed in to change notification settings - Fork 3.8k
CASSANDRA-16703 Exception thrown by custom QueryHandler constructor i… #1096
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
Conversation
chicobento
left a comment
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.
Thanks for working on this issue. I just added some minor comments.
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.
In our case, the exception thrown by the QueryHandler is a cassandra ConfigurationException, which has nested exception that gives valuable information to the user.
In that sense, I'd recommend to pass the whole exception to the logger rather than just the message, like:
logger.error("Cannot use class {} as query handler ({})", customHandlerClass, e);
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.
done
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.
Since the contextualized exception is already being logged above and the root cause is well known, I think quiet parameter could be true, otherwise it will print the stackTrace to System.err and to the logger.error "JVM state determined to be unstable. Exiting forcefully due to:" which is not really necessary in this case.
Overall, this is how Im currently handling this situation in my custom query handler:
MyQueryHandler() {
try {
configure();
} catch (ConfigurationException e) {
log.error("Error registering MyQueryHandler", e);
JVMStabilityInspector.killCurrentJVM(e, true);
}
}
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.
done
this is the output I get:
ERROR [main] 2021-07-01 16:16:33,552 ClientState.java:103 - Cannot use class org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler2 as query handler
org.apache.cassandra.exceptions.ConfigurationException: Unable to find QueryHandler class 'org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler2'
at org.apache.cassandra.utils.FBUtilities.classForName(FBUtilities.java:720)
at org.apache.cassandra.utils.FBUtilities.construct(FBUtilities.java:753)
at org.apache.cassandra.service.ClientState.<clinit>(ClientState.java:98)
at org.apache.cassandra.cql3.QueryProcessor$InternalStateInstance.<init>(QueryProcessor.java:129)
at org.apache.cassandra.cql3.QueryProcessor$InternalStateInstance.<clinit>(QueryProcessor.java:123)
at org.apache.cassandra.cql3.QueryProcessor.internalQueryState(QueryProcessor.java:174)
at org.apache.cassandra.cql3.QueryProcessor.prepareInternal(QueryProcessor.java:312)
at org.apache.cassandra.cql3.QueryProcessor.executeInternal(QueryProcessor.java:322)
at org.apache.cassandra.db.SystemKeyspace.checkHealth(SystemKeyspace.java:973)
at org.apache.cassandra.service.StartupChecks$10.execute(StartupChecks.java:442)
at org.apache.cassandra.service.StartupChecks.verify(StartupChecks.java:132)
at org.apache.cassandra.service.CassandraDaemon.runStartupChecks(CassandraDaemon.java:487)
at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:262)
at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:763)
at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:887)
Caused by: java.lang.ClassNotFoundException: org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler2
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.apache.cassandra.utils.FBUtilities.classForName(FBUtilities.java:716)
... 14 common frames omitted
Process finished with exit code 100
|
LGTM, thanks a lot for fixing this issue. |
|
Committed into cassandra-3.0 at eadb171 and merged into cassandra-3.11, cassandra-4.0 and trunk |
|
Great! Thanks a lot for taking your time to work on this issue. |
This commit adds support for writing out SAI indexes at Version.AA. The primary issue was the switch between big-endian and little-endian in many Lucene APIs/formats. This commit works by abstracting these APIs and adding implementations for little-endian/big-endian, based on Version. Several miscellaneous fixes for reading the AA format are included.
This commit adds support for writing out SAI indexes at Version.AA. The primary issue was the switch between big-endian and little-endian in many Lucene APIs/formats. This commit works by abstracting these APIs and adding implementations for little-endian/big-endian, based on Version. Several miscellaneous fixes for reading the AA format are included.
This commit adds support for writing out SAI indexes at Version.AA. The primary issue was the switch between big-endian and little-endian in many Lucene APIs/formats. This commit works by abstracting these APIs and adding implementations for little-endian/big-endian, based on Version. Several miscellaneous fixes for reading the AA format are included.
…at should have been deleted picking commit: "Implement support for writing AA SAI indexes (apache#1096)"
This commit adds support for writing out SAI indexes at Version.AA. The primary issue was the switch between big-endian and little-endian in many Lucene APIs/formats. This commit works by abstracting these APIs and adding implementations for little-endian/big-endian, based on Version. Several miscellaneous fixes for reading the AA format are included.
…at should have been deleted picking commit: "Implement support for writing AA SAI indexes (apache#1096)"
…s ignored
https://issues.apache.org/jira/browse/CASSANDRA-16703