mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-14 00:22:38 +03:00
Fix a bug involving balance_shallow() and the sqlite_master table. (CVS 2143)
FossilOrigin-Name: 557be3ff5b1c46a3f3836ea3a9d9dede5dc46998
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
** $Id: btree.c,v 1.224 2004/11/22 19:07:10 drh Exp $
|
||||
** $Id: btree.c,v 1.225 2004/11/23 09:06:56 danielk1977 Exp $
|
||||
**
|
||||
** This file implements a external (disk-based) database using BTrees.
|
||||
** For a detailed discussion of BTrees, refer to
|
||||
@@ -4076,6 +4076,9 @@ static int balance_shallower(MemPage *pPage){
|
||||
szCell[i] = cellSizePtr(pChild, apCell[i]);
|
||||
}
|
||||
assemblePage(pPage, pChild->nCell, apCell, szCell);
|
||||
/* Copy the right-pointer of the child to the parent. */
|
||||
put4byte(&pPage->aData[pPage->hdrOffset+8],
|
||||
get4byte(&pChild->aData[pChild->hdrOffset+8]));
|
||||
freePage(pChild);
|
||||
TRACE(("BALANCE: child %d transfer to page 1\n", pChild->pgno));
|
||||
}else{
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
** file simultaneously, or one process from reading the database while
|
||||
** another is writing.
|
||||
**
|
||||
** @(#) $Id: pager.c,v 1.177 2004/11/10 15:27:38 danielk1977 Exp $
|
||||
** @(#) $Id: pager.c,v 1.178 2004/11/23 09:06:56 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@@ -3315,6 +3315,7 @@ int sqlite3pager_movepage(Pager *pPager, void *pData, Pgno pgno){
|
||||
needSyncPgno = pPg->pgno;
|
||||
assert( pPg->inJournal );
|
||||
assert( pPg->dirty );
|
||||
assert( pPager->needSync );
|
||||
}
|
||||
|
||||
/* Unlink pPg from it's hash-chain */
|
||||
@@ -3334,6 +3335,7 @@ int sqlite3pager_movepage(Pager *pPager, void *pData, Pgno pgno){
|
||||
assert( pPgOld->inJournal );
|
||||
pPg->inJournal = 1;
|
||||
pPg->needSync = 1;
|
||||
assert( pPager->needSync );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3357,11 +3359,16 @@ int sqlite3pager_movepage(Pager *pPager, void *pData, Pgno pgno){
|
||||
** Currently, no such page exists in the page-cache and the
|
||||
** Pager.aInJournal bit has been set. This needs to be remedied by loading
|
||||
** the page into the pager-cache and setting the PgHdr.needSync flag.
|
||||
**
|
||||
** The sqlite3pager_get() call may cause the journal to sync. So make
|
||||
** sure the Pager.needSync flag is set too.
|
||||
*/
|
||||
int rc;
|
||||
void *pNeedSync;
|
||||
assert( pPager->needSync );
|
||||
rc = sqlite3pager_get(pPager, needSyncPgno, &pNeedSync);
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
pPager->needSync = 1;
|
||||
DATA_TO_PGHDR(pNeedSync)->needSync = 1;
|
||||
DATA_TO_PGHDR(pNeedSync)->inJournal = 1;
|
||||
DATA_TO_PGHDR(pNeedSync)->dirty = 1;
|
||||
|
||||
Reference in New Issue
Block a user