[jira] [Commented] (RATIS-94) Expose basic information over JMX

2017-07-31 Thread Jing Zhao (JIRA)

[ 
https://issues.apache.org/jira/browse/RATIS-94?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16107935#comment-16107935
 ] 

Jing Zhao commented on RATIS-94:


Thanks for updating the patch, [~elek]. The latest patch looks good to me. Only 
one further comment related to the {{getFollowers}}: copying the leaderState 
reference and getting its follower information should be fine, but we also need 
to be careful about the concurrent ops on the follower list in LeaderState. 
Besides, adding an API which directly returns the original follower list from 
the LeaderState may not be a good idea (from the encapsulation point of view). 
So my suggestion is:
# Change {{LeaderState#senders}} into a synchronized list.
# We can replace {{LeaderState#getSenders}} with a method which returns 
follower information as a List.


> Expose basic information over JMX
> -
>
> Key: RATIS-94
> URL: https://issues.apache.org/jira/browse/RATIS-94
> Project: Ratis
>  Issue Type: Improvement
>Reporter: Elek, Marton
>Assignee: Elek, Marton
> Attachments: RATIS-94-1.patch, RATIS-94.2.patch
>
>
> To make it easier to debug the current state of the nodes the basic 
> RatisServer information should be exposed over the JMX interface. Such as: 
> role (leader,follower), latest term, index, follower peers (in case of LEADER)



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (RATIS-96) LeaderState computeLastCommitted may throw ArrayIndexOutOfBoundsException

2017-07-31 Thread Tsz Wo Nicholas Sze (JIRA)

 [ 
https://issues.apache.org/jira/browse/RATIS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tsz Wo Nicholas Sze updated RATIS-96:
-
Attachment: r96_20170731.patch

r96_20170731.patch: some minor changes to the test messages.

> LeaderState computeLastCommitted may throw ArrayIndexOutOfBoundsException
> -
>
> Key: RATIS-96
> URL: https://issues.apache.org/jira/browse/RATIS-96
> Project: Ratis
>  Issue Type: Bug
>Reporter: Tsz Wo Nicholas Sze
>Assignee: Tsz Wo Nicholas Sze
> Attachments: r96_20170720.patch, r96_20170725.patch, 
> r96_20170727.patch, r96_20170731.patch
>
>
> {code}
> java.lang.ArrayIndexOutOfBoundsException: 0
>   at 
> org.apache.ratis.server.impl.LeaderState.computeLastCommitted(LeaderState.java:490)
>   at 
> org.apache.ratis.server.impl.LeaderState.updateLastCommitted(LeaderState.java:400)
>   at 
> org.apache.ratis.server.impl.LeaderState.handleEvent(LeaderState.java:329)
>   at 
> org.apache.ratis.server.impl.LeaderState.access$500(LeaderState.java:48)
> {code}
> This happens when followers is empty and not includeSelf == false.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Comment Edited] (RATIS-97) Leader may not have majority after setConfiguration

2017-07-31 Thread Tsz Wo Nicholas Sze (JIRA)

[ 
https://issues.apache.org/jira/browse/RATIS-97?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16105361#comment-16105361
 ] 

Tsz Wo Nicholas Sze edited comment on RATIS-97 at 7/31/17 9:20 PM:
---

> ... a new leader needs to get majority from both the old configuration and 
> the new configuration, ...

But how would the new servers know about the old configuration in the first 
place?  Currently, we just start new servers with one configuration.

> Do you have a test case for this scenario, Nicholas?

Yes, I discovered this bug from RATIS-96.  With the patch there, we can easily 
modify testReinitialize9Nodes.  Then run it with Grpc repeatedly.  It should 
fail within a few times.
{code}
diff --git 
a/ratis-server/src/test/java/org/apache/ratis/server/impl/ReinitializationBaseTest.java
 
