Re: Background flist sometimes misses folders?

Brent Welch <[email protected]> Thu, 14 Apr 2005 09:41:21 -0700
Newsgroups gmane.mail.exmh.devel
Message-ID <[email protected]>
[email protected] said:
> If I could get that patch, it would be great.  I want to see if it also
> handles the other problem I'm having.  If I read all my mail in inbox,
> deleting some, etc, and then a background inc occurs, the messages that
> were marked unread before (but have since been read) suddenly become
> unread again. ;-) 

Attached is a patch against 2.7.2
There were some other differences from unrelated changes that
I have elided from the patch.  This should just be about
properly maintaining a cache of unseen sequence information.

I'm not sure that this addresses Sean's problem.

>>>Brent Welch said:
 > 
 > I believe I've found the typo in my original FlistUncache fix
 > that meant it wasnt' really clearing the cache.  I've also added
 > more calls to this from mh.tcl code.  This is all at the CVS HOL.
 > 
 > If someone would prefer just a patch against, e.g., 2.7.2, let me know.
 > 
 > >>>Brent Welch said:
 >  > 
 >  > Yeah, I think we can simply fix this to get it right.
 >  > I thought I understood the issue, and that invalidating
 >  > the per-folder cache for the current folder when you made
 >  > changes was sufficient.  It may also work to special case
 >  > the current folder, hmm...
 >  > 
 >  > >>>Sean Kamath said:
 >  >  > 
 >  >  > 
 >  >  > [In a message on Tue, 22 Mar 2005 08:50:43 CST,
 >  >  >   Chris Garrigues wrote:]
 >  >  > >> As noted, this kills me as I have billions of folders with
 >  >  > >> things in the unseen sequence.
 >  >  > >...
 >  >  > >Maybe we need to add a preferences item for "incorrect unseen 
 > sequence
 >  >  > >behavior for people who have too many unseen messages"?
 >  >  > >
 >  >  > >I'm only about 20% joking about this.  It should probably be in 
 >  > exmh-defaul
 >  >      ts 
 >  >  > >instead of preferences so it's minimally visible.  Any ideas what 
it
 >  > should
 >  >       be
 >  >  > >called?
 >  >  > 
 >  >  > Wouldn't it make more sense to have an option in Inc to call
 >  >  > Mh_SequenceUpdate? Or, if Inc is set to any form of background 
task,
 >  >  > shouldn't it just call this anyway?
 >  >  > 
 >  >  > Am I missing something?
 >  >  > 
 >  >  > Sean
 >  >  > 
 >  >  > 
 >  > 
 >  > --
 >  > Brent Welch
 >  > Software Architect, Panasas Inc
 >  > Accelerating Time to Results(tm) with Clustered Storage
 >  > 
 >  > www.panasas.com
 >  > [email protected]
 >  > 
 >  > 
 >  > _______________________________________________
 >  > Exmh-workers mailing list
 >  > [email protected]
 >  > https://www.redhat.com/mailman/listinfo/exmh-workers
 >  > 
 >  > 
 > 
 > --
 > Brent Welch
 > Software Architect, Panasas Inc
 > Accelerating Time to Results(tm) with Clustered Storage
 > 
 > www.panasas.com
 > [email protected]
 > 
 > 
 > _______________________________________________
 > Exmh-workers mailing list
 > [email protected]
 > https://www.redhat.com/mailman/listinfo/exmh-workers
 > 
 > 

--
Brent Welch
Software Architect, Panasas Inc
Accelerating Time to Results(tm) with Clustered Storage

www.panasas.com
[email protected]

_______________________________________________
Exmh-workers mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/exmh-workers
flist.patch (application/x-patch, 4.1 KB)
*** flist.tcl	Wed Sep 22 10:46:29 2004
--- /fs/home/welch/cvs/exmh/lib/flist.tcl	Mon Apr  4 18:47:16 2005
***************
*** 315,321 ****
  
                    # Cache added 2/11/03
                    # Sequence is different than last time we checked
! 
                    set flistcache($folder,$seq) $seqlist
                    BgRPC Seq_Set $folder $seq $seqlist
                  }
--- 315,326 ----
  
                    # Cache added 2/11/03
                    # Sequence is different than last time we checked
