sashapolo commented on code in PR #6839:
URL: https://github.com/apache/ignite-3/pull/6839#discussion_r2481052765


##########
modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/segstore/IndexMemTable.java:
##########
@@ -114,6 +114,8 @@ public Iterator<Entry<Long, SegmentInfo>> iterator() {
     private Stripe stripe(long groupId) {
         int stripeIndex = Long.hashCode(groupId) % stripes.length;
 
+        assert stripeIndex >= 0 : String.format("Stripe index must not be 
negative [groupId=%d]", groupId);

Review Comment:
   > How does this not failing yet?
   
   Because there are no tests that use `groupId` with negative hash code =)
   
   > Another question - this striping method doesn't match the distribution of 
disruptors between groups.
   
   I'll try to fix it in a separate ticket, `StripedDisruptor` mapping logic is 
not straightforward. The main reason I did it like this is because it was 
simpler (though I'd better have created a ticket then).



##########
modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/segstore/IndexMemTable.java:
##########
@@ -114,6 +114,8 @@ public Iterator<Entry<Long, SegmentInfo>> iterator() {
     private Stripe stripe(long groupId) {
         int stripeIndex = Long.hashCode(groupId) % stripes.length;
 
+        assert stripeIndex >= 0 : String.format("Stripe index must not be 
negative [groupId=%d]", groupId);

Review Comment:
   > How does this not failing yet?
   
   Because there are no tests that use `groupId` with a negative hash code =)
   
   > Another question - this striping method doesn't match the distribution of 
disruptors between groups.
   
   I'll try to fix it in a separate ticket, `StripedDisruptor` mapping logic is 
not straightforward. The main reason I did it like this is because it was 
simpler (though I'd better have created a ticket then).



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

Reply via email to