Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Ensure randomly generated rowids never go negative. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
631423677bd7043e99987edc63300544 |
User & Date: | shaneh 2010-09-01 02:37:56.000 |
Context
2010-09-01
| ||
02:38 | Fix some compiler warnings under MSVC. (check-in: afdc82a99e user: shaneh tags: trunk) | |
02:37 | Ensure randomly generated rowids never go negative. (check-in: 631423677b user: shaneh tags: trunk) | |
2010-08-31
| ||
16:25 | Do not clear the internal "schema has changed" flag when performing a savepoint rollback. The schema changes may not have taken place within the savepoint being rolled back. (check-in: c2a84430d3 user: dan tags: trunk) | |
Changes
Changes to src/vdbe.c.
︙ | ︙ | |||
3715 3716 3717 3718 3719 3720 3721 3722 3723 | /* IMPLEMENTATION-OF: R-48598-02938 If the largest ROWID is equal to the ** largest possible integer (9223372036854775807) then the database ** engine starts picking candidate ROWIDs at random until it finds one ** that is not previously used. */ assert( pOp->p3==0 ); /* We cannot be in random rowid mode if this is ** an AUTOINCREMENT table. */ v = db->lastRowid; cnt = 0; | > > > < > | | < > | | > > > > < | < > | 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 | /* IMPLEMENTATION-OF: R-48598-02938 If the largest ROWID is equal to the ** largest possible integer (9223372036854775807) then the database ** engine starts picking candidate ROWIDs at random until it finds one ** that is not previously used. */ assert( pOp->p3==0 ); /* We cannot be in random rowid mode if this is ** an AUTOINCREMENT table. */ /* on the first attempt, simply do one more than previous */ v = db->lastRowid; v &= (MAX_ROWID>>1); /* ensure doesn't go negative */ v++; /* ensure non-zero */ cnt = 0; while( ((rc = sqlite3BtreeMovetoUnpacked(pC->pCursor, 0, (u64)v, 0, &res))==SQLITE_OK) && (res==0) && (++cnt<100)){ /* collision - try another random rowid */ sqlite3_randomness(sizeof(v), &v); if( cnt<5 ){ /* try "small" random rowids for the initial attempts */ v &= 0xffffff; }else{ v &= (MAX_ROWID>>1); /* ensure doesn't go negative */ } v++; /* ensure non-zero */ } if( rc==SQLITE_OK && res==0 ){ rc = SQLITE_FULL; /* IMP: R-38219-53002 */ goto abort_due_to_error; } } pC->rowidIsValid = 0; pC->deferredMoveto = 0; |
︙ | ︙ |