]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix some problems with large, compressed, lsm databases.
authordan <Dan Kennedy>
Mon, 9 Jan 2023 21:10:42 +0000 (21:10 +0000)
committerdan <Dan Kennedy>
Mon, 9 Jan 2023 21:10:42 +0000 (21:10 +0000)
FossilOrigin-Name: 956e985ff9bf8f21a048e49f7190bcc52ec4a7d35ecd685b0a293a01c9777a96

ext/lsm1/lsmInt.h
ext/lsm1/lsm_ckpt.c
ext/lsm1/lsm_file.c
ext/lsm1/lsm_main.c
ext/lsm1/lsm_sorted.c
ext/lsm1/lsm_varint.c
manifest
manifest.uuid

index 0f822e47932f28074cfdd8909a6d81078707663d..c8e917ea1ccc0fed8542f1a3902ffca941ecbdb0 100644 (file)
@@ -405,7 +405,7 @@ struct Segment {
   LsmPgno iFirst;                  /* First page of this run */
   LsmPgno iLastPg;                 /* Last page of this run */
   LsmPgno iRoot;                   /* Root page number (if any) */
-  int nSize;                       /* Size of this run in pages */
+  LsmPgno nSize;                   /* Size of this run in pages */
 
   Redirect *pRedirect;             /* Block redirects (or NULL) */
 };
@@ -853,6 +853,8 @@ int lsmVarintGet32(u8 *, int *);
 int lsmVarintPut64(u8 *aData, i64 iVal);
 int lsmVarintGet64(const u8 *aData, i64 *piVal);
 
+int lsmVarintLen64(i64);
+
 int lsmVarintLen32(int);
 int lsmVarintSize(u8 c);
 
index ba92a823cf9274eaf842438d924050b93f8d9796..1c4f788ad654e32d3d071f4587a64d08f283f7b5 100644 (file)
@@ -511,7 +511,7 @@ static void ckptNewSegment(
   pSegment->iFirst = ckptGobble64(aIn, piIn);
   pSegment->iLastPg = ckptGobble64(aIn, piIn);
   pSegment->iRoot = ckptGobble64(aIn, piIn);
-  pSegment->nSize = (int)ckptGobble64(aIn, piIn);
+  pSegment->nSize = ckptGobble64(aIn, piIn);
   assert( pSegment->iFirst );
 }
 
