/ Check-in [5e269c2d]
Login

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

Overview
Comment:Improved comment on cursorOwnsBtShared(). No changes to code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | btree-refactor
Files: files | file ages | folders
SHA1: 5e269c2d2667df65592a32d6bc2fa388fd7eb181
User & Date: drh 2016-06-04 21:05:54
Context
2016-06-06
01:14
Btree interface refactoring: (1) The sqlite3BtreeKeySize() interface is renamed to sqlite3BtreeIntegerKey() and modified to work only for table btrees with a rowid. (2) The sqlite3BtreeDataSize() interface is renamed to sqlite3BtreePayloadSize() and modified to work with any btree. (3) The sqlite3BtreeDataFetch() and sqlite3BtreeKeyFetch() routines are combined into a single sqlite3BtreePayloadFetch() routine. The result of these changes is a smaller binary and fewer CPU cycles needed to run queries. check-in: 2d831074 user: drh tags: trunk
2016-06-04
21:05
Improved comment on cursorOwnsBtShared(). No changes to code. Closed-Leaf check-in: 5e269c2d user: drh tags: btree-refactor
20:58
Fix a C99-ism and a compiler warning for MSVC. check-in: aa53a36e user: drh tags: btree-refactor
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/btree.c.

446
447
448
449
450
451
452









453
454
455
456
457
458
459
**
** Verify that the cursor holds the mutex on its BtShared
*/
#ifdef SQLITE_DEBUG
static int cursorHoldsMutex(BtCursor *p){
  return sqlite3_mutex_held(p->pBt->mutex);
}









static int cursorOwnsBtShared(BtCursor *p){
  assert( cursorHoldsMutex(p) );
  return (p->pBtree->db==p->pBt->db);
}
#endif

/*







>
>
>
>
>
>
>
>
>







446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
**
** Verify that the cursor holds the mutex on its BtShared
*/
#ifdef SQLITE_DEBUG
static int cursorHoldsMutex(BtCursor *p){
  return sqlite3_mutex_held(p->pBt->mutex);
}

/* Verify that the cursor and the BtShared agree about what is the current
** database connetion. This is important in shared-cache mode. If the database 
** connection pointers get out-of-sync, it is possible for routines like
** btreeInitPage() to reference an stale connection pointer that references a
** a connection that has already closed.  This routine is used inside assert()
** statements only and for the purpose of double-checking that the btree code
** does keep the database connection pointers up-to-date.
*/
static int cursorOwnsBtShared(BtCursor *p){
  assert( cursorHoldsMutex(p) );
  return (p->pBtree->db==p->pBt->db);
}
#endif

/*