Issue Details (XML | Word | Printable)

Key: CORE-4432
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Vlad Khorsun
Reporter: Vlad Khorsun
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Let attachments to not block others when allocation table is read first time

Created: 15/May/14 09:40 PM   Updated: 23/Sep/15 12:19 PM
Component/s: Engine
Affects Version/s: 2.1.5, 2.5.2, 2.1.5 Update 1, 2.5.2 Update 1, 3.0 Alpha 1, 3.0 Alpha 2
Fix Version/s: 2.5.3, 3.0 Beta 1

QA Status: Cannot be tested


 Description  « Hide
The issue:
- every new attachment need to read nbackup allocation table from disk (i.e. from a delta file)
- while reading, attachment holds SH lock on allocation table, so all readers share this lock and proceed in parallel
- when some other attachment need to allocate new page in delta file, it acquires EX lock on alloc table.
  This lock request go to common queue AND blocks all next requests for the same lock despite of they level.
- when new attachments established very often, some of them will be put in queue after EX lock requests and
  will wait until current SH owners finish they work (could be long enough if they are read whole allocation table)
  and until blocked EX owner finish its work (write 2 or 3 pages in allocation table)

The improvement:
Start to read allocation table not acquiring alloc lock at all and acquire SH lock only when last page of allocation
table is read.
This is safe because allocation table is appended only and already full pages are never modified.
So, we can significantly reduce period of time when SH lock must be hold by new attachments.



 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.