On 2014-03-18 18:52, Chetan Mehrotra wrote:
Hi,

I was looking into the support for Version GC (OAK-1341). For that I
had a look at BlobReferenceIterator#loadBatchQuery which currently
does a pagination over all Documents which have binaries. The DBCursor
returned by Mongo [1] implements the Iterator contract and would
lazily fetch the next batch.

So had two queries

1. Should we expose the Iterator as part of DocumentStore API and rely
on Mongo to paginate. Probably the ResultSet in DB case can also
easily Iterator pattern

2. Cache Handling - Currently fetching document in such pattern for GC
handling would also overflow the cache. So should we pass an extra
flag to not cache docs from such calls

Chetan Mehrotra
[1] http://api.mongodb.org/java/2.0/com/mongodb/DBCursor.html
...

I noticed that the BlobStore API recently acquired a similar interface through GarbageCollectableBlobStore.

The current impl in RDBBlobStore just returns an iterator that wraps a result set, which works right now as the RDBBlobStore keeps holding the Connection.

I was planning to change the impl to actually use a connection pool, in which case the iterator will need to hold the connection (*), in which case we'll have to make sure that it's clear when the iterator isn't needed anymore. That is: can I rely on it always being read to the end???

(*) Or alternatively build the result set in memory, but I'll guess we don't want to do that :-)

Best regards, Julian



Reply via email to