SQLite

Check-in [a5a085483c]
Login

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

Overview
Comment:Add a missing releasePage() call to the server-mode free-list management code.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | server-edition
Files: files | file ages | folders
SHA3-256: a5a085483c66b17727cf4d2a15165621016031ab78990cb5977ccdbd231d13ac
User & Date: dan 2017-04-28 14:09:55.552
Context
2017-04-28
17:32
Fix various bugs revealed by running performance tests. (check-in: a40b42c422 user: dan tags: server-edition)
14:09
Add a missing releasePage() call to the server-mode free-list management code. (check-in: a5a085483c user: dan tags: server-edition)
10:20
Use a different free-list format for server-mode databases in order to reduce contention. (check-in: 778e8a102d user: dan tags: server-edition)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/btree.c.
5835
5836
5837
5838
5839
5840
5841

5842
5843
5844
5845
5846
5847
5848
        put4byte(&pTrunk->aData[4], 0);
      }
      releasePage(pPage);
    }else{
      put4byte(&pTrunk->aData[8+nFree*4], iPage);
      put4byte(&pTrunk->aData[4], (u32)nFree+1);
    }

  }

  return rc;
}

#else
# define allocateServerPage(v, w, x, y, z) SQLITE_OK







>







5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
        put4byte(&pTrunk->aData[4], 0);
      }
      releasePage(pPage);
    }else{
      put4byte(&pTrunk->aData[8+nFree*4], iPage);
      put4byte(&pTrunk->aData[4], (u32)nFree+1);
    }
    releasePage(pTrunk);
  }

  return rc;
}

#else
# define allocateServerPage(v, w, x, y, z) SQLITE_OK
Changes to src/server.c.
392
393
394
395
396
397
398

399


400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419

420


421
422
423
424
425
426
427
  return rc;
}

/*
** Begin a transaction.
*/
int sqlite3ServerBegin(Server *p){

  return posixLock(p->pHma->fd, p->iClient+1, SERVER_WRITE_LOCK, 0);


}

/*
** End a transaction (and release all locks).
*/
int sqlite3ServerEnd(Server *p){
  int i;
  for(i=0; i<p->nLock; i++){
    u32 *pSlot = serverPageLockSlot(p, p->aLock[i]);
    while( 1 ){
      u32 v = *pSlot;
      u32 n = v;
      if( (v>>HMA_CLIENT_SLOTS)==p->iClient+1 ){
        n = n & ((1 << HMA_CLIENT_SLOTS)-1);
      }
      n = n & ~(1 << p->iClient);
      if( __sync_val_compare_and_swap(pSlot, v, n)==v ) break;
    }
  }
  p->nLock = 0;

  return posixLock(p->pHma->fd, p->iClient+1, SERVER_READ_LOCK, 0);


}

/*
** Release all write-locks.
*/
int sqlite3ServerReleaseWriteLocks(Server *p){
  int rc = SQLITE_OK;







>

>
>




















>

>
>







392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
  return rc;
}

/*
** Begin a transaction.
*/
int sqlite3ServerBegin(Server *p){
#if 0
  return posixLock(p->pHma->fd, p->iClient+1, SERVER_WRITE_LOCK, 0);
#endif
  return SQLITE_OK;
}

/*
** End a transaction (and release all locks).
*/
int sqlite3ServerEnd(Server *p){
  int i;
  for(i=0; i<p->nLock; i++){
    u32 *pSlot = serverPageLockSlot(p, p->aLock[i]);
    while( 1 ){
      u32 v = *pSlot;
      u32 n = v;
      if( (v>>HMA_CLIENT_SLOTS)==p->iClient+1 ){
        n = n & ((1 << HMA_CLIENT_SLOTS)-1);
      }
      n = n & ~(1 << p->iClient);
      if( __sync_val_compare_and_swap(pSlot, v, n)==v ) break;
    }
  }
  p->nLock = 0;
#if 0
  return posixLock(p->pHma->fd, p->iClient+1, SERVER_READ_LOCK, 0);
#endif
  return SQLITE_OK;
}

/*
** Release all write-locks.
*/
int sqlite3ServerReleaseWriteLocks(Server *p){
  int rc = SQLITE_OK;
Changes to test/permutations.test.
273
274
275
276
277
278
279

280
281
282
283
284
285
286
  All FTS5 tests.
} -files [glob -nocomplain $::testdir/../ext/fts5/test/*.test]

test_suite "server" -prefix "" -description {
  All server-edition tests.
} -files [
  test_set \

      [glob -nocomplain $::testdir/server*.test] \
      -exclude *server1.test
]

test_suite "fts5-light" -prefix "" -description {
  All FTS5 tests.
} -files [







>







273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
  All FTS5 tests.
} -files [glob -nocomplain $::testdir/../ext/fts5/test/*.test]

test_suite "server" -prefix "" -description {
  All server-edition tests.
} -files [
  test_set \
      select1.test \
      [glob -nocomplain $::testdir/server*.test] \
      -exclude *server1.test
]

test_suite "fts5-light" -prefix "" -description {
  All FTS5 tests.
} -files [