Skip to content

Conversation

@zoltanersek
Copy link

Copy link

@chicobento chicobento left a 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.

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);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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);
   }
}

Copy link
Contributor

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

@chicobento
Copy link

LGTM, thanks a lot for fixing this issue.
Would love to see it backported to 3.x if possible.

@zoltanersek
Copy link
Author

Committed into cassandra-3.0 at eadb171 and merged into cassandra-3.11, cassandra-4.0 and trunk

@zoltanersek zoltanersek closed this Jul 7, 2021
@zoltanersek zoltanersek deleted the 16703-trunk branch July 7, 2021 19:53
@chicobento
Copy link

Great! Thanks a lot for taking your time to work on this issue.

pcmanus pushed a commit to pcmanus/cassandra that referenced this pull request May 21, 2024
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.
ekaterinadimitrova2 pushed a commit to ekaterinadimitrova2/cassandra that referenced this pull request Jun 3, 2024
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.
michaelsembwever pushed a commit to thelastpickle/cassandra that referenced this pull request Sep 25, 2024
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.
michaelsembwever pushed a commit to thelastpickle/cassandra that referenced this pull request Sep 25, 2024
…at should have been deleted picking commit: "Implement support for writing AA SAI indexes (apache#1096)"
michaelsembwever pushed a commit to thelastpickle/cassandra that referenced this pull request Jan 7, 2026
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.
michaelsembwever pushed a commit to thelastpickle/cassandra that referenced this pull request Jan 7, 2026
…at should have been deleted picking commit: "Implement support for writing AA SAI indexes (apache#1096)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants