seb bacon wrote:
* Joachim Werner <joe@iuveno-net.de> [010618 20:28]:
That's not the behaviour I'd expect. Can anyone confirm this is a bug?
As LEE Kwan Soo has already said, it is not a bug, but a clever (too clever?) feature that should maybe not be enabled by default. Every second week or so somebody runs into this and thinks it is a bug.
Thanks for the hint, folks.
I'm not a zope newbie, and this still bit me. IMO there's something fairly wrong with the current setup. either the default behaviour should be changed to orphans=0, or the visibility of default values for tags should be improved (from the book: "orphan=int The desired minimum batch size" - no mention of defaults).
Furthermore, the 'feature' doesn't work as I'd expect. In the example I posted, for the sequence (1,2,3,4), I got:
batch 1: 1 batch 2: 2 3 4 batch 3: 3 4 batch 4: 4
This isn't in batches of at least 3... If it were iterating in minimum batches of 3, shouldn't that be:
batch 1: 1 2 3 batch 2: 2 3 4 batch 3: 2 3 4 batch 4: 2 3 4
Orphan control shouldn't actually set the desired minimum batch size, it should set the size at or below which the last batch should be combined with the next to last batch. If my batch size is five, and orphan is set to three, and I have a set of eight records that I am iterating through, I will get a single eight record batch, because the orphan setting tries to prevent the last batch having three or less results by combining them with the previous five. Orphan settings typically do not override where the batch starts (that would be a 'widow' setting) only where it ends, which is why you are getting increasingly smaller batches. However, the fact that you are getting four batches (rather than just one) is arguably a bug. A batch size of one, combined with an orphan setting of three, should actually give the following result: batch 1: 1 2 3 4 But the algorithm doesn't seem 'smart' enough to roll-up the batches by recursing through them in reverse order. Arguably though, you should never set your batch size smaller than the orphan size, so this isn't really an issue. Michael Bernstein.