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

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

                Author: ASF GitHub Bot
            Created on: 26/Jan/23 16:51
            Start Date: 26/Jan/23 16:51
    Worklog Time Spent: 10m 
      Work Description: tabish121 commented on code in PR #4344:
URL: https://github.com/apache/activemq-artemis/pull/4344#discussion_r1088098728


##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java:
##########
@@ -213,9 +217,9 @@ public void awaitLiveNode() throws NodeManagerException, 
InterruptedException {
                logger.debug("awaiting live node failing back");
                Thread.sleep(2000);
             } else if (state == FileLockNodeManager.LIVE) {
-               if (logger.isDebugEnabled()) {
-                  logger.debug("acquired live node lock state = {}", (char) 
state);
-               }
+               logger.debug("acquired live node lock state = {}", (char) 
state);
+               serverLockFile.setLastModified(System.currentTimeMillis());
+               logger.debug("touched " + serverLockFile.getAbsoluteFile() + "; 
new time: " + serverLockFile.lastModified());

Review Comment:
   Logger should be using formatting as to string concatenations.



##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java:
##########
@@ -429,16 +435,19 @@ protected FileLock lock(final int lockPosition) throws 
ActiveMQLockAcquisitionTi
             FileLock lock = tryLock(lockPosition);
             isRecurringFailure = false;
 
+            logger.debug("lock: " + lock);

Review Comment:
   Fix logger formatting as above



##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java:
##########
@@ -554,9 +572,26 @@ public void run() {
             logger.warn("Lost the lock according to the monitor, notifying 
listeners");
             notifyLostLock();
          }
-
       }
 
-   }
+      private boolean hasBeenModified() {
+         boolean modified = false;
+
+         // Create a new instance of the File object so we can get the most 
up-to-date information on the file.
+         File freshServerLockFile = new File(serverLockFile.getAbsolutePath());
 
+         if (freshServerLockFile.exists()) {
+            logger.debug(freshServerLockFile.lastModified() + " > " + 
serverLockLastModified + "?");
+            if (freshServerLockFile.lastModified() > serverLockLastModified) {
+               logger.debug("Lock file " + serverLockFile.getAbsolutePath() + 
" originally locked at " + new Date(serverLockLastModified) + " was modified at 
" + new Date(freshServerLockFile.lastModified()));

Review Comment:
   Fix logger formatting as above



##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java:
##########
@@ -554,9 +572,26 @@ public void run() {
             logger.warn("Lost the lock according to the monitor, notifying 
listeners");
             notifyLostLock();
          }
-
       }
 
-   }
+      private boolean hasBeenModified() {
+         boolean modified = false;
+
+         // Create a new instance of the File object so we can get the most 
up-to-date information on the file.
+         File freshServerLockFile = new File(serverLockFile.getAbsolutePath());
 
+         if (freshServerLockFile.exists()) {
+            logger.debug(freshServerLockFile.lastModified() + " > " + 
serverLockLastModified + "?");
+            if (freshServerLockFile.lastModified() > serverLockLastModified) {
+               logger.debug("Lock file " + serverLockFile.getAbsolutePath() + 
" originally locked at " + new Date(serverLockLastModified) + " was modified at 
" + new Date(freshServerLockFile.lastModified()));
+               modified = true;
+            }
+         } else {
+            logger.debug("Lock file " + serverLockFile.getAbsolutePath() + " 
does not exist");

Review Comment:
   Fix logger formatting as above



##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/FileLockNodeManager.java:
##########
@@ -345,6 +349,8 @@ private void writeFileLockStatus(byte status) throws 
NodeManagerException {
                lock.release();
             }
          }
+         serverLockLastModified = serverLockFile.lastModified();
+         logger.debug("Modified " + serverLockFile.getName() + " at " + 
serverLockLastModified);

Review Comment:
   Fix logger formatting as above





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

    Worklog Id:     (was: 841786)
    Time Spent: 20m  (was: 10m)

> Improve mitigation against split-brain with shared-storage
> ----------------------------------------------------------
>
>                 Key: ARTEMIS-4143
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-4143
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>            Reporter: Justin Bertram
>            Assignee: Justin Bertram
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to