Aloha,

I noticed symptoms of Ticket 1198 on my system
and was looking over the patch to fix the problem:
http://www.sqlite.org/cvstrac/chngview?cn=2447

After applying the patch, the default busy callback handler contains:

  if( count < NDELAY ){
    delay = delays[count];
    prior = totals[count];
  }else{
    delay = delays[NDELAY-1];
    prior = totals[NDELAY-1] + delay*(count-NDELAY-1);
  }

For the case where count == NDELAY:
prior = totals[NDELAY-1] + delay*(count-NDELAY-1);
prior = 228 + 100*(0-1);
prior = 128;

The value of "prior" is less than the previous value in the sequence,
although I would expect the sequence to be non-decreasing.
Based on the pattern of previous values, if count == NDELAY then
"prior" should be 328?  I'm not sure if the current behavior is intended;
I'm asking just in case it's a typo.

Trivial patch appended.

- glen

Index: src/main.c
===================================================================
RCS file: /sqlite/sqlite/src/main.c,v
retrieving revision 1.286
diff -u -3 -p -r1.286 main.c
--- src/main.c  28 Apr 2005 12:06:06 -0000      1.286
+++ src/main.c  6 May 2005 20:40:08 -0000
@@ -632,7 +632,7 @@ static int sqliteDefaultBusyCallback(
     prior = totals[count];
   }else{
     delay = delays[NDELAY-1];
-    prior = totals[NDELAY-1] + delay*(count-NDELAY-1);
+    prior = totals[NDELAY-1] + delay*(count-NDELAY+1);
   }
   if( prior + delay > timeout ){
     delay = timeout - prior;

Reply via email to