Closed Bug 162156 Opened 24 years ago Closed 24 years ago

mail search (over entire server) updates folder counts one at a time

Categories

(MailNews Core :: Backend, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: sspitzer, Assigned: naving)

Details

(Keywords: perf)

Attachments

(1 file, 2 obsolete files)

mail search (over entire server) updates folder counts one at a time I did a mail search (over my entire imap account), and while the search was going, I could see the affect of us opening the folders. as we'd open one, I'd see the total message count update in the folder pane. it wasn't batching the updates, and that probably means we're wasting a lot of time on notifications and on repaiting.
QA Contact: gayatri → esther
QA Contact: esther → laurel
Keywords: perf
Attached patch proposed fix (obsolete) — — Splinter Review
The fix is to suppress msg count notification when we are about to begin searching and to enable it when we are done searching a folder. If we interruptSearch() then we should enable counts for all the folders as well close all the db's that may have been openend during Initialize(). In nsMsgFolder we don't need to get the db unless we are doing batching.
Cavin, David, Can you review the fix ? thx.
Comment on attachment 95163 [details] [diff] [review] proposed fix r=cavin. Need to remove this comment: + //m_idxRunningScope = m_scopeList.Count() so it will make us not run another url
Attachment #95163 - Flags: review+
what does this change have to do with this bug: + while (m_idxRunningScope < m_scopeList.Count()) + { ReleaseFolderDBRef(); - m_idxRunningScope = m_scopeList.Count(); // this'll make us not run another url + m_idxRunningScope++; + } + //m_idxRunningScope = m_scopeList.Count() so it will make us not run another url m_window->StopUrls(); }
Nothing, but it should have been that way before because when we call nsMsgSearchSession::Initialize() we open the dbs to get folder charset. So we should be closing all dbs if the search is interrupted.
I don't see any code in nsMsgSearchSession::Initialize() that does that. I guess I'll need to look into it further...
Here is the stack trace nsImapMailFolder::GetDBFolderInfoAndDB(nsImapMailFolder * const 0x0135c68c, nsIDBFolderInfo * * 0x0012c428, nsIMsgDatabase * * 0x0012c420) line 1758 nsMsgDBFolder::GetCharset(nsMsgDBFolder * const 0x0135c68c, unsigned short * * 0x051604a0) line 232 + 63 bytes nsMsgSearchAdapter::GetSearchCharsets(nsMsgSearchAdapter * const 0x03a69210, unsigned short * * 0x03a692e0, unsigned short * * 0x03a69288) line 353 nsMsgSearchOnlineMail::ValidateTerms(nsMsgSearchOnlineMail * const 0x03a69210) line 71 nsMsgSearchScopeTerm::InitializeAdapter(nsISupportsArray * 0x03968d98) line 1376 + 26 bytes nsMsgSearchSession::Initialize() line 416 + 20 bytes nsMsgSearchSession::Search(nsMsgSearchSession * const 0x03968ce Also if someone interrupts search we don't need to get out from there without enabling folder counts for all folders searched.
s/ don't need to /should not
I'm confused - shouldn't we only be disabling the folder counts for the currently searched folder, not for all folders we're about to search? Your comment implies that we turn off folder counts for all folders, do the search, and then turn them back on for all folders - that does seem a bit more risky...
because if it behaves the way I thought it did (just disabling notifications when searching a folder), then on stop, we're going to be enabling notifications on folders that we didn't disable notifications for, which is a no no.
we disable all, and then enable all. It is not going to affect much because search is not going to be that long anyway.
hmm, seems like an account-wide search would take quite a while, minutes, in fact. And if, for example, messages got filtered into a folder via biff during the meantime, we wouldn't show the new folder counts until the whole search had finished, right? If it's too hard to disable and enable notifications while the search is going on, then I guess we'd have to live with that.
we disable all at once but keep enabling them one by one as search is finished on that folder.
was there a problem turning off the notifications in GetNextUrl and turning them off in ::OnStopRunningUrl? I guess you'd have to worry about TimeSliceSerial when it advances the scope. You could add a method ::FinishScope() or something that does the ReleaseFolderDBRef(), increments the m_idxRunningScope, and re-enables notifications, and call it from the couple places that advance the scope. In general, it's a bad idea to disable notifications for longer than absolutely neccesary, or before it's needed - it increase the chances for things to go wrong.
ah, by putting it in ReleaseFolderDBRef() - seems like that method might want to get renamed since it's doing more than just releasing the reference now.
Attached patch patch (obsolete) — — Splinter Review
Attachment #95163 - Attachment is obsolete: true
Comment on attachment 95296 [details] [diff] [review] patch missed out one thing.
Attachment #95296 - Attachment is obsolete: true
Attached patch patch — — Splinter Review
Attachment #95298 - Flags: superreview+
Comment on attachment 95298 [details] [diff] [review] patch ok, thx, sr=bienvenu - for extra credit, you could make a helper routine ::OnDoneSearchFolder() and that routine would call both ReleaseDBFolderRef() and EnableFolderNotifications(PR_TRUE), but that's up to you.
fixed
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: