[ZODB-Dev] Curiosity concerning dead BTree slicing bug

Roché Compaan roche@upfrontsystems.co.za
Wed, 12 Mar 2003 15:43:57 +0200


Hi there

We just stepped in a Zope 2.5.1 BTree bug that looks like it's been
fixed in Zope 2.6.1. The issue was this: a range query on a FieldIndex
containing strings that look like: '20020120000000'. (They're a compact,
sortable, date representation.) Some ranges worked, and some didn't. We
were curious why this happened in the 2.5.1 version of the OOBTree code.
At the bottom of this mail, we quote the log of one that doesn't. We
also quote the logging code we inserted (in
2-5-1/lib/python/Products/PluginIndexes/common/UnIndex.py) to log this::

        if opr=="range":   # range search
            if 'min' in opr_args: lo = min(record.keys)
            else: lo = None
            if 'max' in opr_args: hi = max(record.keys)
            else: hi = None
            if hi:
                setlist = index.items(lo,hi)
            else:
                setlist = index.items(lo)

            from zLOG import LOG
            LOG('INFO', 0, '', 'UnIndex.py> index.items(): %s' % `[i for i in index.items()]`) #DBG 
            LOG('INFO', 0, '', "UnIndex.py> index.items('19700101000000','20030312140957'): %s" % `[i for i in index.items('19700101000000','20030312140957')]`) #DBG 
            for k, set in setlist:
                if type(set) is IntType:
                    set = IISet((set,))
                r = set_func(r, set)

For curiousity's sake, if anyone knows what exactly this bug was, it
would be interesting to know .. 

2003-03-12T13:16:25 INFO(0) INFO
UnIndex.py> index.items(): [('18991117000000', <IITreeSet object at 0x8ffe098>), ('19700101000000', <IITreeSet object at 0x8ffc708>), ('19700101020000', <IITreeSet object at 0x8ffdfd0>), ('20000112000000', -1626447296), ('20010101000000', -1626447298), ('20010108000000', -1626447297), ('20010201000000', -1626447284), ('20010514000000', -1626447295), ('20010801000000', -1626447294), ('20010830000000', -1626447291), ('20011031000000', 1188382178),
('20011220000000', -1626447290), ('20020120000000', -1626447288), ('20020131000000', -1626447289), ('20020216000000', 1188382073), ('20020322000000', -1626447287), ('20020327000000', 1188382524), ('20020328000000', <IITreeSet object at 0x8ffe990>), ('20020330000000', <IITreeSet object at 0x8ffeac8>), ('20020331000000', <IITreeSet object at 0x8ffed00>), ('20020422000000', <IITreeSet object at 0x8ffe2a0>), ('20020505000000', -1626447285), ('20020515000000', 1188382078), ('20020607000000', -1626447293), ('20020630000000', 1188382163), ('20020709000000', <IITreeSet object at 0x8ffeb50>), ('20020715000000', <IITreeSet object at 0x8ffec00>), ('20020723000000', <IITreeSet object at 0x8fff550>), ('20020807000000', 1188382049), ('20020808000000', <IITreeSet object at 0x8fff630>), ('20020817000000', 1188382344), ('20020822000000', 1188382165), ('20020912000000', <IITreeSet object at 0x8fff1e8>), ('20020916000000', <IITreeSet object at 0x8fff870>), ('20020930000000', <IITreeSet object at 0x8fff0f8>), ('20021012000000', 1188382083), ('20021021000000', 1188382351), ('20021023000000', 1188382144), ('20021031234933', 84018862), ('20021101002701', 84018863), ('20021101025452', 84018864), ('20021101093036', 84018861), ('20021104104544', 84018865), ('20021105020534', 84018866), ('20021105173141', 84018867), ('20021105234233', 84018868), ('20021106073531', 84018871), ('20021106113631', 84018869), ('20021108101902', 84018870), ('20021108150641', 84018872), ('20021110042417', 84018873), ('20021112144353', 84018874), ('20021113122558', 84018875), ('20021113124313', 84018876), ('20021113134526', 84018877), ('20021114013110', 84018880), ('20021114020239', 84018881), ('20021114115936', 84018878), ('20021114150541', 84018879), ('20021118082317', 84018882), ('20021119160952', 84018883), ('20021120043350', 84018884), ('20021121041302', 84018885), ('20021211155553', <IITreeSet object at 0x9000260>), ('20030114004331', <IITreeSet object at 0x8ffff80>), ('20030115113713', <IITreeSet object at 0x9000030>), ('20030317000000', <IITreeSet object at 0x8ffdf38>), ('20030327000000', <IITreeSet object at 0x8ffe618>), ('20030401000000', -290329046), ('20030513000000', 1188382475), ('20030608000000', 1188381995), ('20030626000000', 1188382493), ('20030816000000', 1754203266), ('20030928000000', <IITreeSet object at 0x8ffe708>), ('20030929000000', <IITreeSet object at 0x8ffea68>), ('20031231000000', 1188382396), ('20040106000000', 1188382478), ('20040928000000', 1188382424), ('20050928000000', 1188382427), ('20050929000000', 1188382449), ('20060928000000', 1188382430)]------
2003-03-12T13:16:25 INFO(0) INFO
UnIndex.py> index.items('19700101000000','20030312140957'): []

Regards,
-- 
Roché Compaan
Upfront Systems                 http://www.upfrontsystems.co.za