1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-19 21:43:15 +03:00

Redefine the way PRAGMA data_version works: It continues to change when

any other connection commits, including shared-cache connections, but does not
change if the local connection commits.

FossilOrigin-Name: 7a97826f33460f3b4f3890c9cf97116c3355eeda
This commit is contained in:
drh
2014-12-22 18:41:21 +00:00
parent dd31b4e709
commit 3da9c04712
5 changed files with 114 additions and 54 deletions

View File

@@ -3550,6 +3550,7 @@ int sqlite3BtreeCommitPhaseTwo(Btree *p, int bCleanup){
sqlite3BtreeLeave(p);
return rc;
}
p->iDataVersion--; /* Compensate for pPager->iDataVersion++; */
pBt->inTransaction = TRANS_READ;
btreeClearHasContent(pBt);
}
@@ -8195,7 +8196,7 @@ void sqlite3BtreeGetMeta(Btree *p, int idx, u32 *pMeta){
assert( idx>=0 && idx<=15 );
if( idx==BTREE_DATA_VERSION ){
*pMeta = sqlite3PagerDataVersion(pBt->pPager);
*pMeta = sqlite3PagerDataVersion(pBt->pPager) + p->iDataVersion;
}else{
*pMeta = get4byte(&pBt->pPage1->aData[36 + idx*4]);
}

View File

@@ -351,6 +351,7 @@ struct Btree {
u8 locked; /* True if db currently has pBt locked */
int wantToLock; /* Number of nested calls to sqlite3BtreeEnter() */
int nBackup; /* Number of backup operations reading this btree */
u32 iDataVersion; /* Combines with pBt->pPager->iDataVersion */
Btree *pNext; /* List of other sharable Btrees from the same db */
Btree *pPrev; /* Back pointer of the same list */
#ifndef SQLITE_OMIT_SHARED_CACHE