Handle empty non-final pages in ReactiveResultSetSubscription

Description

I tried to use this driver with scylladb database, because it supports CQL protocol. But code started to hang for some queries:

The reason is that scylladb sometime returns a page with no data but with pagingState != null and it leads to code hanging

For instance, if `pages` queue contains three pages:

  • first page with data and with pagingState != null

  • second page without data and pagingState != null

  • third page without data and pagingState = null

Akka stream calls request(1) if it needs data and request calls drain that sends one row to akka stream subscriber. It works well for pages with data. But if there is page without data and `pagingState` != null the following situation appears:

Akka stream calls requests(1) that calls drain that calls tryNext. tryNext method detects that there is no data anymore in page 1 and it gets second page from pages queue. But because of second page has no data, tryNext() will return null and no data will be sent to akka stream subscriber. Because no data will be sent to akka subscriber, akka stream will not call request(1) anymore and drain will not be called from anywhere because all pages are already loaded.

I don't know why scylladb returns pages without data and `pagingState` != null. I will ask scylladb team, but it also would be good to fix this case in driver as well

Environment

None

Pull Requests

None

Activity

Show:
Fixed

Details

Assignee

Reporter

Affects versions

Fix versions

Pull Request

Priority

Created April 13, 2021 at 10:44 AM
Updated April 28, 2021 at 9:34 AM
Resolved April 28, 2021 at 9:34 AM