Closed Bug 478172 Opened 17 years ago Closed 17 years ago

gloda indexer should guard against empty references

Categories

(MailNews Core :: Database, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 3.0b3

People

(Reporter: asuth, Assigned: asuth)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch v1 ensure references prove true (obsolete) — Splinter Review
I'm not entirely sure why this is happening, as I thought I straightened out the references parsing logic at the root of things, but the indexer should guard against betrayal and ensure that the reference is non-false (so not null or an empty string). I'm losing the list comprehension because I think it would look funny or include a redundant XPCOM call to accomplish the required logic.
Attachment #361948 - Flags: review?(bienvenu)
Assignee: nobody → bugmail
Status: NEW → ASSIGNED
Attachment #361948 - Flags: review?(bienvenu) → review+
Comment on attachment 361948 [details] [diff] [review] v1 ensure references prove true I don't know why this would happen - is numReferences wrong, or is one of the middle references null?
Either numReferences is wrong or it counts the case where the last value is empty or null. (The list of references gloda was building when converted to a string showed ",," for the reference in question, which would correspond to the 'highest' reference. (The reason there is a trailing comma is that gloda also pushes on the message-id of the message it is indexing...) What is confusing is that this only seemed to happen on a very few messages for me... and all of the examples I looked at were actually bugzilla messages...
Looks like in bug 466796 I got confused about the caching of m_numReferences (or the call sequence that might allow it to be made a moot issue). It does get cached, and if your call sequence is GetNumReferences before any calls to GetStringReferences, you are going to get the cached value. As such, msf files dating from before bug 466796 was fixed could be subject to this problem. Things are made somewhat more confusing by GetStringReference returning NS_OK even when the reference number requested is not legit. I feel like the best solution might just be to always parse to initialize the num references variable. Such a patch could also abstain from creating the numRefs column (or setting it).
dang, I didn't realize that you approved my kludge patch. In any event, this patch should fix things for gloda and traditional threading. This does what I proposed in the previous comment, namely removing the num references column entirely, and always parsing the header when the number of references is required. Even though the correctness issue should only happen for "old" msf files, I think this is probably a win overall. If you are accessing the number of references, you presumably are going to want to see them, so you would end up parsing anyways. If you have no references, we won't have a references column entry, so we'll quickly be able to zero out m_numReferences. And we avoid storing a column, so there's disk and memory savings. I did make one semantic change, which is to return an error if you ask for a reference with an illegal index rather than silently return empty. I should be up front that I honestly have no idea why I was experiencing this problem on some bugmail mails in the first place, but this solution is equivalent to the gloda work-around above, which definitely did resolve the problem. (I could investigate it, but it doesn't seen worth it, especially if the actual problem was just that the references parsing code was newfoundly buggy when I received those messages but was subsequently fixed...)
Attachment #361948 - Attachment is obsolete: true
Attachment #363597 - Flags: superreview?(bienvenu)
Attachment #363597 - Flags: review?(bienvenu)
moving to b3, but I'll give this a shot now.
Target Milestone: Thunderbird 3.0b2 → Thunderbird 3.0b3
Comment on attachment 363597 [details] [diff] [review] v1 always parse references this seems fine going forward. The one unintended consequence is that if you switch back and forth between builds w/ this patch, e.g., TB 3.0 b3, and builds w/o it (e.g., TB 2.0), you will get somewhat less accurate threading, but since those builds mostly do subject threading, it won't be a complete disaster.
Attachment #363597 - Flags: superreview?(bienvenu)
Attachment #363597 - Flags: superreview+
Attachment #363597 - Flags: review?(bienvenu)
Attachment #363597 - Flags: review+
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: