Bug: Transient Replication:  java.lang.AssertionError null error
Status: Triage Needed
Priority: Normal
Created: 01/Apr/20 17:30

This bug happens randomly. It seems that for some reason, _Replicas.ReplicaCount.allReplicas()_ or _Replicas.ReplicaCount.fullReplicas()_ can be *null* instead of *0* ? 

stacktrace:
{code}
ERROR [Native-Transport-Requests-1] 2020-04-01 12:00:20,024 Message.java:874 - Unexpected exception during request; channel = [id: 0x9891b4c8, L:/127.0.0.1:9042 - R:/127.0.0.1:48542]
java.lang.AssertionError: null
	at org.apache.cassandra.exceptions.UnavailableException.create(UnavailableException.java:38)
	at org.apache.cassandra.locator.ReplicaPlans.assureSufficientLiveReplicas(ReplicaPlans.java:126)
	at org.apache.cassandra.locator.ReplicaPlans.assureSufficientLiveReplicasForRead(ReplicaPlans.java:109)
	at org.apache.cassandra.locator.ReplicaPlans.forRead(ReplicaPlans.java:593)
	at org.apache.cassandra.service.reads.AbstractReadExecutor.getReadExecutor(AbstractReadExecutor.java:191)
	at org.apache.cassandra.service.StorageProxy.fetchRows(StorageProxy.java:1798)
	at org.apache.cassandra.service.StorageProxy.readRegular(StorageProxy.java:1709)
	at org.apache.cassandra.service.StorageProxy.read(StorageProxy.java:1626)
	at org.apache.cassandra.db.SinglePartitionReadCommand.execute(SinglePartitionReadCommand.java:382)
	at org.apache.cassandra.service.pager.AbstractQueryPager.fetchPage(AbstractQueryPager.java:69)
	at org.apache.cassandra.service.pager.SinglePartitionPager.fetchPage(SinglePartitionPager.java:32)
	at org.apache.cassandra.cql3.statements.SelectStatement$Pager$NormalPager.fetchPage(SelectStatement.java:352)
	at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:400)
	at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:250)
	at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:88)
	at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:216)
	at org.apache.cassandra.cql3.QueryProcessor.processPrepared(QueryProcessor.java:489)
	at org.apache.cassandra.cql3.QueryProcessor.processPrepared(QueryProcessor.java:467)
	at org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler.processPrepared(CustomPayloadMirroringQueryHandler.java:67)
	at org.apache.cassandra.transport.messages.ExecuteMessage.execute(ExecuteMessage.java:140)
	at org.apache.cassandra.transport.Message$Request.execute(Message.java:253)
	at org.apache.cassandra.transport.Message$Dispatcher.processRequest(Message.java:725)
	at org.apache.cassandra.transport.Message$Dispatcher.lambda$channelRead0$0(Message.java:630)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$FutureTask.run(AbstractLocalAwareExecutorService.java:165)
	at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:119)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:748)
{code}

I can reproduce relativity easily with this python driver test (1 out of 5 runs): https://github.com/datastax/python-driver/blob/master/tests/integration/long/test_loadbalancingpolicies.py#L622

This was tested with 4.0-alpha3 and trunk. I can help to debug if needed.