index 1dcdd05d997895a8d136bed90af8c9361c1d48f2..fd78835bbb0be978a6d5460540847583d486f866 100644 (file)
@@ -215,8 +215,8 @@ struct FileSystem {
   char *zLog;                     /* Database file name */
   int nMetasize;                  /* Size of meta pages in bytes */
   int nMetaRwSize;                /* Read/written size of meta pages in bytes */
-  int nPagesize;                  /* Database page-size in bytes */
-  int nBlocksize;                 /* Database block-size in bytes */
+  i64 nPagesize;                  /* Database page-size in bytes */
+  i64 nBlocksize;                 /* Database block-size in bytes */
 
   /* r/w file descriptors for both files. */
   LsmFile *pLsmFile;              /* Used after lsm_close() to link into list */
@@ -889,7 +889,7 @@ static LsmPgno fsFirstPageOnBlock(FileSystem *pFS, int iBlock){
       iPg = pFS->nBlocksize * (LsmPgno)(iBlock-1) + 4;
     }
   }else{
-    const int nPagePerBlock = (pFS->nBlocksize / pFS->nPagesize);
+    const i64 nPagePerBlock = (pFS->nBlocksize / pFS->nPagesize);
     if( iBlock==1 ){
       iPg = 1 + ((pFS->nMetasize*2 + pFS->nPagesize - 1) / pFS->nPagesize);
     }else{
@@ -1131,7 +1131,6 @@ static void fsGrowMapping(
   i64 iSz,                        /* Minimum size to extend mapping to */
   int *pRc                        /* IN/OUT: Error code */
 ){
-  assert( pFS->pCompress==0 );
   assert( PAGE_HASPREV==4 );
 
   if( *pRc==LSM_OK && iSz>pFS->nMap ){
@@ -1872,7 +1871,7 @@ void lsmFsGobble(
   assert( nPgno>0 && 0==fsPageRedirects(pFS, pRun, aPgno[0]) );
 
   iBlk = fsPageToBlock(pFS, pRun->iFirst);
-  pRun->nSize += (int)(pRun->iFirst - fsFirstPageOnBlock(pFS, iBlk));
+  pRun->nSize += (pRun->iFirst - fsFirstPageOnBlock(pFS, iBlk));
 
   while( rc==LSM_OK ){
     int iNext = 0;
@@ -1883,13 +1882,13 @@ void lsmFsGobble(
     }
     rc = fsBlockNext(pFS, pRun, iBlk, &iNext);
     if( rc==LSM_OK ) rc = fsFreeBlock(pFS, pSnapshot, pRun, iBlk);
-    pRun->nSize -= (int)(
+    pRun->nSize -= (
         1 + fsLastPageOnBlock(pFS, iBlk) - fsFirstPageOnBlock(pFS, iBlk)
     );
     iBlk = iNext;
   }
 
-  pRun->nSize -= (int)(pRun->iFirst - fsFirstPageOnBlock(pFS, iBlk));
+  pRun->nSize -= (pRun->iFirst - fsFirstPageOnBlock(pFS, iBlk));
   assert( pRun->nSize>0 );
 }
 
index a9c48e004e9df0c639944a2a65e91803c3cc278b..f2b353105a508b291b3d952adbaabb600a7473eb 100644 (file)
@@ -432,7 +432,7 @@ int lsm_config(lsm_db *pDb, int eParam, ...){
 }
 
 void lsmAppendSegmentList(LsmString *pStr, char *zPre, Segment *pSeg){
-  lsmStringAppendf(pStr, "%s{%d %d %d %d}", zPre, 
+  lsmStringAppendf(pStr, "%s{%lld %lld %lld %lld}", zPre, 
         pSeg->iFirst, pSeg->iLastPg, pSeg->iRoot, pSeg->nSize
   );
 }
index 4a24e4b82919db0d3990d06a0ab3154c64779060..d73ece74b83a5a3865b91fd118bc5e5b92dedfb9 100644 (file)
@@ -657,14 +657,14 @@ static int btreeCursorLoadKey(BtreeCursor *pCsr){
   return rc;
 }
 
-static int btreeCursorPtr(u8 *aData, int nData, int iCell){
+static LsmPgno btreeCursorPtr(u8 *aData, int nData, int iCell){
   int nCell;
 
   nCell = pageGetNRec(aData, nData);
   if( iCell>=nCell ){
-    return (int)pageGetPtr(aData, nData);
+    return pageGetPtr(aData, nData);
   }
-  return (int)pageGetRecordPtr(aData, nData, iCell);
+  return pageGetRecordPtr(aData, nData, iCell);
 }
 
 static int btreeCursorNext(BtreeCursor *pCsr){
@@ -751,7 +751,7 @@ static int btreeCursorFirst(BtreeCursor *pCsr){
 
   Page *pPg = 0;
   FileSystem *pFS = pCsr->pFS;
-  int iPg = (int)pCsr->pSeg->iRoot;
+  LsmPgno iPg = pCsr->pSeg->iRoot;
 
   do {
     rc = lsmFsDbPageGet(pFS, pCsr->pSeg, iPg, &pPg);
@@ -779,7 +779,7 @@ static int btreeCursorFirst(BtreeCursor *pCsr){
         assert( pCsr->aPg[pCsr->nDepth].iCell==0 );
         pCsr->aPg[pCsr->nDepth].pPage = pPg;
         pCsr->nDepth++;
-        iPg = (int)pageGetRecordPtr(aData, nData, 0);
+        iPg = pageGetRecordPtr(aData, nData, 0);
       }
     }
   }while( rc==LSM_OK );
@@ -871,7 +871,7 @@ static int btreeCursorRestore(
       int nSeek;
       int iTopicSeek;
       int iPg = 0;
-      int iLoad = (int)pSeg->iRoot;
+      LsmPgno iLoad = pSeg->iRoot;
       Page *pPg = pCsr->aPg[nDepth-1].pPage;
  
       if( pageObjGetNRec(pPg)==0 ){
@@ -903,7 +903,7 @@ static int btreeCursorRestore(
           aData = fsPageData(pPg2, &nData);
           assert( (pageGetFlags(aData, nData) & SEGMENT_BTREE_FLAG) );
 
-          iLoad = (int)pageGetPtr(aData, nData);
+          iLoad = pageGetPtr(aData, nData);
           iCell2 = pageGetNRec(aData, nData); 
           iMax = iCell2-1;
           iMin = 0;
@@ -926,7 +926,7 @@ static int btreeCursorRestore(
             assert( res!=0 );
 
             if( res<0 ){
-              iLoad = (int)iPtr;
+              iLoad = iPtr;
               iCell2 = iTry;
               iMax = iTry-1;
             }else{
@@ -1013,7 +1013,7 @@ static void segmentPtrSetPage(SegmentPtr *pPtr, Page *pNext){
 static int segmentPtrLoadPage(
   FileSystem *pFS,
   SegmentPtr *pPtr,              /* Load page into this SegmentPtr object */
-  int iNew                       /* Page number of new page */
+  LsmPgno iNew                       /* Page number of new page */
 ){
   Page *pPg = 0;                 /* The new page */
   int rc;                        /* Return Code */
@@ -1633,7 +1633,7 @@ static int segmentPtrSeek(
   int iTopic,                     /* Key topic to seek to */
   void *pKey, int nKey,           /* Key to seek to */
   int eSeek,                      /* Search bias - see above */
-  int *piPtr,                     /* OUT: FC pointer */
+  LsmPgno *piPtr,                 /* OUT: FC pointer */
   int *pbStop
 ){
   int (*xCmp)(void *, int, void *, int) = pCsr->pDb->xCmp;
@@ -1759,7 +1759,7 @@ static int segmentPtrSeek(
   }
 
   assert( rc!=LSM_OK || assertSeekResult(pCsr,pPtr,iTopic,pKey,nKey,eSeek) );
-  *piPtr = (int)iPtrOut;
+  *piPtr = iPtrOut;
   return rc;
 }
 
@@ -1773,11 +1773,11 @@ static int seekInBtree(
 ){
   int i = 0;
   int rc;
-  int iPg;
+  LsmPgno iPg;
   Page *pPg = 0;
   LsmBlob blob = {0, 0, 0};
 
-  iPg = (int)pSeg->iRoot;
+  iPg = pSeg->iRoot;
   do {
     LsmPgno *piFirst = 0;
     if( aPg ){
@@ -1799,7 +1799,7 @@ static int seekInBtree(
       flags = pageGetFlags(aData, nData);
       if( (flags & SEGMENT_BTREE_FLAG)==0 ) break;
 
-      iPg = (int)pageGetPtr(aData, nData);
+      iPg = pageGetPtr(aData, nData);
       nRec = pageGetNRec(aData, nData);
 
       iMin = 0;
@@ -1825,7 +1825,7 @@ static int seekInBtree(
             pCsr->pDb->xCmp, iTopic, pKey, nKey, iTopicT, pKeyT, nKeyT
         );
         if( res<0 ){
-          iPg = (int)iPtr;
+          iPg = iPtr;
           iMax = iTry-1;
         }else{
           iMin = iTry+1;
@@ -1853,10 +1853,10 @@ static int seekInSegment(
   void *pKey, int nKey,
   int iPg,                        /* Page to search */
   int eSeek,                      /* Search bias - see above */
-  int *piPtr,                     /* OUT: FC pointer */
+  LsmPgno *piPtr,                 /* OUT: FC pointer */
   int *pbStop                     /* OUT: Stop search flag */
 ){
-  int iPtr = iPg;
+  LsmPgno iPtr = iPg;
   int rc = LSM_OK;
 
   if( pPtr->pSeg->iRoot ){
@@ -1866,7 +1866,7 @@ static int seekInSegment(
     if( rc==LSM_OK ) segmentPtrSetPage(pPtr, pPg);
   }else{
     if( iPtr==0 ){
-      iPtr = (int)pPtr->pSeg->iFirst;
+      iPtr = pPtr->pSeg->iFirst;
     }
     if( rc==LSM_OK ){
       rc = segmentPtrLoadPage(pCsr->pDb->pFS, pPtr, iPtr);
@@ -1904,7 +1904,7 @@ static int seekInLevel(
 ){
   Level *pLvl = aPtr[0].pLevel;   /* Level to seek within */
   int rc = LSM_OK;                /* Return code */
-  int iOut = 0;                   /* Pointer to return to caller */
+  LsmPgno iOut = 0;               /* Pointer to return to caller */
   int res = -1;                   /* Result of xCmp(pKey, split) */
   int nRhs = pLvl->nRight;        /* Number of right-hand-side segments */
   int bStop = 0;
@@ -1923,8 +1923,8 @@ static int seekInLevel(
   ** left-hand-side of the level in this case.  */
   if( res<0 ){
     int i;
-    int iPtr = 0;
-    if( nRhs==0 ) iPtr = (int)*piPgno;
+    LsmPgno iPtr = 0;
+    if( nRhs==0 ) iPtr = *piPgno;
 
     rc = seekInSegment(
         pCsr, &aPtr[0], iTopic, pKey, nKey, iPtr, eSeek, &iOut, &bStop
@@ -1939,7 +1939,7 @@ static int seekInLevel(
   
   if( res>=0 ){
     int bHit = 0;                 /* True if at least one rhs is not EOF */
-    int iPtr = (int)*piPgno;
+    LsmPgno iPtr = *piPgno;
     int i;
     segmentPtrReset(&aPtr[0], LSM_SEGMENTPTR_FREE_THRESHOLD);
     for(i=1; rc==LSM_OK && i<=nRhs && bStop==0; i++){
@@ -3480,7 +3480,7 @@ static int mergeWorkerLoadHierarchy(MergeWorker *pMW){
     lsm_env *pEnv = pMW->pDb->pEnv;
     Page **apHier = 0;
     int nHier = 0;
-    int iPg = (int)pSeg->iRoot;
+    LsmPgno iPg = pSeg->iRoot;
 
     do {
       Page *pPg = 0;
@@ -3506,7 +3506,7 @@ static int mergeWorkerLoadHierarchy(MergeWorker *pMW){
         nHier++;
 
         apHier[0] = pPg;
-        iPg = (int)pageGetPtr(aData, nData);
+        iPg = pageGetPtr(aData, nData);
       }else{
         lsmFsPageRelease(pPg);
         break;
@@ -3625,10 +3625,11 @@ static int mergeWorkerBtreeWrite(
       assert( lsmFsPageWritable(pOld) );
       aData = fsPageData(pOld, &nData);
       if( eType==0 ){
-        nByte = 2 + 1 + lsmVarintLen32((int)iPtr) + lsmVarintLen32((int)iKeyPg);
+        nByte = 2 + 1 + lsmVarintLen64(iPtr) + lsmVarintLen64(iKeyPg);
       }else{
-        nByte = 2 + 1 + lsmVarintLen32((int)iPtr) + lsmVarintLen32(nKey) + nKey;
+        nByte = 2 + 1 + lsmVarintLen64(iPtr) + lsmVarintLen32(nKey) + nKey;
       }
+
       nRec = pageGetNRec(aData, nData);
       nFree = SEGMENT_EOF(nData, nRec) - mergeWorkerPageOffset(aData, nData);
       if( nByte<=nFree ) break;
@@ -3672,11 +3673,11 @@ static int mergeWorkerBtreeWrite(
   lsmPutU16(&aData[SEGMENT_NRECORD_OFFSET(nData)], (u16)(nRec+1));
   if( eType==0 ){
     aData[iOff++] = 0x00;
-    iOff += lsmVarintPut32(&aData[iOff], (int)iPtr);
-    iOff += lsmVarintPut32(&aData[iOff], (int)iKeyPg);
+    iOff += lsmVarintPut64(&aData[iOff], iPtr);
+    iOff += lsmVarintPut64(&aData[iOff], iKeyPg);
   }else{
     aData[iOff++] = eType;
-    iOff += lsmVarintPut32(&aData[iOff], (int)iPtr);
+    iOff += lsmVarintPut64(&aData[iOff], iPtr);
     iOff += lsmVarintPut32(&aData[iOff], nKey);
     memcpy(&aData[iOff], pKey, nKey);
   }
@@ -3872,7 +3873,7 @@ static int mergeWorkerNextPage(
 static int mergeWorkerData(
   MergeWorker *pMW,               /* Merge worker object */
   int bSep,                       /* True to write to separators run */
-  int iFPtr,                      /* Footer ptr for new pages */
+  LsmPgno iFPtr,                  /* Footer ptr for new pages */
   u8 *aWrite,                     /* Write data from this buffer */
   int nWrite                      /* Size of aWrite[] in bytes */
 ){
@@ -3916,14 +3917,14 @@ static int mergeWorkerData(
 static int mergeWorkerFirstPage(MergeWorker *pMW){
   int rc = LSM_OK;                /* Return code */
   Page *pPg = 0;                  /* First page of run pSeg */
-  int iFPtr = 0;                  /* Pointer value read from footer of pPg */
+  LsmPgno iFPtr = 0;              /* Pointer value read from footer of pPg */
   MultiCursor *pCsr = pMW->pCsr;
 
   assert( pMW->pPage==0 );
 
   if( pCsr->pBtCsr ){
     rc = LSM_OK;
-    iFPtr = (int)pMW->pLevel->pNext->lhs.iFirst;
+    iFPtr = pMW->pLevel->pNext->lhs.iFirst;
   }else if( pCsr->nPtr>0 ){
     Segment *pSeg;
     pSeg = pCsr->aPtr[pCsr->nPtr-1].pSeg;
@@ -3932,7 +3933,7 @@ static int mergeWorkerFirstPage(MergeWorker *pMW){
       u8 *aData;                    /* Buffer for page pPg */
       int nData;                    /* Size of aData[] in bytes */
       aData = fsPageData(pPg, &nData);
-      iFPtr = (int)pageGetPtr(aData, nData);
+      iFPtr = pageGetPtr(aData, nData);
       lsmFsPageRelease(pPg);
     }
   }
@@ -3951,7 +3952,7 @@ static int mergeWorkerWrite(
   int eType,                      /* One of SORTED_SEPARATOR, WRITE or DELETE */
   void *pKey, int nKey,           /* Key value */
   void *pVal, int nVal,           /* Value value */
-  int iPtr                        /* Absolute value of page pointer, or 0 */
+  LsmPgno iPtr                    /* Absolute value of page pointer, or 0 */
 ){
   int rc = LSM_OK;                /* Return code */
   Merge *pMerge;                  /* Persistent part of level merge state */
@@ -3960,8 +3961,8 @@ static int mergeWorkerWrite(
   u8 *aData;                      /* Data buffer for page pWriter->pPage */
   int nData = 0;                  /* Size of buffer aData[] in bytes */
   int nRec = 0;                   /* Number of records on page pPg */
-  int iFPtr = 0;                  /* Value of pointer in footer of pPg */
-  int iRPtr = 0;                  /* Value of pointer written into record */
+  LsmPgno iFPtr = 0;              /* Value of pointer in footer of pPg */
+  LsmPgno iRPtr = 0;              /* Value of pointer written into record */
   int iOff = 0;                   /* Current write offset within page pPg */
   Segment *pSeg;                  /* Segment being written */
   int flags = 0;                  /* If != 0, flags value for page footer */
@@ -3978,7 +3979,7 @@ static int mergeWorkerWrite(
   if( pPg ){
     aData = fsPageData(pPg, &nData);
     nRec = pageGetNRec(aData, nData);
-    iFPtr = (int)pageGetPtr(aData, nData);
+    iFPtr = pageGetPtr(aData, nData);
     iRPtr = iPtr - iFPtr;
   }
      
@@ -4009,7 +4010,7 @@ static int mergeWorkerWrite(
         assert( aData );
         memset(&aData[iOff], 0, SEGMENT_EOF(nData, nRec)-iOff);
       }
-      iFPtr = (int)*pMW->pCsr->pPrevMergePtr;
+      iFPtr = *pMW->pCsr->pPrevMergePtr;
       iRPtr = iPtr - iFPtr;
       iOff = 0;
       nRec = 0;
@@ -4283,7 +4284,7 @@ static int mergeWorkerStep(MergeWorker *pMW){
         pVal = pCsr->val.pData;
       }
       if( rc==LSM_OK ){
-        rc = mergeWorkerWrite(pMW, eType, pKey, nKey, pVal, nVal, (int)iPtr);
+        rc = mergeWorkerWrite(pMW, eType, pKey, nKey, pVal, nVal, iPtr);
       }
     }
   }
@@ -4604,7 +4605,7 @@ static int mergeWorkerInit(
           SegmentPtr *pPtr;
           assert( pCsr->aPtr[i].pPg==0 );
           pPtr = &pCsr->aPtr[i];
-          rc = segmentPtrLoadPage(pDb->pFS, pPtr, (int)pInput->iPg);
+          rc = segmentPtrLoadPage(pDb->pFS, pPtr, pInput->iPg);
           if( rc==LSM_OK && pPtr->nCell>0 ){
             rc = segmentPtrLoadCell(pPtr, pInput->iCell);
           }
@@ -5469,7 +5470,7 @@ int lsmFlushTreeToDisk(lsm_db *pDb){
 ** be freed by the caller using lsmFree().
 */
 static char *segToString(lsm_env *pEnv, Segment *pSeg, int nMin){
-  int nSize = pSeg->nSize;
+  LsmPgno nSize = pSeg->nSize;
   LsmPgno iRoot = pSeg->iRoot;
   LsmPgno iFirst = pSeg->iFirst;
   LsmPgno iLast = pSeg->iLastPg;
@@ -5481,9 +5482,9 @@ static char *segToString(lsm_env *pEnv, Segment *pSeg, int nMin){
 
   z1 = lsmMallocPrintf(pEnv, "%d.%d", iFirst, iLast);
   if( iRoot ){
-    z2 = lsmMallocPrintf(pEnv, "root=%d", iRoot);
+    z2 = lsmMallocPrintf(pEnv, "root=%lld", iRoot);
   }else{
-    z2 = lsmMallocPrintf(pEnv, "size=%d", nSize);
+    z2 = lsmMallocPrintf(pEnv, "size=%lld", nSize);
   }
 
   nPad = nMin - 2 - strlen(z1) - 1 - strlen(z2);
@@ -5536,7 +5537,7 @@ void sortedDumpPage(lsm_db *pDb, Segment *pRun, Page *pPg, int bVals){
   int i;
 
   int nRec;
-  int iPtr;
+  LsmPgno iPtr;
   int flags;
   u8 *aData;
   int nData;
@@ -5544,11 +5545,11 @@ void sortedDumpPage(lsm_db *pDb, Segment *pRun, Page *pPg, int bVals){
   aData = fsPageData(pPg, &nData);
 
   nRec = pageGetNRec(aData, nData);
-  iPtr = (int)pageGetPtr(aData, nData);
+  iPtr = pageGetPtr(aData, nData);
   flags = pageGetFlags(aData, nData);
 
   lsmStringInit(&s, pDb->pEnv);
-  lsmStringAppendf(&s,"nCell=%d iPtr=%d flags=%d {", nRec, iPtr, flags);
+  lsmStringAppendf(&s,"nCell=%d iPtr=%lld flags=%d {", nRec, iPtr, flags);
   if( flags&SEGMENT_BTREE_FLAG ) iPtr = 0;
 
   for(i=0; i<nRec; i++){
@@ -5558,13 +5559,13 @@ void sortedDumpPage(lsm_db *pDb, Segment *pRun, Page *pPg, int bVals){
     u8 *aVal = 0; int nVal = 0;   /* Value */
     int iTopic;
     u8 *aCell;
-    int iPgPtr;
+    i64 iPgPtr;
     int eType;
 
     aCell = pageGetCell(aData, nData, i);
     eType = *aCell++;
     assert( (flags & SEGMENT_BTREE_FLAG) || eType!=0 );
-    aCell += lsmVarintGet32(aCell, &iPgPtr);
+    aCell += lsmVarintGet64(aCell, &iPgPtr);
 
     if( eType==0 ){
       LsmPgno iRef;               /* Page number of referenced page */
@@ -5590,7 +5591,7 @@ void sortedDumpPage(lsm_db *pDb, Segment *pRun, Page *pPg, int bVals){
       }
     }
 
-    lsmStringAppendf(&s, " %d", iPgPtr+iPtr);
+    lsmStringAppendf(&s, " %lld", iPgPtr+iPtr);
     lsmFsPageRelease(pRef);
   }
   lsmStringAppend(&s, "}", 1);
@@ -5720,20 +5721,20 @@ static int infoPageDump(
     int nKeyWidth = 0;
     LsmString str;
     int nRec;
-    int iPtr;
+    LsmPgno iPtr;
     int flags2;
     int iCell;
     u8 *aData; int nData;         /* Page data and size thereof */
 
     aData = fsPageData(pPg, &nData);
     nRec = pageGetNRec(aData, nData);
-    iPtr = (int)pageGetPtr(aData, nData);
+    iPtr = pageGetPtr(aData, nData);
     flags2 = pageGetFlags(aData, nData);
 
     lsmStringInit(&str, pDb->pEnv);
     lsmStringAppendf(&str, "Page : %lld  (%d bytes)\n", iPg, nData);
     lsmStringAppendf(&str, "nRec : %d\n", nRec);
-    lsmStringAppendf(&str, "iPtr : %d\n", iPtr);
+    lsmStringAppendf(&str, "iPtr : %lld\n", iPtr);
     lsmStringAppendf(&str, "flags: %04x\n", flags2);
     lsmStringAppendf(&str, "\n");
 
index c550a6405dbcadf3f42c0a6f9dfa1d85d88bd067..f690e3b0630fa05023c84d318af62286c8ee5c19 100644 (file)
@@ -185,6 +185,11 @@ int lsmVarintLen32(int n){
   return lsmVarintPut32(aData, n);
 }
 
+int lsmVarintLen64(i64 n){
+  u8 aData[9];
+  return lsmVarintPut64(aData, n);
+}
+
 /*
 ** The argument is the first byte of a varint. This function returns the
 ** total number of bytes in the entire varint (including the first byte).
index ad32f5d6f339e88316250eefb7b462a75c6812a7..62ed6f69d513d20b914441900aea1fe920da4f80 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Clarify\shelp\sfor\s.quit.
-D 2023-01-09T18:42:28.572
+C Fix\ssome\sproblems\swith\slarge,\scompressed,\slsm\sdatabases.
+D 2023-01-09T21:10:42.176
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -267,19 +267,19 @@ F ext/lsm1/lsm-test/lsmtest_tdb4.c cbe230727b9413d244062943371af1421ace472ccb023
 F ext/lsm1/lsm-test/lsmtest_util.c 241622db5a332a09c8e6e7606b617d288a37b557f7d3bce0bb97809f67cc2806
 F ext/lsm1/lsm-test/lsmtest_win32.c 0e0a224674c4d3170631c41b026b56c7e1672b151f5261e1b4cc19068641da2d
 F ext/lsm1/lsm.h 0f6f64ff071471cb87bf98beb8386566f30ea001
-F ext/lsm1/lsmInt.h 5983690e05e83653cc01ba9d8fbf8455e534ddf8349ed9adedbf46a7549760b0
-F ext/lsm1/lsm_ckpt.c 0eabfaf812ddb4ea43add38f05e430694cd054eb622c3e35af4c43118a2d5321
-F ext/lsm1/lsm_file.c 3c51841d5b3e7da162693cbac9a9f47eeedf6bcbbe2969a4d25e30c428c9fe36
+F ext/lsm1/lsmInt.h 22ed041ac98a94b654432c33e0857d0a128e35d1935f2ce49f64614f03607929
+F ext/lsm1/lsm_ckpt.c ad9a8028d401be9e76f20c4d86d49f33f4fc27785577b452ca955094314a72b4
+F ext/lsm1/lsm_file.c 5486f4a63b19e4d7d972ee2482f29ebdf06c29544f31845f713cccb5199f9ad1
 F ext/lsm1/lsm_log.c a8bf334532109bba05b09a504ee45fc393828b0d034ca61ab45e3940709d9a7c
-F ext/lsm1/lsm_main.c b5703f8042e71d3a2d65e671f6832e077e79e89e9975818f67f969922618db63
+F ext/lsm1/lsm_main.c 87770a9c7e73859fce7620cb79623776ba4b30369086229ad82c3e6eeaf45457
 F ext/lsm1/lsm_mem.c 4c51ea9fa285ee6e35301b33491642d071740a0a
 F ext/lsm1/lsm_mutex.c 378edf0a2b142b4f7640ee982df06d50b98788ea
 F ext/lsm1/lsm_shared.c c67282a4f2c91e2a3362bdd40a81f9041cd587973ffc4bca8b8fbdab5470dee1
-F ext/lsm1/lsm_sorted.c 6f7d8cf7a7d3d3f1ab5d9ba6347e8f39f3d73c00ec48afcd0c4bcbefd806f9b8
+F ext/lsm1/lsm_sorted.c cb163ee5792ddc93f23c9ce061a29a50237afe89296f196d13bfe561c2d58e13
 F ext/lsm1/lsm_str.c 65e361b488c87b10bf3e5c0070b14ffc602cf84f094880bece77bbf6678bca82
 F ext/lsm1/lsm_tree.c 682679d7ef2b8b6f2fe77aeb532c8d29695bca671c220b0abac77069de5fb9fb
 F ext/lsm1/lsm_unix.c 11e0a5c19d754a4e1d93dfad06de8cc201f10f886b8e61a4c599ed34e334fc24
-F ext/lsm1/lsm_varint.c 43f954af668a66c7928b81597c14d6ad4be9fedbc276bbd80f52fa28a02fdb62
+F ext/lsm1/lsm_varint.c fe134ad7b2db1ecd99b6a155d2f3625cfd497730e227ae18892452e457b73327
 F ext/lsm1/lsm_vtab.c e57aa3eb456bf2b98064014027e097c9402d6dec7b59564ddbfa1c0ead8f96c5
 F ext/lsm1/lsm_win32.c 0a4acbd7e8d136dd3a5753f0a9e7a9802263a9d96cef3278cf120bcaa724db7c
 F ext/lsm1/test/lsm1_common.tcl 5ed4bab07c93be2e4f300ebe46007ecf4b3e20bc5fbe1dedaf04a8774a6d8d82
@@ -2068,8 +2068,11 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 51a5d83c425d2e31508b73074d0076156817afb19003f847d16bf4a69ae5077b
-R 8395315325bf5149aaad0d9cbdb3c545
-U larrybr
-Z fb84b72fb0f5e2ad6df153dcba612d13
+P 8004a2b7439748f1034df897af7b6c58b48a46923c6fdddbe7d78c89b8d7b438
+R 86a61cb54cd9cd01f7c6dd3cac50589c
+T *branch * lsm-compress-fixes
+T *sym-lsm-compress-fixes *
+T -sym-trunk *
+U dan
+Z d1ca1a8619727c2f60a4fecfd62964f0
 # Remove this line to create a well-formed Fossil manifest.
index 4b9fb9b09a16160d7d63005bc327b6de15f9d36c..e91d1a823cf85b55168dcb3aee2230a9a0245461 100644 (file)
@@ -1 +1 @@
-8004a2b7439748f1034df897af7b6c58b48a46923c6fdddbe7d78c89b8d7b438
\ No newline at end of file
+956e985ff9bf8f21a048e49f7190bcc52ec4a7d35ecd685b0a293a01c9777a96
\ No newline at end of file