SQLite

Check-in [1c94834879]
Login

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

Overview
Comment:Return an SQLITE_NOMEM error if the locking mutex fails to allocate.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | separate-lock-mutex
Files: files | file ages | folders
SHA3-256: 1c94834879be0601ac40ef3c4fb1b140f7737e89af7808f2f1db4ceb3daae19f
User & Date: drh 2018-07-23 22:55:10.825
Context
2018-07-26
21:48
In the unix VFS, give every unixInodeInfo object its own mutex, rather than using the global VFS mutex, to improve concurrency in cases where there are many threads operating on separate database files. (check-in: 22f47cf430 user: drh tags: trunk)
2018-07-23
22:55
Return an SQLITE_NOMEM error if the locking mutex fails to allocate. (Closed-Leaf check-in: 1c94834879 user: drh tags: separate-lock-mutex)
21:10
First attempt at reducing mutex contention in the unix VFS by providing a separate mutex for each unixInodeInfo object. (check-in: f69afaf00a user: drh tags: separate-lock-mutex)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/os_unix.c.
1369
1370
1371
1372
1373
1374
1375

1376





1377
1378
1379
1380
1381
1382
1383
  if( pInode==0 ){
    pInode = sqlite3_malloc64( sizeof(*pInode) );
    if( pInode==0 ){
      return SQLITE_NOMEM_BKPT;
    }
    memset(pInode, 0, sizeof(*pInode));
    memcpy(&pInode->fileId, &fileId, sizeof(fileId));

    pInode->pLockMutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);





    pInode->nRef = 1;
    pInode->pNext = inodeList;
    pInode->pPrev = 0;
    if( inodeList ) inodeList->pPrev = pInode;
    inodeList = pInode;
  }else{
    pInode->nRef++;







>
|
>
>
>
>
>







1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
  if( pInode==0 ){
    pInode = sqlite3_malloc64( sizeof(*pInode) );
    if( pInode==0 ){
      return SQLITE_NOMEM_BKPT;
    }
    memset(pInode, 0, sizeof(*pInode));
    memcpy(&pInode->fileId, &fileId, sizeof(fileId));
    if( sqlite3GlobalConfig.bCoreMutex ){
      pInode->pLockMutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);
      if( pInode->pLockMutex==0 ){
        sqlite3_free(pInode);
        return SQLITE_NOMEM_BKPT;
      }
    }
    pInode->nRef = 1;
    pInode->pNext = inodeList;
    pInode->pPrev = 0;
    if( inodeList ) inodeList->pPrev = pInode;
    inodeList = pInode;
  }else{
    pInode->nRef++;