/ Check-in [c54e8dad]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Changes for branch coverage of notify.c. Fixed quirk of unlock_notify() where it would still think it was blocked after a callback was cleared (even after the transaction on the blocking connection was closed).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental
Files: files | file ages | folders
SHA1: c54e8dad01b0ecaf8d66b10e64e862dcad8a6746
User & Date: shaneh 2010-04-16 22:05:32
Original Comment: Changes for branch coverage of notify.c. Fixed quirk of unlock_notify() where it would still think it was blocked after a callback was cleared (even after the transaction on the blocking connection was closed).
Context
2010-04-17
16:10
It is possible for sqlite3.pUnlockConnection to be non-NULL when sqlite3.pBlockingConnection is NULL, as the notify1.test script demonstrates. Closed-Leaf check-in: 95ff76ef user: drh tags: experimental
2010-04-16
22:05
Changes for branch coverage of notify.c. Fixed quirk of unlock_notify() where it would still think it was blocked after a callback was cleared (even after the transaction on the blocking connection was closed). check-in: c54e8dad user: shaneh tags: experimental
2010-04-15
23:24
Disable query flattening when the outer query is a compound SELECT and the inner query has a LIMIT clause. Ticket [02a8e81d44]. check-in: f96782b3 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

configure became a regular file.

install-sh became a regular file.

Changes to src/notify.c.

153
154
155
156
157
158
159

160
161
162
163
164
165
166
...
192
193
194
195
196
197
198
199





200
201
202
203
204
205
206
...
297
298
299
300
301
302
303
304








305
306
307
308
309
310
311
  int rc = SQLITE_OK;

  sqlite3_mutex_enter(db->mutex);
  enterMutex();

  if( xNotify==0 ){
    removeFromBlockedList(db);

    db->pUnlockConnection = 0;
    db->xUnlockNotify = 0;
    db->pUnlockArg = 0;
  }else if( 0==db->pBlockingConnection ){
    /* The blocking transaction has been concluded. Or there never was a 
    ** blocking transaction. In either case, invoke the notify callback
    ** immediately. 
................................................................................
** This function is called while stepping or preparing a statement 
** associated with connection db. The operation will return SQLITE_LOCKED
** to the user because it requires a lock that will not be available
** until connection pBlocker concludes its current transaction.
*/
void sqlite3ConnectionBlocked(sqlite3 *db, sqlite3 *pBlocker){
  enterMutex();
  if( db->pBlockingConnection==0 && db->pUnlockConnection==0 ){





    addToBlockedList(db);
  }
  db->pBlockingConnection = pBlocker;
  leaveMutex();
}

/*
................................................................................
      xUnlockNotify = p->xUnlockNotify;
      p->pUnlockConnection = 0;
      p->xUnlockNotify = 0;
      p->pUnlockArg = 0;
    }

    /* Step 3. */
    if( p->pBlockingConnection==0 && p->pUnlockConnection==0 ){








      /* Remove connection p from the blocked connections list. */
      *pp = p->pNextBlocked;
      p->pNextBlocked = 0;
    }else{
      pp = &p->pNextBlocked;
    }
  }







>







 







|
>
>
>
>
>







 







|
>
>
>
>
>
>
>
>







153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
...
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
...
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
  int rc = SQLITE_OK;

  sqlite3_mutex_enter(db->mutex);
  enterMutex();

  if( xNotify==0 ){
    removeFromBlockedList(db);
    db->pBlockingConnection = 0;
    db->pUnlockConnection = 0;
    db->xUnlockNotify = 0;
    db->pUnlockArg = 0;
  }else if( 0==db->pBlockingConnection ){
    /* The blocking transaction has been concluded. Or there never was a 
    ** blocking transaction. In either case, invoke the notify callback
    ** immediately. 
................................................................................
** This function is called while stepping or preparing a statement 
** associated with connection db. The operation will return SQLITE_LOCKED
** to the user because it requires a lock that will not be available
** until connection pBlocker concludes its current transaction.
*/
void sqlite3ConnectionBlocked(sqlite3 *db, sqlite3 *pBlocker){
  enterMutex();
  if( db->pBlockingConnection==0 ){
    /* 
    ** We can not register an unlock callback unless we think we are 
    ** blocked.
    */
    assert( db->pUnlockConnection==0 );
    addToBlockedList(db);
  }
  db->pBlockingConnection = pBlocker;
  leaveMutex();
}

/*
................................................................................
      xUnlockNotify = p->xUnlockNotify;
      p->pUnlockConnection = 0;
      p->xUnlockNotify = 0;
      p->pUnlockArg = 0;
    }

    /* Step 3. */
    if( p->pBlockingConnection==0 ){
      /* 
      ** If we were blocked on db, we would set
      ** pBlockingConnection to 0 above.  And we can 
      ** only wait on a connection we are blocked on.
      ** So if we were waiting on db (pUnlockConnection==db)
      ** then it would have been set to 0 above as well.
      */
      assert( p->pUnlockConnection==0 );
      /* Remove connection p from the blocked connections list. */
      *pp = p->pNextBlocked;
      p->pNextBlocked = 0;
    }else{
      pp = &p->pNextBlocked;
    }
  }