SQLite4
Check-in [511a91e121]
Not logged in

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

Overview
Comment:Fix another bug to do with large key-value pairs.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | multi-process
Files: files | file ages | folders
SHA1: 511a91e121a9b9c5958eba8c6bea2094b4660d1c
User & Date: dan 2012-08-25 19:17:18
Context
2012-08-25
20:05
Fix other problems revealed by src4.test. check-in: bfa27bab8a user: dan tags: multi-process
19:17
Fix another bug to do with large key-value pairs. check-in: 511a91e121 user: dan tags: multi-process
19:04
Fix a problem in lsm_write() occuring if the same pointer is passed as both key and value. check-in: 27ef4e84c1 user: dan tags: multi-process
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/lsm_shared.c.

638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
** not be held that long (in case it is required by a client flushing an
** in-memory tree to disk).
*/
int lsmCheckpointWrite(lsm_db *pDb){
  int rc;                         /* Return Code */

  assert( pDb->pWorker==0 );
  assert( pDb->pClient==0 );
  assert( lsmShmAssertLock(pDb, LSM_LOCK_WORKER, LSM_LOCK_UNLOCK) );

  rc = lsmShmLock(pDb, LSM_LOCK_CHECKPOINTER, LSM_LOCK_EXCL);
  if( rc!=LSM_OK ) return rc;

  rc = lsmCheckpointLoad(pDb);
  if( rc==LSM_OK ){







|







638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
** not be held that long (in case it is required by a client flushing an
** in-memory tree to disk).
*/
int lsmCheckpointWrite(lsm_db *pDb){
  int rc;                         /* Return Code */

  assert( pDb->pWorker==0 );
  assert( 1 || pDb->pClient==0 );
  assert( lsmShmAssertLock(pDb, LSM_LOCK_WORKER, LSM_LOCK_UNLOCK) );

  rc = lsmShmLock(pDb, LSM_LOCK_CHECKPOINTER, LSM_LOCK_EXCL);
  if( rc!=LSM_OK ) return rc;

  rc = lsmCheckpointLoad(pDb);
  if( rc==LSM_OK ){

Changes to src/lsm_tree.c.

635
636
637
638
639
640
641
642
643
644
645
646

647
648
649
650
651
652
653
654
  n = nRem = nKey;
  a = (u8 *)pKey;
  while( a ){
    while( nRem>0 ){
      u8 *aAlloc;
      int nAlloc;
      u32 iWrite;
      int nAvail;

      iWrite = pDb->treehdr.iWrite;
      nAvail = LSM_SHM_CHUNK_SIZE - (iWrite & (LSM_SHM_CHUNK_SIZE-1));
      assert( ((iWrite+nAvail) % LSM_SHM_CHUNK_SIZE)==0 );

      nAlloc = LSM_MIN(nAvail, nRem);

      aAlloc = treeShmptr(pDb, treeShmalloc(pDb, 0, nAlloc, pRc), pRc);
      if( aAlloc==0 ) break;
      memcpy(aAlloc, &a[n-nRem], nAlloc);
      nRem -= nAlloc;
    }
    a = pVal;







<

|
<
<
>
|







635
636
637
638
639
640
641

642
643


644
645
646
647
648
649
650
651
652
  n = nRem = nKey;
  a = (u8 *)pKey;
  while( a ){
    while( nRem>0 ){
      u8 *aAlloc;
      int nAlloc;
      u32 iWrite;


      iWrite = (pDb->treehdr.iWrite & (LSM_SHM_CHUNK_SIZE-1));


      iWrite = LSM_MAX(iWrite, LSM_SHM_CHUNK_HDR);
      nAlloc = LSM_MIN((LSM_SHM_CHUNK_SIZE-iWrite), nRem);

      aAlloc = treeShmptr(pDb, treeShmalloc(pDb, 0, nAlloc, pRc), pRc);
      if( aAlloc==0 ) break;
      memcpy(aAlloc, &a[n-nRem], nAlloc);
      nRem -= nAlloc;
    }
    a = pVal;