/ Check-in [1c948348]
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 | SQL 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
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: 22f47cf4 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: 1c948348 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: f69afaf0 user: drh tags: separate-lock-mutex
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_unix.c.

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