2

I am trying to implement paginated REST API backed by Cassandra. I found that the Cassandra driver has a pagination feature (http://docs.datastax.com/en/developer/java-driver/3.3/manual/paging/). I did a simple experiment with this feature, and it seems to work.

By setting proper page size and page state, even if the server (web server, not Cassandra server) is restarted, I can still get the correct page. Also, it seems that the driver sends this page state and page size together with its statement to Cassandra server. How did this stuff work? It looks mysterious to me.

Wei
  • 191
  • 3
  • 13

1 Answers1

4

Page state holds the last read partition and last read row. Everything is sorted so it can just seek to that partition/row and continue reading from there. This gives ability to walk through things but not do things like offset selects.

Chris Lohfink
  • 16,150
  • 1
  • 29
  • 38
  • Yes, I did print out the paging state I, it contains the last entry. But a follow-up question is what if I delete that entry? Will the paging state still usable? – Wei Oct 06 '17 at 17:55
  • 1
    yes, it starts on next record > than it (or < depending on ordering). So it doesnt matter if the actual record is still there or not. – Chris Lohfink Oct 07 '17 at 05:21