gemmellr commented on code in PR #5498: URL: https://github.com/apache/activemq-artemis/pull/5498#discussion_r1960217668
########## 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: Ok, so the comment wasnt saying "paging is not changed" in the sense that things are added/removed/updated from paging, but is more specifically saying "the 'paging' field is not altered"? The [updated] comment then at least makes sense, since the 'paging' field is seemingly only directly updated in cases that do hold the write lock. I still dont really get that timedWriter, the thing writing pages if its around, isnt ever holding the write lock, when other things that also update the pages and run on different threads, do hold it. Surely that means those two things can happen concurrently with each other? Plus that timedWriter can also update things concurrent with stuff that hold the read or write lock? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For additional commands, e-mail: gitbox-h...@activemq.apache.org For further information, visit: https://activemq.apache.org/contact