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

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

                Author: ASF GitHub Bot
            Created on: 05/Aug/21 11:24
            Start Date: 05/Aug/21 11:24
    Worklog Time Spent: 10m 
      Work Description: clebertsuconic commented on a change in pull request 
#3680:
URL: https://github.com/apache/activemq-artemis/pull/3680#discussion_r682666830



##########
File path: 
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java
##########
@@ -85,16 +89,22 @@
 import 
org.apache.activemq.artemis.core.server.group.impl.GroupingHandlerConfiguration;
 import org.apache.activemq.artemis.core.server.impl.AddressInfo;
 import org.apache.activemq.artemis.core.server.impl.InVMNodeManager;
+import org.apache.activemq.artemis.quorum.file.FileBasedPrimitiveManager;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.apache.activemq.artemis.utils.PortCheckRule;
 import org.jboss.logging.Logger;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.rules.TemporaryFolder;
 
 public abstract class ClusterTestBase extends ActiveMQTestBase {
 
+   @Rule
+   public TemporaryFolder tmpFolder = new TemporaryFolder();

Review comment:
       don't create a new TemporaryFolder please. ActiveMQTestBase already have 
one... now when we run tests we will need to deal with two temporary folders.. 
which is not easier for debugging.
   
   
   (I will send you a PR removing this one)

##########
File path: 
artemis-quorum-ri/src/test/java/org/apache/activemq/artemis/quorum/file/FileDistributedLockTest.java
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.quorum.file;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collections;
+import java.util.Map;
+
+import org.apache.activemq.artemis.quorum.DistributedLockTest;
+import org.apache.activemq.artemis.quorum.DistributedPrimitiveManager;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+public class FileDistributedLockTest extends DistributedLockTest {
+
+   @Rule
+   public TemporaryFolder tmpFolder = new TemporaryFolder();

Review comment:
       another temporary folder? please take it out? use the one from the top.

##########
File path: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ReplicationPrimaryActivation.java
##########
@@ -75,7 +73,7 @@
 
    private final DistributedPrimitiveManager distributedManager;
 
-   private final AtomicBoolean stoppingServer;
+   private volatile boolean stoppingServer;

Review comment:
       I didn't mean to make this change

##########
File path: 
artemis-commons/src/test/java/org/apache/activemq/artemis/utils/ThreadLeakCheckRule.java
##########
@@ -270,6 +270,18 @@ private boolean isExpectedThread(Thread thread) {
       } else if (threadName.contains("ObjectCleanerThread")) {
          // Required since upgrade to Netty 4.1.22 maybe because 
https://github.com/netty/netty/commit/739e70398ccb6b11ffa97c6b5f8d55e455a2165e
          return true;
+      } else if (threadName.contains("RMI TCP")) {
+         return true;
+      } else if (threadName.contains("RMI Scheduler")) {
+         return true;
+      } else if (threadName.contains("RMI RenewClean")) {

Review comment:
       Are you sure you're not hiding a thread leakage? can't you just stop the 
RMI Stub on this case?

##########
File path: 
artemis-quorum-api/src/main/java/org/apache/activemq/artemis/quorum/MutableLong.java
##########
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.activemq.artemis.quorum;
+
+public interface MutableLong extends AutoCloseable {

Review comment:
       Can you called this as MutableSequence, since it seems to be used on 
Sequence Management on Distributed Lock?
   
   
   or if you don't want to change it.. can you add some javadoc on how this is 
used please? Perhaps both?

##########
File path: 
artemis-quorum-ri/src/main/java/org/apache/activemq/artemis/quorum/file/FileBasedPrimitiveManager.java
##########
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.quorum.file;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.apache.activemq.artemis.quorum.DistributedLock;
+import org.apache.activemq.artemis.quorum.DistributedPrimitiveManager;
+import org.apache.activemq.artemis.quorum.MutableLong;
+
+/**
+ * This is an implementation suitable to be used just on unit tests and it 
won't attempt
+ * to manage nor purge existing stale locks files. It's part of the tests 
life-cycle to properly
+ * set-up and tear-down the environment.
+ */
+public class FileBasedPrimitiveManager implements DistributedPrimitiveManager {

Review comment:
       Could this be used for SharedStorage as well? did you make any changes 
into that part?

##########
File path: 
artemis-quorum-ri/src/test/java/org/apache/activemq/artemis/quorum/file/FileDistributedLockTest.java
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.quorum.file;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collections;
+import java.util.Map;
+
+import org.apache.activemq.artemis.quorum.DistributedLockTest;
+import org.apache.activemq.artemis.quorum.DistributedPrimitiveManager;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+public class FileDistributedLockTest extends DistributedLockTest {
+
+   @Rule
+   public TemporaryFolder tmpFolder = new TemporaryFolder();

Review comment:
       I sent a PR removing these

##########
File path: 
tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/quorum/ZookeeperPluggableQuorumPeerTest.java
##########
@@ -0,0 +1,109 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.artemis.tests.smoke.quorum;
+
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.Objects;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.activemq.artemis.util.ServerUtil;
+import org.apache.activemq.artemis.utils.Wait;
+import org.jboss.logging.Logger;
+import org.junit.Assert;
+import org.junit.Test;
+
+import static 
org.apache.activemq.artemis.tests.smoke.utils.Jmx.containsExactNodeIds;
+import static 
org.apache.activemq.artemis.tests.smoke.utils.Jmx.validateNetworkTopology;
+import static org.apache.activemq.artemis.tests.smoke.utils.Jmx.withBackup;
+import static org.apache.activemq.artemis.tests.smoke.utils.Jmx.withLive;
+import static org.apache.activemq.artemis.tests.smoke.utils.Jmx.withMembers;
+import static org.apache.activemq.artemis.tests.smoke.utils.Jmx.withNodes;
+
+public class ZookeeperPluggableQuorumPeerTest extends 
ZookeeperPluggableQuorumSinglePairTest {
+
+   private static final Logger LOGGER = 
Logger.getLogger(ZookeeperPluggableQuorumPeerTest.class);
+
+   public ZookeeperPluggableQuorumPeerTest() {
+      super();
+      // accepting the primary/backup vars to reuse the test, for peers, these 
are interchangeable as either can take
+      // both roles as both wish to be primary but will revert to backup
+      primary = new BrokerControl("primary-peer-a", JMX_PORT_PRIMARY, 
"zkReplicationPrimaryPeerA", PRIMARY_PORT_OFFSET);
+      backup = new BrokerControl("primary-peer-b", JMX_PORT_BACKUP, 
"zkReplicationPrimaryPeerB", BACKUP_PORT_OFFSET);
+      brokers = new LinkedList(Arrays.asList(primary, backup));
+   }
+
+   @Test
+   @Override
+   public void testBackupFailoverAndPrimaryFailback() throws Exception {
+      // peers don't request fail back by default
+      // just wait for setup to avoid partial stop of zk via fast tear down 
with async setup
+      Wait.waitFor(this::ensembleHasLeader);
+   }
+
+   @Test
+   public void testMultiPrimary_Peer() throws Exception {
+
+      final int timeout = (int) TimeUnit.SECONDS.toMillis(30);
+      LOGGER.info("starting peer b primary");
+
+      Process backupInstance = backup.startServer(this, timeout);
+
+      // alive as unreplicated, it has configured node id
+      assertTrue(Wait.waitFor(() -> 1L == 
backup.getActivationSequence().orElse(Long.MAX_VALUE).longValue()));
+
+      final String nodeID = backup.getNodeID().get();
+      Assert.assertNotNull(nodeID);
+      LOGGER.infof("NodeID: %s", nodeID);
+
+      LOGGER.info("starting peer a primary");
+      Process primaryInstance = primary.startServer(this, 0);

Review comment:
       this variable is not used.




-- 
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: [email protected]

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


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

    Worklog Id:     (was: 634199)
    Time Spent: 28h 20m  (was: 28h 10m)

> Implements pluggable Quorum Vote
> --------------------------------
>
>                 Key: ARTEMIS-2716
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2716
>             Project: ActiveMQ Artemis
>          Issue Type: New Feature
>            Reporter: Francesco Nigro
>            Assignee: Francesco Nigro
>            Priority: Major
>         Attachments: backup.png, primary.png
>
>          Time Spent: 28h 20m
>  Remaining Estimate: 0h
>
> This task aim to ideliver a new Quorum Vote mechanism for artemis with the 
> objectives:
> # to make it pluggable
> # to cleanly separate the election phase and the cluster member states
> # to simplify most common setups in both amount of configuration and 
> requirements (eg "witness" nodes could be implemented to support single 
> master-slave pairs)
> Post-actions to help people adopt it, but need to be thought upfront:
> # a clean upgrade path for current HA replication users
> # deprecate or integrate the current HA replication into the new version



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

Reply via email to