b/ratis-server/src/test/java/org/apache/ratis/server/impl/ReinitializationBaseTest.java
index 20b8680..f4ce320 100644
--- 
a/ratis-server/src/test/java/org/apache/ratis/server/impl/ReinitializationBaseTest.java
+++ 
b/ratis-server/src/test/java/org/apache/ratis/server/impl/ReinitializationBaseTest.java
@@ -106,7 +106,7 @@ public abstract class ReinitializationBaseTest {
   @Test
   public void testReinitialize9Nodes() throws Exception {
 final int[] idIndex = {5, 8, 9};
-runTestReinitializeMultiGroups(idIndex, 0);
+runTestReinitializeMultiGroups(idIndex, 2);
   }
 
   private void runTestReinitializeMultiGroups(int[] idIndex, int chosen) 
throws Exception {
{code}


was (Author: szetszwo):
> ... a new leader needs to get majority from both the old configuration and 
> the new configuration, ...

But how would the new servers know about the old configuration in the first 
place?  Currently, we just start new servers with one configuration.

> Do you have a test case for this scenario, Nicholas?

Yes, I discovered this bug from RATIS-96.  With the patch there, we can easily 
add a test.
{code}
  @Test
  public void testReinitialize9Nodes() throws Exception {
final int[] idIndex = {3, 9};
runTestReinitializeMultiGroups(idIndex, 0);
  }
{code}

> Leader may not have majority after setConfiguration
> ---
>
> Key: RATIS-97
> URL: https://issues.apache.org/jira/browse/RATIS-97
> Project: Ratis
>  Issue Type: Bug
>Reporter: Tsz Wo Nicholas Sze
>Assignee: Tsz Wo Nicholas Sze
> Attachments: r97_20170728.patch
>
>
> Here is an example: Suppose a group has 3 servers and one of them is the 
> leader.  Use setConfiguration to add 6 more servers.  The leader is still 
> running as a leader although it does not has majority anymore.  The 6 new 
> servers may elect a new leader among them.  Finally, there are two leaders in 
> the group.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (RATIS-97) Leader may not have majority after setConfiguration

2017-07-31 Thread Tsz Wo Nicholas Sze (JIRA)

 [ 
https://issues.apache.org/jira/browse/RATIS-97?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tsz Wo Nicholas Sze updated RATIS-97:
-
Attachment: r97_20170731.patch

r97_20170731.patch: updates with the patch in RATIS-96.

The patch fixes the test failure described in [this 
comment|https://issues.apache.org/jira/browse/RATIS-97?focusedCommentId=16105361&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16105361]

> Leader may not have majority after setConfiguration
> ---
>
> Key: RATIS-97
> URL: https://issues.apache.org/jira/browse/RATIS-97
> Project: Ratis
>  Issue Type: Bug
>Reporter: Tsz Wo Nicholas Sze
>Assignee: Tsz Wo Nicholas Sze
> Attachments: r97_20170728.patch, r97_20170731.patch
>
>
> Here is an example: Suppose a group has 3 servers and one of them is the 
> leader.  Use setConfiguration to add 6 more servers.  The leader is still 
> running as a leader although it does not has majority anymore.  The 6 new 
> servers may elect a new leader among them.  Finally, there are two leaders in 
> the group.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (RATIS-98) Cache RaftId byte[] and String

2017-07-31 Thread Tsz Wo Nicholas Sze (JIRA)

 [ 
https://issues.apache.org/jira/browse/RATIS-98?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tsz Wo Nicholas Sze updated RATIS-98:
-
Attachment: r98_20170731.patch

r98_20170731.patch: reverts "renames getPeersInGroup() to getGroup() in 
ReinitializeRequest"

Moved the change to RATIS-97.

> Cache RaftId byte[] and String
> --
>
> Key: RATIS-98
> URL: https://issues.apache.org/jira/browse/RATIS-98
> Project: Ratis
>  Issue Type: Improvement
>Reporter: Tsz Wo Nicholas Sze
>Assignee: Tsz Wo Nicholas Sze
>Priority: Minor
> Attachments: r98_20170727.patch, r98_20170731.patch
>
>
> RaftId may convert the same UUID to byte[] and String multiple times.  It is 
> better to cache it.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Assigned] (RATIS-11) Better retry policy support for Raft client

2017-07-31 Thread Jing Chen (JIRA)

 [ 
https://issues.apache.org/jira/browse/RATIS-11?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jing Chen reassigned RATIS-11:
--

Assignee: Jing Chen

> Better retry policy support for Raft client
> ---
>
> Key: RATIS-11
> URL: https://issues.apache.org/jira/browse/RATIS-11
> Project: Ratis
>  Issue Type: Improvement
>Reporter: Jing Zhao
>Assignee: Jing Chen
>
> We should have better retry policy support on the raft client side, such as 
> different retry policies, more flexible retry parameter settings, etc.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (RATIS-96) LeaderState computeLastCommitted may throw ArrayIndexOutOfBoundsException

2017-07-31 Thread Jing Zhao (JIRA)

[ 
https://issues.apache.org/jira/browse/RATIS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16108401#comment-16108401
 ] 

Jing Zhao commented on RATIS-96:


+1. I will commit the patch shortly.

> LeaderState computeLastCommitted may throw ArrayIndexOutOfBoundsException
> -
>
> Key: RATIS-96
> URL: https://issues.apache.org/jira/browse/RATIS-96
> Project: Ratis
>  Issue Type: Bug
>Reporter: Tsz Wo Nicholas Sze
>Assignee: Tsz Wo Nicholas Sze
> Attachments: r96_20170720.patch, r96_20170725.patch, 
> r96_20170727.patch, r96_20170731.patch
>
>
> {code}
> java.lang.ArrayIndexOutOfBoundsException: 0
>   at 
> org.apache.ratis.server.impl.LeaderState.computeLastCommitted(LeaderState.java:490)
>   at 
> org.apache.ratis.server.impl.LeaderState.updateLastCommitted(LeaderState.java:400)
>   at 
> org.apache.ratis.server.impl.LeaderState.handleEvent(LeaderState.java:329)
>   at 
> org.apache.ratis.server.impl.LeaderState.access$500(LeaderState.java:48)
> {code}
> This happens when followers is empty and not includeSelf == false.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Resolved] (RATIS-96) LeaderState computeLastCommitted may throw ArrayIndexOutOfBoundsException

2017-07-31 Thread Jing Zhao (JIRA)

 [ 
https://issues.apache.org/jira/browse/RATIS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jing Zhao resolved RATIS-96.

   Resolution: Fixed
Fix Version/s: 0.2.0-alpha

I've committed the patch. Thanks for the fix, Nicholas!

> LeaderState computeLastCommitted may throw ArrayIndexOutOfBoundsException
> -
>
> Key: RATIS-96
> URL: https://issues.apache.org/jira/browse/RATIS-96
> Project: Ratis
>  Issue Type: Bug
>Reporter: Tsz Wo Nicholas Sze
>Assignee: Tsz Wo Nicholas Sze
> Fix For: 0.2.0-alpha
>
> Attachments: r96_20170720.patch, r96_20170725.patch, 
> r96_20170727.patch, r96_20170731.patch
>
>
> {code}
> java.lang.ArrayIndexOutOfBoundsException: 0
>   at 
> org.apache.ratis.server.impl.LeaderState.computeLastCommitted(LeaderState.java:490)
>   at 
> org.apache.ratis.server.impl.LeaderState.updateLastCommitted(LeaderState.java:400)
>   at 
> org.apache.ratis.server.impl.LeaderState.handleEvent(LeaderState.java:329)
>   at 
> org.apache.ratis.server.impl.LeaderState.access$500(LeaderState.java:48)
> {code}
> This happens when followers is empty and not includeSelf == false.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)