[
https://issues.apache.org/jira/browse/ARTEMIS-5305?focusedWorklogId=957527&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-957527
]
ASF GitHub Bot logged work on ARTEMIS-5305:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 18/Feb/25 14:03
Start Date: 18/Feb/25 14:03
Worklog Time Spent: 10m
Work Description: clebertsuconic commented on code in PR #5498:
URL: https://github.com/apache/activemq-artemis/pull/5498#discussion_r1959811848
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java:
##########
@@ -1262,8 +1324,16 @@ private boolean writePage(Message message,
Transaction tx,
RouteContextList listCtx,
Function<Message, Message> pageDecorator) throws
Exception {
- lock.writeLock().lock();
-
+ if (timedWriter == null) {
+ // in case timedWriter is not being used, we need to guarantee a
writeLock.
+ // because there's no way to upgrade from reading to writeLock
+ writeLock();
+ } else {
+ // if we are using a timedWritter, we can just use a readLock to
guarantee paging is not changed
+ // this will issue the writer on a different thread, and we can just
use a readLock
+ readLock();
Review Comment:
I will improve the comment there.
We need to keep a lock while we checked for isPaging... we need to make sure
the system is paging for the entire duration of the method, hence the readLock.
When timedWriter is null (which will only happen in tests), I still need to
hold the lock, however later on when moving to a different page a writeLock
will be needed, and that would break things with a deadlock.
Issue Time Tracking
-------------------
Worklog Id: (was: 957527)
Time Spent: 1h 20m (was: 1h 10m)
> Improve performance on paging for multiple producers and optimize locking
> -------------------------------------------------------------------------
>
> Key: ARTEMIS-5305
> URL: https://issues.apache.org/jira/browse/ARTEMIS-5305
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Affects Versions: 2.39.0
> Reporter: Clebert Suconic
> Assignee: Clebert Suconic
> Priority: Major
> Labels: pull-request-available
> Fix For: 2.40.0
>
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact