scylladb / java-driver

ScyllaDB Java Driver for ScyllaDB and Apache Cassandra, based on the DataStax Java Driver
Apache License 2.0
63 stars 37 forks source link

Add more information to NoNodeAvailableException and AllNodesFailedException #350

Open dkropachev opened 1 month ago

dkropachev commented 1 month ago

Closes https://github.com/scylladb/java-driver/issues/368

Before

NoNodeAvailableException

 NoNodeAvailableException(showing first 0 nodes):
com.datastax.oss.driver.api.core.NoNodeAvailableException: No node was available to execute the query
at com.datastax.oss.driver.api.core.NoNodeAvailableException.copy(NoNodeAvailableException.java:56)
at com.datastax.oss.driver.internal.core.util.concurrent.CompletableFutures.getUninterruptibly(CompletableFutures.java:151)
at com.datastax.oss.driver.internal.core.cql.CqlRequestSyncProcessor.process(CqlRequestSyncProcessor.java:55)
at com.datastax.oss.driver.internal.core.cql.CqlRequestSyncProcessor.process(CqlRequestSyncProcessor.java:32)
at com.datastax.oss.driver.internal.core.session.DefaultSession.execute(DefaultSession.java:239)
at datadog.trace.instrumentation.datastax.cassandra4.TracingSession.wrapSyncRequest(TracingSession.java:65)
at datadog.trace.instrumentation.datastax.cassandra4.TracingSession.execute(TracingSession.java:47)
at com.datastax.oss.driver.api.core.cql.SyncCqlSession.execute(SyncCqlSession.java:56)
at com.datastax.oss.driver.internal.mapper.DaoBase.execute(DaoBase.java:188)

AllNodesFailedException

After

NoNodeAvailableException

com.datastax.oss.driver.api.core.NoNodeAvailableException: No node was available to execute the query. Query Plan: com.datastax.oss.driver.internal.core.util.collection.DebugQueryPlan(plan: com.datastax.oss.driver.internal.core.util.collection.EmptyQueryPlan(inQueue: [], itemsPulled: []), policy: DefaultLoadBalancingPolicyDebugInfo{localDc: dc1, localRack: null, liveNodes: SingleDcNodeSetInfo(dc:dc1, dcs: [dc1], nodes: []), replicas: null, defaultConsistencyLevel: LOCAL_ONE, allowDcFailoverForLocalCl: false, maxNodesPerRemoteDc: 0, responseTimes: {Node(endPoint=test.cluster.fake:9042, hostId=a2e2a335-7cf6-4693-a3d6-898e2496c2ee, hashCode=9e10e5a)=[20538401028950]}, upTimes: {}, avoidSlowReplicas: true}, localPlan: com.datastax.oss.driver.internal.core.loadbalancing.nodeset.LazyCopyQueryPlan(inQueue: [], itemsPulled: []))

    at com.datastax.oss.driver.api.core.NoNodeAvailableException.copy(NoNodeAvailableException.java:56)
    at com.datastax.oss.driver.internal.core.util.concurrent.CompletableFutures.getUninterruptibly(CompletableFutures.java:151)
    at com.datastax.oss.driver.internal.core.cql.CqlRequestSyncProcessor.process(CqlRequestSyncProcessor.java:55)
    at com.datastax.oss.driver.internal.core.cql.CqlRequestSyncProcessor.process(CqlRequestSyncProcessor.java:32)
    at com.datastax.oss.driver.internal.core.session.DefaultSession.execute(DefaultSession.java:239)
    at com.datastax.oss.driver.api.core.cql.SyncCqlSession.execute(SyncCqlSession.java:56)
    at com.datastax.oss.driver.api.core.cql.SyncCqlSession.execute(SyncCqlSession.java:80)
    at com.datastax.oss.driver.core.resolver.MockResolverIT.should_connect_with_mocked_hostname(MockResolverIT.java:95)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
    at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
    at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
    at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
    at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)

AllNodesFailedException

roydahan commented 1 month ago

@dkropachev are we going to do it only for 4.x?

dkropachev commented 1 month ago

@dkropachev are we going to do it only for 4.x?

For now, we are going to work it out with Disney, and based on that experience complete this PR and then propagate changes to 3.x