[ 
https://issues.apache.org/jira/browse/DERBY-3092?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Knut Anders Hatlen updated DERBY-3092:
--------------------------------------

    Attachment: derby-3092-4a-more-visitors.diff

Attaching new patch derby-3092-4a-more-visitors.diff.

This patch replaces the for loops that use explicit synchronization on trans, 
with visitors (in addition to the two methods hasActiveUpdateTransaction() and 
toString() that probably should have used synchronization in the first place). 
Now, visitEntries() is the only method that explicitly synchronizes on trans.

I think most of the changes are pretty straightforward, and don't look too 
ugly... Some details that might be worth mentioning:

- the return type of the visit() method was changed from void to boolean, so 
that the visitor has a way to stop the scan. This is useful if we're looking 
for the first entry to match a certain condition, and we don't want to continue 
scanning the transaction table once we've found the entry of interest.

- for brevity, the visitors don't check whether entries are null. Most of the 
for loops did, but since a Hashtable cannot contain null as key or value, those 
checks are unnecessary and misleading.

- hasActiveUpdateTransaction() and writeExternal() use the same visitor class 
to count the number of update transactions, with a parameter to tell whether it 
should stop as soon as it finds one update transaction (for hasActiveUT) or if 
it should count all update transactions (for writeExternal)

- in writeExternal() an ASSERT was added to verify that the number of 
transactions written to the log is equal to the number of transactions we 
expected to write (otherwise, the log will most likely be corrupted)

All the regression tests passed with this patch.

> Use java.util.concurrent in TransactionTable to improve scalability
> -------------------------------------------------------------------
>
>                 Key: DERBY-3092
>                 URL: https://issues.apache.org/jira/browse/DERBY-3092
>             Project: Derby
>          Issue Type: Improvement
>          Components: Store
>    Affects Versions: 10.3.1.4
>            Reporter: Dyre Tjeldvoll
>            Assignee: Knut Anders Hatlen
>         Attachments: derby-3092-1a-map.diff, derby-3092-1b-map.diff, 
> derby-3092-2a-count.diff, derby-3092-3a-xa-visitor.diff, 
> derby-3092-4a-more-visitors.diff, xact-concept.diff, xact-concept.png
>
>
> Running scalability tests with the client and buffer manager from DERBY-2911 
> shows that access to the TransactionTable.trans (a Hashtable) and 
> XactFactory.tranId (a shared long) are the next major sources of contention. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to