I'm trying to follow the doc's recommendations to implement pagination - I
think there's a bug here: http://orientdb.com/docs/last/Pagination.html.
This method gives me duplicate records and iterates for ever.
Here's my example in Scala:
// Create a new memory DB.
val db: ODatabaseDocumentTx = new ODatabaseDocumentTx("memory:jsondb")
db.create()
db.set(MINIMUMCLUSTERS, 3)
db.set(CLUSTERSELECTION, "round-robin")
db.set(CONFLICTSTRATEGY, "content")
db.set(CHARSET, "UTF-8")
// Insert 12 things
for (x <- 0 until 12) {
val doc = makeThingDoc(x)
val saved = db.save[ODocument](doc)
println(saved)
}
Following the docs <http://orientdb.com/docs/last/Pagination.html>, I
implemented the automatic paginated query like so:
val query = new OSQLSynchQuery[ODocument]("select from Thing LIMIT 5")
var resultset = db.query[OResultSet[ODocument]](query)
while (!resultset.isEmpty()) {
resultset = db.query(query)
resultset.toArray.foreach(println)
println("---------")
}
Here's what got put in:
Thing#9:0{x:0} v1
Thing#10:0{x:1} v1
Thing#11:0{x:2} v1
Thing#9:1{x:3} v1
Thing#10:1{x:4} v1
Thing#11:1{x:5} v1
Thing#9:2{x:6} v1
Thing#10:2{x:7} v1
Thing#11:2{x:8} v1
Thing#9:3{x:9} v1
Thing#10:3{x:10} v1
Thing#11:3{x:11} v1
Thing#9:0{x:0} v1
Thing#10:1{x:4} v1
Thing#10:2{x:7} v1
Thing#10:3{x:10} v1
Thing#11:0{x:2} v1
Here's what the pagination gets out:
Thing#9:0{x:0} v1
Thing#11:1{x:5} v1
Thing#11:2{x:8} v1
Thing#11:3{x:11} v1 # 4 items not 5
---------
Thing#9:0{x:0} v1 # 1st item again! 1 item, not 5
---------
Thing#9:1{x:3} v1
Thing#9:2{x:6} v1
Thing#9:3{x:9} v1
Thing#10:0{x:1} v1
Thing#10:1{x:4} v1 # Yay 5 items!
---------
Thing#9:0{x:0} v1 # Already seen this!
Thing#10:2{x:7} v1 # 12 items received
Thing#10:3{x:10} v1 # ... what's this, there's more?
Thing#11:0{x:2} v1
Thing#11:1{x:5} v1
---------
... and goes on like forever.
I'm using 2.1.1
Am I missing something, or is this a bug?
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.