[ 
https://issues.apache.org/jira/browse/ARTEMIS-3327?focusedWorklogId=606789&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-606789
 ]

ASF GitHub Bot logged work on ARTEMIS-3327:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 04/Jun/21 08:24
            Start Date: 04/Jun/21 08:24
    Worklog Time Spent: 10m 
      Work Description: clebertsuconic commented on a change in pull request 
#3605:
URL: https://github.com/apache/activemq-artemis/pull/3605#discussion_r644337348



##########
File path: 
artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
##########
@@ -1075,14 +1067,27 @@ private void internalAppendUpdateRecord(long id,
                                            Persister persister,
                                            Object record,
                                            boolean sync,
+                                           BiConsumer<Long, Boolean> 
updateCallback,
                                            IOCompletion callback) throws 
InterruptedException, java.util.concurrent.ExecutionException {
-      final SimpleFuture<Boolean> result = newSyncAndCallbackResult(sync, 
callback);
       appendExecutor.execute(new Runnable() {
          @Override
          public void run() {
             journalLock.readLock().lock();
             try {
                JournalRecord jrnRecord = records.get(id);
+               if (jrnRecord == null) {
+                  if (compactor == null || (!compactor.containsRecord(id))) {

Review comment:
       the compactor is only changed on writeLock. it is safe to just use the 
compactor directly here.

##########
File path: 
artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
##########
@@ -1097,26 +1102,32 @@ public void run() {
                // record==null here could only mean there is a compactor
                // computing the delete should be done after compacting is done
                if (jrnRecord == null) {
-                  compactor.addCommandUpdate(id, usedFile, 
updateRecord.getEncodeSize());
+                  if (compactor != null) {

Review comment:
       compactor is only changed on writeLock(). it is safe to use it here.

##########
File path: 
artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
##########
@@ -1129,15 +1140,17 @@ public void appendDeleteRecord(final long id, final 
boolean sync, final IOComple
 
       checkJournalIsLoaded();
       lineUpContext(callback);
-      checkKnownRecordID(id, true);
-
-      internalAppendDeleteRecord(id, sync, callback);
+      SimpleFuture<Boolean> future = new SimpleFutureImpl<>();

Review comment:
       this is not used at all.. it is just for tests.
   
   Besides there's no change here.. the previous version was doing exactly the 
same.

##########
File path: 
artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
##########
@@ -1075,14 +1067,27 @@ private void internalAppendUpdateRecord(long id,
                                            Persister persister,
                                            Object record,
                                            boolean sync,
+                                           BiConsumer<Long, Boolean> 
updateCallback,
                                            IOCompletion callback) throws 
InterruptedException, java.util.concurrent.ExecutionException {
-      final SimpleFuture<Boolean> result = newSyncAndCallbackResult(sync, 
callback);
       appendExecutor.execute(new Runnable() {
          @Override
          public void run() {
             journalLock.readLock().lock();
             try {
                JournalRecord jrnRecord = records.get(id);
+               if (jrnRecord == null) {
+                  if (compactor == null || (!compactor.containsRecord(id))) {
+                     if (updateCallback != null) {
+                        updateCallback.accept(id, false);

Review comment:
       done

##########
File path: 
artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
##########
@@ -1097,26 +1102,32 @@ public void run() {
                // record==null here could only mean there is a compactor
                // computing the delete should be done after compacting is done
                if (jrnRecord == null) {
-                  compactor.addCommandUpdate(id, usedFile, 
updateRecord.getEncodeSize());
+                  if (compactor != null) {

Review comment:
       I don't think that's a big deal but I will do it




-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 606789)
    Time Spent: 2.5h  (was: 2h 20m)

> Remove unnecessary block operations on journal update
> -----------------------------------------------------
>
>                 Key: ARTEMIS-3327
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3327
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>            Reporter: Clebert Suconic
>            Priority: Major
>          Time Spent: 2.5h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to