!                   # This causes an flist inconsistency, but helps me
!                   # so much that I'm leaving it in.  The bug is that if you
!                   # get a few new messages (e.g., 1), then read and delete
!                   # that message, and exactly one new message comes in,
!                   # the cache doesn't realize it.  Perhaps we just need
!                   # to unset the flistcache when we do deletes.
                    set flistcache($folder,$seq) $seqlist
                    BgRPC Seq_Set $folder $seq $seqlist
                  }
***************
*** 331,336 ****
--- 336,353 ----
      }
  }
  
+ proc FlistUncache {folder} {
+     global flistcache
+     # Clear it from both processes because the FlistFindSeqInner
+     # can run in either place
+     FlistUncacheLocal $folder
+     BgAction FlistUncache FlistUncacheLocal $folder
+ }
+ proc FlistUncacheLocal {folder} {
+     global flistcache
+     array unset flistcache $folder,*
+ }
+ 
  proc FlistFindSeqs {reset} {
      global flist
      if {![BgRPC FlistFindStart $reset]} {
*** folder.tcl	Wed Dec 29 14:39:51 2004
--- /fs/home/welch/cvs/exmh/lib/folder.tcl	Thu Mar  3 17:00:59 2005
***************
*** 230,235 ****
--- 230,236 ----
  
      Ftoc_Commit $rmmCommit $moveCommit $copyCommit
      Exmh_Debug Scan_CacheUpdate [time Scan_CacheUpdate]
+     FlistUncache $exmh(folder)
  
      if $ftoc(autoPack) {
  	Background_Wait	;# Let folder ops complete
*** mh.tcl	Thu Jan  6 18:17:36 2005
--- /fs/home/welch/cvs/exmh/lib/mh.tcl	Mon Apr  4 18:37:16 2005
***************
*** 440,445 ****
--- 440,446 ----
      if {![catch {set mtime [file mtime $filename]}]} {
  	if {![info exists mhPriv(privmtime)] || ($mtime != $mhPriv(privmtime))} {
              array unset mhPriv privseq,${folder},*
+             FlistUncacheLocal $folder
  	    if {[catch {open $filename r} in] == 0} {
  		Exmh_Debug MhReadSeqs Reading $filename
  		set old [read $in]
***************
*** 465,470 ****
--- 466,472 ----
      } elseif {[info exists mhPriv(privmtime)]} {
  	unset mhPriv(privmtime)
          array unset mhPriv privseq,${folder},*
+         FlistUncacheLocal $folder
      }
      # mhPriv(privseq,folder,sequence) contains list of message IDs
      foreach elem [array names mhPriv privseq,${folder},*] {
***************
*** 477,482 ****
--- 479,485 ----
      if {![catch {set mtime [file mtime $filename]}]} {
  	if {![info exists mhPriv(seqmtime,$folder)] || ($mtime != $mhPriv(seqmtime,$folder))} {
              array unset mhPriv pubseq,${folder},*
+             FlistUncacheLocal $folder
  	    if {[catch {open $filename r} in] == 0} {
  		Exmh_Debug MhReadSeq Reading $filename
  		set old [read $in]
***************
*** 504,509 ****
--- 507,513 ----
      } elseif {[info exists mhPriv(seqmtime,$folder)]} {
  	unset mhPriv(seqmtime,$folder)
          array unset mhPriv pubseq,${folder},*
+         FlistUncacheLocal $folder
      }
      foreach elem [array names mhPriv pubseq,${folder},*] {
  	set indices [split $elem ,]
***************
*** 605,610 ****
--- 609,615 ----
      }
      if {$mhPriv(changed,public) == 1} {
  	set mhPriv(pubseq,$folder,$seq) [MhSeqExpand $folder $seqs($seq)]
+         FlistUncacheLocal $folder
  	set filename $mhProfile(path)/$folder/$mhProfile(mh-sequences)
  	if {[catch {open $filename.new w} out] == 0} {
  	    Exmh_Debug Writing $filename
***************
*** 636,641 ****
--- 641,647 ----
      }
      if {$mhPriv(changed,private) == 1} {
  	set mhPriv(privseq,$folder,$seq) [MhSeqExpand $folder $seqs($seq)]
+         FlistUncacheLocal $folder
  	set filename $mhProfile(context)
  	if {[catch {open $filename.new w} out] == 0} {
  	    Exmh_Debug Writing $filename