You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "dcapwell (via GitHub)" <gi...@apache.org> on 2024/02/13 22:23:34 UTC
[PR] CASSANDRA-19042: Repair fuzz tests fail with paxos_variant: v2 [cassandra]
dcapwell opened a new pull request, #3100:
URL: https://github.com/apache/cassandra/pull/3100
(no comment)
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19042: Repair fuzz tests fail with paxos_variant: v2 [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3100:
URL: https://github.com/apache/cassandra/pull/3100#discussion_r1488662723
##########
src/java/org/apache/cassandra/service/paxos/PaxosRepair.java:
##########
@@ -659,45 +657,24 @@ static boolean validateVersionCompatibility(CassandraVersion version)
return (version.major == 4 && version.minor > 0) || version.major > 4;
}
- static String getPeerVersion(InetAddressAndPort peer)
+ static boolean validatePeerCompatibility(IGossiper gossiper, Replica peer)
{
- EndpointState epState = Gossiper.instance.getEndpointStateForEndpoint(peer);
Review Comment:
this is duplicate logic from `Gossiper`, the only difference was
```
try
{
return value.value;
}
catch (IllegalArgumentException e)
{
return null;
}
```
Not sure how a field access leads to `IllegalArgumentException`, so removed in favor of the gossip function
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19042: Repair fuzz tests fail with paxos_variant: v2 [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3100:
URL: https://github.com/apache/cassandra/pull/3100#discussion_r1488693014
##########
test/unit/org/apache/cassandra/repair/FuzzTestBase.java:
##########
@@ -952,6 +1003,18 @@ public EndpointState getEndpointStateForEndpoint(InetAddressAndPort ep)
{
return endpoints.get(ep);
}
+
+ @Override
+ public void notifyFailureDetector(Map<InetAddressAndPort, EndpointState> remoteEpStateMap)
+ {
+
+ }
+
+ @Override
+ public void applyStateLocally(Map<InetAddressAndPort, EndpointState> epStateMap)
+ {
Review Comment:
if we were testing paxos this would be wrong... I made gossip work with this simulation logic (see https://issues.apache.org/jira/browse/CASSANDRA-18917) so we could always leverage that if we cared... but we would need to figure out a bug found In that JIRA (a node Is added to gossip but a small subset never learns this)...
So for this patch, I went with no-op
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19042: Repair fuzz tests fail with paxos_variant: v2 [cassandra]
Posted by "ekaterinadimitrova2 (via GitHub)" <gi...@apache.org>.
ekaterinadimitrova2 commented on code in PR #3100:
URL: https://github.com/apache/cassandra/pull/3100#discussion_r1535854097
##########
src/java/org/apache/cassandra/service/paxos/cleanup/PaxosRepairState.java:
##########
@@ -0,0 +1,205 @@
+/*
+ * 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.cassandra.service.paxos.cleanup;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.IdentityHashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import com.google.common.base.Preconditions;
+
+import org.apache.cassandra.concurrent.Stage;
+import org.apache.cassandra.db.SystemKeyspace;
+import org.apache.cassandra.io.FSWriteError;
+import org.apache.cassandra.locator.InetAddressAndPort;
+import org.apache.cassandra.net.Message;
+import org.apache.cassandra.repair.SharedContext;
+import org.apache.cassandra.schema.Schema;
+import org.apache.cassandra.schema.TableId;
+import org.apache.cassandra.service.paxos.Ballot;
+import org.apache.cassandra.service.paxos.PaxosState;
+import org.apache.cassandra.utils.Throwables;
+import org.apache.cassandra.utils.concurrent.IntrusiveStack;
+
+import static org.apache.cassandra.exceptions.RequestFailureReason.UNKNOWN;
+import static org.apache.cassandra.net.NoPayload.noPayload;
+
+public class PaxosRepairState
+{
+ private final SharedContext ctx;
+ private final AtomicReference<PendingCleanup> pendingCleanup = new AtomicReference();
+ private final Map<UUID, PaxosCleanupSession> sessions = new ConcurrentHashMap<>();
+ private final ConcurrentMap<TableId, PaxosTableRepairs> tableRepairsMap = new ConcurrentHashMap<>();
+
+ public PaxosRepairState(SharedContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public static PaxosRepairState instance()
+ {
+ return Holder.instance;
+ }
+
+ PaxosTableRepairs getForTable(TableId tableId)
+ {
+ return tableRepairsMap.computeIfAbsent(tableId, k -> new PaxosTableRepairs());
+ }
+
+ public void evictHungRepairs()
+ {
+ long deadline = ctx.clock().nanoTime() - TimeUnit.MINUTES.toNanos(5);
+ for (PaxosTableRepairs repairs : tableRepairsMap.values())
+ repairs.evictHungRepairs(deadline);
+ }
+
+ public void clearRepairs()
+ {
+ for (PaxosTableRepairs repairs : tableRepairsMap.values())
+ repairs.clear();
+ }
+
+
+ public void setSession(PaxosCleanupSession session)
+ {
+ //TODO (review): I copy/pasted from PaxosCleanupSession... this is a check-then-act pattern which is not thread safe...
Review Comment:
Incremental changes are ok. I guess it is also in 4.1 so not a regression? Let's open a ticket for the community so someone can pick it up
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19042: Repair fuzz tests fail with paxos_variant: v2 [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3100:
URL: https://github.com/apache/cassandra/pull/3100#discussion_r1488681228
##########
src/java/org/apache/cassandra/service/paxos/cleanup/PaxosTableRepairs.java:
##########
@@ -211,25 +208,4 @@ AbstractPaxosRepair createRepair(DecoratedKey key, Ballot incompleteBallot, Cons
{
return PaxosRepair.create(consistency, key, incompleteBallot, table);
}
-
- private static final ConcurrentMap<TableId, PaxosTableRepairs> tableRepairsMap = new ConcurrentHashMap<>();
Review Comment:
moved to `org.apache.cassandra.service.paxos.cleanup.PaxosRepairState`
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19042: Repair fuzz tests fail with paxos_variant: v2 [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3100:
URL: https://github.com/apache/cassandra/pull/3100#discussion_r1538228488
##########
src/java/org/apache/cassandra/service/paxos/cleanup/PaxosRepairState.java:
##########
@@ -0,0 +1,205 @@
+/*
+ * 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.cassandra.service.paxos.cleanup;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.IdentityHashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import com.google.common.base.Preconditions;
+
+import org.apache.cassandra.concurrent.Stage;
+import org.apache.cassandra.db.SystemKeyspace;
+import org.apache.cassandra.io.FSWriteError;
+import org.apache.cassandra.locator.InetAddressAndPort;
+import org.apache.cassandra.net.Message;
+import org.apache.cassandra.repair.SharedContext;
+import org.apache.cassandra.schema.Schema;
+import org.apache.cassandra.schema.TableId;
+import org.apache.cassandra.service.paxos.Ballot;
+import org.apache.cassandra.service.paxos.PaxosState;
+import org.apache.cassandra.utils.Throwables;
+import org.apache.cassandra.utils.concurrent.IntrusiveStack;
+
+import static org.apache.cassandra.exceptions.RequestFailureReason.UNKNOWN;
+import static org.apache.cassandra.net.NoPayload.noPayload;
+
+public class PaxosRepairState
Review Comment:
> Tracks the state of paxos repair cleanup work
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19042: Repair fuzz tests fail with paxos_variant: v2 [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3100:
URL: https://github.com/apache/cassandra/pull/3100#discussion_r1488684610
##########
test/unit/org/apache/cassandra/repair/FuzzTestBase.java:
##########
@@ -339,6 +346,12 @@ public Set<Faults> apply(Cluster.Node node, Message<?> message)
// these messages are not resilent to ephemeral issues
case STATUS_REQ:
case STATUS_RSP:
+ // paxos repair does not support faults and will cause a TIMEOUT error, failing the repair
Review Comment:
I tested each verb and we lead to `timeout` in different code paths... some times the user is told its paxos related, some times not... logs are always clear though at least...
This patch does not try to make these messages resilient to dropped messages or concurrent retries, so opts-out so these messages will be happy path only.
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19042: Repair fuzz tests fail with paxos_variant: v2 [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3100:
URL: https://github.com/apache/cassandra/pull/3100#discussion_r1488687259
##########
test/unit/org/apache/cassandra/repair/FuzzTestBase.java:
##########
@@ -776,10 +790,46 @@ public void onFailure(InetAddressAndPort from, RequestFailureReason failureReaso
}
}
+ private static class CallbackKey
Review Comment:
repair doesn't reuse messages/callbacks so didn't see that this logic was slightly different than `MessagingService`... so need to have both `(message_id, peer)` as the key and not just `message_id`, else the paxos messages clear the callback and hang forever (since it doesn't enqueue work the test actually fails right away).
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19042: Repair fuzz tests fail with paxos_variant: v2 [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3100:
URL: https://github.com/apache/cassandra/pull/3100#discussion_r1538219684
##########
src/java/org/apache/cassandra/net/MessageDelivery.java:
##########
@@ -28,4 +29,8 @@ public interface MessageDelivery
public <REQ, RSP> void sendWithCallback(Message<REQ> message, InetAddressAndPort to, RequestCallback<RSP> cb, ConnectionType specifyConnection);
public <REQ, RSP> Future<Message<RSP>> sendWithResult(Message<REQ> message, InetAddressAndPort to);
public <V> void respond(V response, Message<?> message);
+ public default void respondWithFailure(RequestFailureReason reason, Message<?> message)
Review Comment:
to be consistent with the rest of the file, I left `public` there...
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19042: Repair fuzz tests fail with paxos_variant: v2 [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3100:
URL: https://github.com/apache/cassandra/pull/3100#discussion_r1488675975
##########
src/java/org/apache/cassandra/service/paxos/cleanup/PaxosRepairState.java:
##########
@@ -0,0 +1,205 @@
+/*
+ * 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.cassandra.service.paxos.cleanup;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.IdentityHashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import com.google.common.base.Preconditions;
+
+import org.apache.cassandra.concurrent.Stage;
+import org.apache.cassandra.db.SystemKeyspace;
+import org.apache.cassandra.io.FSWriteError;
+import org.apache.cassandra.locator.InetAddressAndPort;
+import org.apache.cassandra.net.Message;
+import org.apache.cassandra.repair.SharedContext;
+import org.apache.cassandra.schema.Schema;
+import org.apache.cassandra.schema.TableId;
+import org.apache.cassandra.service.paxos.Ballot;
+import org.apache.cassandra.service.paxos.PaxosState;
+import org.apache.cassandra.utils.Throwables;
+import org.apache.cassandra.utils.concurrent.IntrusiveStack;
+
+import static org.apache.cassandra.exceptions.RequestFailureReason.UNKNOWN;
+import static org.apache.cassandra.net.NoPayload.noPayload;
+
+public class PaxosRepairState
+{
+ private final SharedContext ctx;
+ private final AtomicReference<PendingCleanup> pendingCleanup = new AtomicReference();
+ private final Map<UUID, PaxosCleanupSession> sessions = new ConcurrentHashMap<>();
+ private final ConcurrentMap<TableId, PaxosTableRepairs> tableRepairsMap = new ConcurrentHashMap<>();
+
+ public PaxosRepairState(SharedContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public static PaxosRepairState instance()
+ {
+ return Holder.instance;
+ }
+
+ PaxosTableRepairs getForTable(TableId tableId)
+ {
+ return tableRepairsMap.computeIfAbsent(tableId, k -> new PaxosTableRepairs());
+ }
+
+ public void evictHungRepairs()
+ {
+ long deadline = ctx.clock().nanoTime() - TimeUnit.MINUTES.toNanos(5);
+ for (PaxosTableRepairs repairs : tableRepairsMap.values())
+ repairs.evictHungRepairs(deadline);
+ }
+
+ public void clearRepairs()
+ {
+ for (PaxosTableRepairs repairs : tableRepairsMap.values())
+ repairs.clear();
+ }
+
+
+ public void setSession(PaxosCleanupSession session)
+ {
+ //TODO (review): I copy/pasted from PaxosCleanupSession... this is a check-then-act pattern which is not thread safe...
Review Comment:
I can fix if desired, I left alone so I could lower the risk in the refactor
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19042: Repair fuzz tests fail with paxos_variant: v2 [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3100:
URL: https://github.com/apache/cassandra/pull/3100#discussion_r1488685811
##########
test/unit/org/apache/cassandra/repair/FuzzTestBase.java:
##########
@@ -654,6 +667,7 @@ static class Cluster
// We run tests in an isolated JVM per class, so not cleaing up is safe... but if that assumption ever changes, will need to cleanup
Stage.ANTI_ENTROPY.unsafeSetExecutor(orderedExecutor);
+ Stage.MISC.unsafeSetExecutor(orderedExecutor);
Review Comment:
one line of code did this rather than `Stage.ANTI_ENTROPY`... not sure why we do MISC rather than ANTI_ENTROPY given this is repair... but figured best not to change it... For this test they are the same executor so doesn't matter.
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19042: Repair fuzz tests fail with paxos_variant: v2 [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3100:
URL: https://github.com/apache/cassandra/pull/3100#discussion_r1488673368
##########
src/java/org/apache/cassandra/service/paxos/cleanup/PaxosCleanupSession.java:
##########
@@ -95,49 +93,40 @@ private static ScheduledFuture<?> schedule(PaxosCleanupSession session)
}
}
- private final UUID session = UUID.randomUUID();
+ private final SharedContext ctx;
+ public final UUID session = UUID.randomUUID();
Review Comment:
this is non-deterministic, but this problem exists in repair as well... Repair uses random/time uuid outside of the random source/clock from `SharedContext`... since these are keys for a map, I have mostly looked the other way... it makes debugging annoying (as you can not block on the repair id) but its not been an issue so just ignore
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19042: Repair fuzz tests fail with paxos_variant: v2 [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3100:
URL: https://github.com/apache/cassandra/pull/3100#discussion_r1488661510
##########
src/java/org/apache/cassandra/service/paxos/Paxos.java:
##########
@@ -385,13 +386,18 @@ public EndpointsForToken readCandidates()
}
static Participants get(TableMetadata table, Token token, ConsistencyLevel consistencyForConsensus)
Review Comment:
I left this here as `Paxos` uses it... I updated the stuff that mattered for the existing tests to use the new API.
I did see `PaxosRepair` touches this as well, but I assume it didn't matter as we don't have data in paxos so that logic prob didn't get touched?
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19042: Repair fuzz tests fail with paxos_variant: v2 [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3100:
URL: https://github.com/apache/cassandra/pull/3100#discussion_r1538226578
##########
test/unit/org/apache/cassandra/repair/FuzzTestBase.java:
##########
@@ -993,7 +1058,39 @@ private Node(UUID hostId, InetAddressAndPort addressAndPort, Collection<Token> t
validator.fail(e);
}
});
- this.verbHandler = new RepairMessageVerbHandler(this);
+ this.verbHandler = new IVerbHandler()
Review Comment:
guess you really want that change huh? ^_^
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19042: Repair fuzz tests fail with paxos_variant: v2 [cassandra]
Posted by "smiklosovic (via GitHub)" <gi...@apache.org>.
smiklosovic closed pull request #3100: CASSANDRA-19042: Repair fuzz tests fail with paxos_variant: v2
URL: https://github.com/apache/cassandra/pull/3100
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19042: Repair fuzz tests fail with paxos_variant: v2 [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3100:
URL: https://github.com/apache/cassandra/pull/3100#discussion_r1488665170
##########
src/java/org/apache/cassandra/service/paxos/cleanup/PaxosCleanupSession.java:
##########
@@ -38,23 +36,21 @@
import org.apache.cassandra.gms.VersionedValue;
import org.apache.cassandra.locator.InetAddressAndPort;
import org.apache.cassandra.net.Message;
-import org.apache.cassandra.net.MessagingService;
import org.apache.cassandra.net.RequestCallbackWithFailure;
+import org.apache.cassandra.repair.SharedContext;
import org.apache.cassandra.schema.TableId;
import org.apache.cassandra.utils.concurrent.AsyncFuture;
import static org.apache.cassandra.config.CassandraRelevantProperties.PAXOS_CLEANUP_SESSION_TIMEOUT_SECONDS;
import static org.apache.cassandra.net.Verb.PAXOS2_CLEANUP_REQ;
-import static org.apache.cassandra.utils.Clock.Global.nanoTime;
public class PaxosCleanupSession extends AsyncFuture<Void> implements Runnable,
IEndpointStateChangeSubscriber,
IFailureDetectionEventListener,
RequestCallbackWithFailure<Void>
{
- private static final Map<UUID, PaxosCleanupSession> sessions = new ConcurrentHashMap<>();
Review Comment:
moved to `org.apache.cassandra.service.paxos.cleanup.PaxosRepairState`
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19042: Repair fuzz tests fail with paxos_variant: v2 [cassandra]
Posted by "ekaterinadimitrova2 (via GitHub)" <gi...@apache.org>.
ekaterinadimitrova2 commented on code in PR #3100:
URL: https://github.com/apache/cassandra/pull/3100#discussion_r1538069306
##########
test/unit/org/apache/cassandra/repair/FuzzTestBase.java:
##########
@@ -993,7 +1058,39 @@ private Node(UUID hostId, InetAddressAndPort addressAndPort, Collection<Token> t
validator.fail(e);
}
});
- this.verbHandler = new RepairMessageVerbHandler(this);
+ this.verbHandler = new IVerbHandler()
Review Comment:
```suggestion
this.verbHandler = new IVerbHandler<>()
```
```suggestion
this.verbHandler = new IVerbHandler<>()
```
##########
src/java/org/apache/cassandra/service/paxos/cleanup/PaxosRepairState.java:
##########
@@ -0,0 +1,205 @@
+/*
+ * 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.cassandra.service.paxos.cleanup;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.IdentityHashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import com.google.common.base.Preconditions;
+
+import org.apache.cassandra.concurrent.Stage;
+import org.apache.cassandra.db.SystemKeyspace;
+import org.apache.cassandra.io.FSWriteError;
+import org.apache.cassandra.locator.InetAddressAndPort;
+import org.apache.cassandra.net.Message;
+import org.apache.cassandra.repair.SharedContext;
+import org.apache.cassandra.schema.Schema;
+import org.apache.cassandra.schema.TableId;
+import org.apache.cassandra.service.paxos.Ballot;
+import org.apache.cassandra.service.paxos.PaxosState;
+import org.apache.cassandra.utils.Throwables;
+import org.apache.cassandra.utils.concurrent.IntrusiveStack;
+
+import static org.apache.cassandra.exceptions.RequestFailureReason.UNKNOWN;
+import static org.apache.cassandra.net.NoPayload.noPayload;
+
+public class PaxosRepairState
+{
+ private final SharedContext ctx;
+ private final AtomicReference<PendingCleanup> pendingCleanup = new AtomicReference();
+ private final Map<UUID, PaxosCleanupSession> sessions = new ConcurrentHashMap<>();
+ private final ConcurrentMap<TableId, PaxosTableRepairs> tableRepairsMap = new ConcurrentHashMap<>();
+
+ public PaxosRepairState(SharedContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public static PaxosRepairState instance()
+ {
+ return Holder.instance;
+ }
+
+ PaxosTableRepairs getForTable(TableId tableId)
+ {
+ return tableRepairsMap.computeIfAbsent(tableId, k -> new PaxosTableRepairs());
+ }
+
+ public void evictHungRepairs()
+ {
+ long deadline = ctx.clock().nanoTime() - TimeUnit.MINUTES.toNanos(5);
+ for (PaxosTableRepairs repairs : tableRepairsMap.values())
+ repairs.evictHungRepairs(deadline);
+ }
+
+ public void clearRepairs()
+ {
+ for (PaxosTableRepairs repairs : tableRepairsMap.values())
+ repairs.clear();
+ }
+
+
+ public void setSession(PaxosCleanupSession session)
+ {
+ //TODO (review): I copy/pasted from PaxosCleanupSession... this is a check-then-act pattern which is not thread safe...
+ Preconditions.checkState(!sessions.containsKey(session.session));
+ sessions.put(session.session, session);
+ }
+
+ public void removeSession(PaxosCleanupSession session)
+ {
+ //TODO (review): I copy/pasted from PaxosCleanupSession... this is a check-then-act pattern which is not thread safe...
+ Preconditions.checkState(sessions.containsKey(session.session));
+ sessions.remove(session.session);
+ }
+
+ public void finishSession(InetAddressAndPort from, PaxosCleanupResponse response)
+ {
+ PaxosCleanupSession session = sessions.get(response.session);
+ if (session != null)
+ session.finish(from, response);
+ }
+
+ public void addCleanupHistory(Message<PaxosCleanupHistory> message)
+ {
+ PendingCleanup.add(ctx, pendingCleanup, message);
+ }
+
+ private static class Holder
Review Comment:
Please add as a comment, it can be useful for someone
##########
src/java/org/apache/cassandra/service/paxos/Paxos.java:
##########
@@ -385,13 +386,18 @@ public EndpointsForToken readCandidates()
}
static Participants get(TableMetadata table, Token token, ConsistencyLevel consistencyForConsensus)
Review Comment:
Weird, I don't know why my IDE Intellij Idea emits a warning that the Config class is deprecated. Not after your patch, though; it's just observation.
##########
src/java/org/apache/cassandra/gms/IGossiper.java:
##########
@@ -30,6 +31,8 @@ public interface IGossiper
@Nullable
EndpointState getEndpointStateForEndpoint(InetAddressAndPort ep);
+ void notifyFailureDetector(Map<InetAddressAndPort, EndpointState> remoteEpStateMap);
+ void applyStateLocally(Map<InetAddressAndPort, EndpointState> epStateMap);
Review Comment:
These two can benefit from some javadoc
##########
src/java/org/apache/cassandra/net/MessageDelivery.java:
##########
@@ -28,4 +29,8 @@ public interface MessageDelivery
public <REQ, RSP> void sendWithCallback(Message<REQ> message, InetAddressAndPort to, RequestCallback<RSP> cb, ConnectionType specifyConnection);
public <REQ, RSP> Future<Message<RSP>> sendWithResult(Message<REQ> message, InetAddressAndPort to);
public <V> void respond(V response, Message<?> message);
+ public default void respondWithFailure(RequestFailureReason reason, Message<?> message)
Review Comment:
Can you remove the public modifiers from this interface, please?
##########
src/java/org/apache/cassandra/service/paxos/cleanup/PaxosRepairState.java:
##########
@@ -0,0 +1,205 @@
+/*
+ * 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.cassandra.service.paxos.cleanup;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.IdentityHashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import com.google.common.base.Preconditions;
+
+import org.apache.cassandra.concurrent.Stage;
+import org.apache.cassandra.db.SystemKeyspace;
+import org.apache.cassandra.io.FSWriteError;
+import org.apache.cassandra.locator.InetAddressAndPort;
+import org.apache.cassandra.net.Message;
+import org.apache.cassandra.repair.SharedContext;
+import org.apache.cassandra.schema.Schema;
+import org.apache.cassandra.schema.TableId;
+import org.apache.cassandra.service.paxos.Ballot;
+import org.apache.cassandra.service.paxos.PaxosState;
+import org.apache.cassandra.utils.Throwables;
+import org.apache.cassandra.utils.concurrent.IntrusiveStack;
+
+import static org.apache.cassandra.exceptions.RequestFailureReason.UNKNOWN;
+import static org.apache.cassandra.net.NoPayload.noPayload;
+
+public class PaxosRepairState
Review Comment:
Please add Javadoc
##########
src/java/org/apache/cassandra/service/paxos/cleanup/PaxosCleanupSession.java:
##########
@@ -168,13 +157,13 @@ private synchronized void fail(String message)
{
if (isDone())
return;
- removeSession(this);
+ ctx.paxosRepairState().removeSession(this);
tryFailure(new PaxosCleanupException(message));
if (timeout != null)
timeout.cancel(true);
}
- private synchronized void finish(InetAddressAndPort from, PaxosCleanupResponse finished)
+ public synchronized void finish(InetAddressAndPort from, PaxosCleanupResponse finished)
Review Comment:
Isn't `protected `enough?
##########
src/java/org/apache/cassandra/service/paxos/cleanup/PaxosRepairState.java:
##########
@@ -0,0 +1,205 @@
+/*
+ * 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.cassandra.service.paxos.cleanup;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.IdentityHashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import com.google.common.base.Preconditions;
+
+import org.apache.cassandra.concurrent.Stage;
+import org.apache.cassandra.db.SystemKeyspace;
+import org.apache.cassandra.io.FSWriteError;
+import org.apache.cassandra.locator.InetAddressAndPort;
+import org.apache.cassandra.net.Message;
+import org.apache.cassandra.repair.SharedContext;
+import org.apache.cassandra.schema.Schema;
+import org.apache.cassandra.schema.TableId;
+import org.apache.cassandra.service.paxos.Ballot;
+import org.apache.cassandra.service.paxos.PaxosState;
+import org.apache.cassandra.utils.Throwables;
+import org.apache.cassandra.utils.concurrent.IntrusiveStack;
+
+import static org.apache.cassandra.exceptions.RequestFailureReason.UNKNOWN;
+import static org.apache.cassandra.net.NoPayload.noPayload;
+
+public class PaxosRepairState
+{
+ private final SharedContext ctx;
+ private final AtomicReference<PendingCleanup> pendingCleanup = new AtomicReference();
Review Comment:
```suggestion
private final AtomicReference<PendingCleanup> pendingCleanup = new AtomicReference<>();
```
##########
src/java/org/apache/cassandra/service/paxos/PaxosRepair.java:
##########
@@ -659,45 +657,24 @@ static boolean validateVersionCompatibility(CassandraVersion version)
return (version.major == 4 && version.minor > 0) || version.major > 4;
}
- static String getPeerVersion(InetAddressAndPort peer)
+ static boolean validatePeerCompatibility(IGossiper gossiper, Replica peer)
{
- EndpointState epState = Gossiper.instance.getEndpointStateForEndpoint(peer);
Review Comment:
I don't know about the IllegalArgumentException, probably some leftover
##########
src/java/org/apache/cassandra/service/paxos/cleanup/PaxosRepairState.java:
##########
@@ -0,0 +1,205 @@
+/*
+ * 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.cassandra.service.paxos.cleanup;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.IdentityHashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import com.google.common.base.Preconditions;
+
+import org.apache.cassandra.concurrent.Stage;
+import org.apache.cassandra.db.SystemKeyspace;
+import org.apache.cassandra.io.FSWriteError;
+import org.apache.cassandra.locator.InetAddressAndPort;
+import org.apache.cassandra.net.Message;
+import org.apache.cassandra.repair.SharedContext;
+import org.apache.cassandra.schema.Schema;
+import org.apache.cassandra.schema.TableId;
+import org.apache.cassandra.service.paxos.Ballot;
+import org.apache.cassandra.service.paxos.PaxosState;
+import org.apache.cassandra.utils.Throwables;
+import org.apache.cassandra.utils.concurrent.IntrusiveStack;
+
+import static org.apache.cassandra.exceptions.RequestFailureReason.UNKNOWN;
+import static org.apache.cassandra.net.NoPayload.noPayload;
+
+public class PaxosRepairState
+{
+ private final SharedContext ctx;
+ private final AtomicReference<PendingCleanup> pendingCleanup = new AtomicReference();
+ private final Map<UUID, PaxosCleanupSession> sessions = new ConcurrentHashMap<>();
+ private final ConcurrentMap<TableId, PaxosTableRepairs> tableRepairsMap = new ConcurrentHashMap<>();
+
+ public PaxosRepairState(SharedContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public static PaxosRepairState instance()
+ {
+ return Holder.instance;
+ }
+
+ PaxosTableRepairs getForTable(TableId tableId)
+ {
+ return tableRepairsMap.computeIfAbsent(tableId, k -> new PaxosTableRepairs());
+ }
+
+ public void evictHungRepairs()
+ {
+ long deadline = ctx.clock().nanoTime() - TimeUnit.MINUTES.toNanos(5);
+ for (PaxosTableRepairs repairs : tableRepairsMap.values())
+ repairs.evictHungRepairs(deadline);
+ }
+
+ public void clearRepairs()
+ {
+ for (PaxosTableRepairs repairs : tableRepairsMap.values())
+ repairs.clear();
+ }
+
+
+ public void setSession(PaxosCleanupSession session)
+ {
+ //TODO (review): I copy/pasted from PaxosCleanupSession... this is a check-then-act pattern which is not thread safe...
Review Comment:
Incremental changes are ok. I guess it is also in 4.1 so not a regression? Let's open a ticket
##########
test/unit/org/apache/cassandra/repair/FuzzTestBase.java:
##########
@@ -952,6 +1003,18 @@ public EndpointState getEndpointStateForEndpoint(InetAddressAndPort ep)
{
return endpoints.get(ep);
}
+
+ @Override
+ public void notifyFailureDetector(Map<InetAddressAndPort, EndpointState> remoteEpStateMap)
+ {
+
+ }
+
+ @Override
+ public void applyStateLocally(Map<InetAddressAndPort, EndpointState> epStateMap)
+ {
Review Comment:
Please add this info as a comment in the codebase
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19042: Repair fuzz tests fail with paxos_variant: v2 [cassandra]
Posted by "ekaterinadimitrova2 (via GitHub)" <gi...@apache.org>.
ekaterinadimitrova2 commented on code in PR #3100:
URL: https://github.com/apache/cassandra/pull/3100#discussion_r1538249946
##########
test/unit/org/apache/cassandra/repair/FuzzTestBase.java:
##########
@@ -993,7 +1058,39 @@ private Node(UUID hostId, InetAddressAndPort addressAndPort, Collection<Token> t
validator.fail(e);
}
});
- this.verbHandler = new RepairMessageVerbHandler(this);
+ this.verbHandler = new IVerbHandler()
Review Comment:
I think I hit a bug actually :D I added it once, GH complained there were new changes after a force push and I cannot add it. I refreshed and added it and then it popped up twice I guess, which I didn't notice.... edited now, sorry :D Not a big deal suggestion really
##########
test/unit/org/apache/cassandra/repair/FuzzTestBase.java:
##########
@@ -993,7 +1058,39 @@ private Node(UUID hostId, InetAddressAndPort addressAndPort, Collection<Token> t
validator.fail(e);
}
});
- this.verbHandler = new RepairMessageVerbHandler(this);
+ this.verbHandler = new IVerbHandler()
Review Comment:
```suggestion
this.verbHandler = new IVerbHandler<>()
```
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19042: Repair fuzz tests fail with paxos_variant: v2 [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3100:
URL: https://github.com/apache/cassandra/pull/3100#discussion_r1488677443
##########
src/java/org/apache/cassandra/service/paxos/cleanup/PaxosRepairState.java:
##########
@@ -0,0 +1,205 @@
+/*
+ * 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.cassandra.service.paxos.cleanup;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.IdentityHashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import com.google.common.base.Preconditions;
+
+import org.apache.cassandra.concurrent.Stage;
+import org.apache.cassandra.db.SystemKeyspace;
+import org.apache.cassandra.io.FSWriteError;
+import org.apache.cassandra.locator.InetAddressAndPort;
+import org.apache.cassandra.net.Message;
+import org.apache.cassandra.repair.SharedContext;
+import org.apache.cassandra.schema.Schema;
+import org.apache.cassandra.schema.TableId;
+import org.apache.cassandra.service.paxos.Ballot;
+import org.apache.cassandra.service.paxos.PaxosState;
+import org.apache.cassandra.utils.Throwables;
+import org.apache.cassandra.utils.concurrent.IntrusiveStack;
+
+import static org.apache.cassandra.exceptions.RequestFailureReason.UNKNOWN;
+import static org.apache.cassandra.net.NoPayload.noPayload;
+
+public class PaxosRepairState
+{
+ private final SharedContext ctx;
+ private final AtomicReference<PendingCleanup> pendingCleanup = new AtomicReference();
+ private final Map<UUID, PaxosCleanupSession> sessions = new ConcurrentHashMap<>();
+ private final ConcurrentMap<TableId, PaxosTableRepairs> tableRepairsMap = new ConcurrentHashMap<>();
+
+ public PaxosRepairState(SharedContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public static PaxosRepairState instance()
+ {
+ return Holder.instance;
+ }
+
+ PaxosTableRepairs getForTable(TableId tableId)
+ {
+ return tableRepairsMap.computeIfAbsent(tableId, k -> new PaxosTableRepairs());
+ }
+
+ public void evictHungRepairs()
+ {
+ long deadline = ctx.clock().nanoTime() - TimeUnit.MINUTES.toNanos(5);
+ for (PaxosTableRepairs repairs : tableRepairsMap.values())
+ repairs.evictHungRepairs(deadline);
+ }
+
+ public void clearRepairs()
+ {
+ for (PaxosTableRepairs repairs : tableRepairsMap.values())
+ repairs.clear();
+ }
+
+
+ public void setSession(PaxosCleanupSession session)
+ {
+ //TODO (review): I copy/pasted from PaxosCleanupSession... this is a check-then-act pattern which is not thread safe...
+ Preconditions.checkState(!sessions.containsKey(session.session));
+ sessions.put(session.session, session);
+ }
+
+ public void removeSession(PaxosCleanupSession session)
+ {
+ //TODO (review): I copy/pasted from PaxosCleanupSession... this is a check-then-act pattern which is not thread safe...
+ Preconditions.checkState(sessions.containsKey(session.session));
+ sessions.remove(session.session);
+ }
+
+ public void finishSession(InetAddressAndPort from, PaxosCleanupResponse response)
+ {
+ PaxosCleanupSession session = sessions.get(response.session);
+ if (session != null)
+ session.finish(from, response);
+ }
+
+ public void addCleanupHistory(Message<PaxosCleanupHistory> message)
+ {
+ PendingCleanup.add(ctx, pendingCleanup, message);
+ }
+
+ private static class Holder
Review Comment:
this is not required, but it helps to see what escapes simulation... can put a break point on `instance()` while running the tests
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-19042: Repair fuzz tests fail with paxos_variant: v2 [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3100:
URL: https://github.com/apache/cassandra/pull/3100#discussion_r1488675022
##########
src/java/org/apache/cassandra/service/paxos/cleanup/PaxosFinishPrepareCleanup.java:
##########
@@ -77,93 +68,10 @@ public synchronized void onResponse(Message<Void> msg)
trySuccess(null);
}
- static class PendingCleanup extends IntrusiveStack<PendingCleanup>
Review Comment:
moved to `org.apache.cassandra.service.paxos.cleanup.PaxosRepairState`
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org