You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "ifesdjeen (via GitHub)" <gi...@apache.org> on 2024/07/19 08:56:59 UTC
[PR] Read+Write sides of the replay determinism: [cassandra]
ifesdjeen opened a new pull request, #3431:
URL: https://github.com/apache/cassandra/pull/3431
* Persist intermediate Command inthe journal
* Simplify AccordJournal by removing Framing
* Save command outcomes to the log
* Reconstruct latest command state from the log entries
* Replace `SerializerSupport#reconstruct` with log reconstruction
--
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] Read+Write sides of the replay determinism: [cassandra]
Posted by "ifesdjeen (via GitHub)" <gi...@apache.org>.
ifesdjeen closed pull request #3431: Read+Write sides of the replay determinism:
URL: https://github.com/apache/cassandra/pull/3431
--
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] Read+Write sides of the replay determinism: [cassandra]
Posted by "belliottsmith (via GitHub)" <gi...@apache.org>.
belliottsmith commented on code in PR #3431:
URL: https://github.com/apache/cassandra/pull/3431#discussion_r1686579384
##########
src/java/org/apache/cassandra/journal/Journal.java:
##########
@@ -112,31 +116,92 @@ public class Journal<K, V> implements Shutdownable
private final WaitQueue segmentPrepared = newWaitQueue();
private final WaitQueue allocatorThreadWaitQueue = newWaitQueue();
private final BooleanSupplier allocatorThreadWaitCondition = () -> (availableSegment == null);
+ private final FlusherCallbacks flusherCallbacks;
SequentialExecutorPlus closer;
//private final Set<Descriptor> invalidations = Collections.newSetFromMap(new ConcurrentHashMap<>());
+ private class FlusherCallbacks implements Flusher.Callbacks
+ {
+ private final Queue<WaitingFor> waitingFor = new ConcurrentLinkedQueue<>();
+
+ @Override
+ public void onFlush(long segment, int position)
+ {
+ Iterator<WaitingFor> iter = waitingFor.iterator();
Review Comment:
Can't this introduce blocking, where a waiting thread is stuck behind a later write? Probably we should drain and sort the queue. It would be nice also to use something better than a `ConcurrentLinkedQueue` (but not critical)
--
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] Read+Write sides of the replay determinism: [cassandra]
Posted by "belliottsmith (via GitHub)" <gi...@apache.org>.
belliottsmith commented on code in PR #3431:
URL: https://github.com/apache/cassandra/pull/3431#discussion_r1686582824
##########
src/java/org/apache/cassandra/journal/Journal.java:
##########
@@ -112,31 +116,92 @@ public class Journal<K, V> implements Shutdownable
private final WaitQueue segmentPrepared = newWaitQueue();
private final WaitQueue allocatorThreadWaitQueue = newWaitQueue();
private final BooleanSupplier allocatorThreadWaitCondition = () -> (availableSegment == null);
+ private final FlusherCallbacks flusherCallbacks;
SequentialExecutorPlus closer;
//private final Set<Descriptor> invalidations = Collections.newSetFromMap(new ConcurrentHashMap<>());
+ private class FlusherCallbacks implements Flusher.Callbacks
+ {
+ private final Queue<WaitingFor> waitingFor = new ConcurrentLinkedQueue<>();
+
+ @Override
+ public void onFlush(long segment, int position)
+ {
+ Iterator<WaitingFor> iter = waitingFor.iterator();
+ while (iter.hasNext())
+ {
+ WaitingFor wait = iter.next();
+ if (wait.segment == segment && wait.position <= position)
+ {
+ wait.run();
+ iter.remove();
+ }
+ }
+ }
+
+ @Override
+ public void onFlushFailed(Throwable cause)
+ {
+ // TODO: panic
+ }
+
+ public void submit(RecordPointer pointer, Runnable runnable)
+ {
+ WaitingFor wait = new WaitingFor(pointer.segment, pointer.position, runnable);
+ waitingFor.add(wait);
+ if (isFlushed(pointer))
+ wait.run();
+ }
+ }
+
+ private static class WaitingFor extends RecordPointer implements Runnable
+ {
+ private final AtomicReference<Runnable> onFlushed;
Review Comment:
It would be nice not to rely on additional atomics here. Is there any reason the journal thread won't promptly catch up any that could have run immediately?
--
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] Read+Write sides of the replay determinism: [cassandra]
Posted by "ifesdjeen (via GitHub)" <gi...@apache.org>.
ifesdjeen commented on code in PR #3431:
URL: https://github.com/apache/cassandra/pull/3431#discussion_r1687594904
##########
src/java/org/apache/cassandra/journal/Journal.java:
##########
@@ -112,31 +116,92 @@ public class Journal<K, V> implements Shutdownable
private final WaitQueue segmentPrepared = newWaitQueue();
private final WaitQueue allocatorThreadWaitQueue = newWaitQueue();
private final BooleanSupplier allocatorThreadWaitCondition = () -> (availableSegment == null);
+ private final FlusherCallbacks flusherCallbacks;
SequentialExecutorPlus closer;
//private final Set<Descriptor> invalidations = Collections.newSetFromMap(new ConcurrentHashMap<>());
+ private class FlusherCallbacks implements Flusher.Callbacks
+ {
+ private final Queue<WaitingFor> waitingFor = new ConcurrentLinkedQueue<>();
+
+ @Override
+ public void onFlush(long segment, int position)
+ {
+ Iterator<WaitingFor> iter = waitingFor.iterator();
+ while (iter.hasNext())
+ {
+ WaitingFor wait = iter.next();
+ if (wait.segment == segment && wait.position <= position)
+ {
+ wait.run();
+ iter.remove();
+ }
+ }
+ }
+
+ @Override
+ public void onFlushFailed(Throwable cause)
+ {
+ // TODO: panic
+ }
+
+ public void submit(RecordPointer pointer, Runnable runnable)
+ {
+ WaitingFor wait = new WaitingFor(pointer.segment, pointer.position, runnable);
+ waitingFor.add(wait);
+ if (isFlushed(pointer))
+ wait.run();
+ }
+ }
+
+ private static class WaitingFor extends RecordPointer implements Runnable
+ {
+ private final AtomicReference<Runnable> onFlushed;
Review Comment:
It will catch up. Atomic's purpose was to avoid double-running, but it should never happen, just a precaution really.
##########
src/java/org/apache/cassandra/service/accord/AccordCommandStore.java:
##########
@@ -333,22 +331,32 @@ public AccordStateCache.Instance<Key, CommandsForKey, AccordSafeCommandsForKey>
{
return commandsForKeyCache;
}
- Command loadCommand(TxnId txnId)
+
+ @Nullable
+ Runnable appendToKeyspace(Command before, Command after)
{
- return AccordKeyspace.loadCommand(this, txnId);
+ if (after.keysOrRanges() != null && after.keysOrRanges() instanceof Keys)
+ return NO_OP;
Review Comment:
Great point!
--
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] Read+Write sides of the replay determinism: [cassandra]
Posted by "ifesdjeen (via GitHub)" <gi...@apache.org>.
ifesdjeen commented on code in PR #3431:
URL: https://github.com/apache/cassandra/pull/3431#discussion_r1684103589
##########
src/java/org/apache/cassandra/service/accord/AccordJournal.java:
##########
@@ -190,13 +160,57 @@ public AccordJournal start(Node node)
Invariants.checkState(status == Status.INITIALIZED);
this.node = node;
status = Status.STARTING;
- frameApplicator.start();
- frameAggregator.start();
journal.start();
+ this.delayedRequestProcessor.start();
status = Status.STARTED;
return this;
}
+ @VisibleForTesting
+ public void replay()
Review Comment:
This is an extremely early version. There's a bug in flusher: we do not seem to wait for last flush before we replay, which leads to some issues, so there's sleep here. But since this patch does not hook replay up to any prod code, I thought it would be fine to leave this in.
--
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] Read+Write sides of the replay determinism: [cassandra]
Posted by "belliottsmith (via GitHub)" <gi...@apache.org>.
belliottsmith commented on code in PR #3431:
URL: https://github.com/apache/cassandra/pull/3431#discussion_r1686587805
##########
src/java/org/apache/cassandra/service/accord/AccordCommandStore.java:
##########
@@ -333,22 +331,32 @@ public AccordStateCache.Instance<Key, CommandsForKey, AccordSafeCommandsForKey>
{
return commandsForKeyCache;
}
- Command loadCommand(TxnId txnId)
+
+ @Nullable
+ Runnable appendToKeyspace(Command before, Command after)
{
- return AccordKeyspace.loadCommand(this, txnId);
+ if (after.keysOrRanges() != null && after.keysOrRanges() instanceof Keys)
+ return NO_OP;
Review Comment:
if we return `null` the cache won't waste time handing to another thread for saving
--
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] Read+Write sides of the replay determinism: [cassandra]
Posted by "ifesdjeen (via GitHub)" <gi...@apache.org>.
ifesdjeen commented on code in PR #3431:
URL: https://github.com/apache/cassandra/pull/3431#discussion_r1688042616
##########
src/java/org/apache/cassandra/journal/Journal.java:
##########
@@ -112,31 +116,92 @@ public class Journal<K, V> implements Shutdownable
private final WaitQueue segmentPrepared = newWaitQueue();
private final WaitQueue allocatorThreadWaitQueue = newWaitQueue();
private final BooleanSupplier allocatorThreadWaitCondition = () -> (availableSegment == null);
+ private final FlusherCallbacks flusherCallbacks;
SequentialExecutorPlus closer;
//private final Set<Descriptor> invalidations = Collections.newSetFromMap(new ConcurrentHashMap<>());
+ private class FlusherCallbacks implements Flusher.Callbacks
+ {
+ private final Queue<WaitingFor> waitingFor = new ConcurrentLinkedQueue<>();
+
+ @Override
+ public void onFlush(long segment, int position)
+ {
+ Iterator<WaitingFor> iter = waitingFor.iterator();
+ while (iter.hasNext())
+ {
+ WaitingFor wait = iter.next();
+ if (wait.segment == segment && wait.position <= position)
+ {
+ wait.run();
+ iter.remove();
+ }
+ }
+ }
+
+ @Override
+ public void onFlushFailed(Throwable cause)
+ {
+ // TODO: panic
+ }
+
+ public void submit(RecordPointer pointer, Runnable runnable)
+ {
+ WaitingFor wait = new WaitingFor(pointer.segment, pointer.position, runnable);
+ waitingFor.add(wait);
+ if (isFlushed(pointer))
+ wait.run();
+ }
+ }
+
+ private static class WaitingFor extends RecordPointer implements Runnable
+ {
+ private final AtomicReference<Runnable> onFlushed;
Review Comment:
Yeah; the intention here was to make sure that we run the runnable only once. You are of course right that it journal thread will promptly catch up any that could have run immediately.
--
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] Read+Write sides of the replay determinism: [cassandra]
Posted by "belliottsmith (via GitHub)" <gi...@apache.org>.
belliottsmith commented on code in PR #3431:
URL: https://github.com/apache/cassandra/pull/3431#discussion_r1686580277
##########
src/java/org/apache/cassandra/journal/Journal.java:
##########
@@ -112,31 +116,92 @@ public class Journal<K, V> implements Shutdownable
private final WaitQueue segmentPrepared = newWaitQueue();
private final WaitQueue allocatorThreadWaitQueue = newWaitQueue();
private final BooleanSupplier allocatorThreadWaitCondition = () -> (availableSegment == null);
+ private final FlusherCallbacks flusherCallbacks;
SequentialExecutorPlus closer;
//private final Set<Descriptor> invalidations = Collections.newSetFromMap(new ConcurrentHashMap<>());
+ private class FlusherCallbacks implements Flusher.Callbacks
+ {
+ private final Queue<WaitingFor> waitingFor = new ConcurrentLinkedQueue<>();
+
+ @Override
+ public void onFlush(long segment, int position)
+ {
+ Iterator<WaitingFor> iter = waitingFor.iterator();
+ while (iter.hasNext())
+ {
+ WaitingFor wait = iter.next();
+ if (wait.segment == segment && wait.position <= position)
+ {
+ wait.run();
+ iter.remove();
+ }
+ }
+ }
+
+ @Override
+ public void onFlushFailed(Throwable cause)
+ {
+ // TODO: panic
+ }
+
+ public void submit(RecordPointer pointer, Runnable runnable)
+ {
+ WaitingFor wait = new WaitingFor(pointer.segment, pointer.position, runnable);
+ waitingFor.add(wait);
+ if (isFlushed(pointer))
+ wait.run();
Review Comment:
Can this not permit invoking `run` twice?
--
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] Read+Write sides of the replay determinism: [cassandra]
Posted by "belliottsmith (via GitHub)" <gi...@apache.org>.
belliottsmith commented on code in PR #3431:
URL: https://github.com/apache/cassandra/pull/3431#discussion_r1687628215
##########
src/java/org/apache/cassandra/journal/Journal.java:
##########
@@ -112,31 +116,92 @@ public class Journal<K, V> implements Shutdownable
private final WaitQueue segmentPrepared = newWaitQueue();
private final WaitQueue allocatorThreadWaitQueue = newWaitQueue();
private final BooleanSupplier allocatorThreadWaitCondition = () -> (availableSegment == null);
+ private final FlusherCallbacks flusherCallbacks;
SequentialExecutorPlus closer;
//private final Set<Descriptor> invalidations = Collections.newSetFromMap(new ConcurrentHashMap<>());
+ private class FlusherCallbacks implements Flusher.Callbacks
+ {
+ private final Queue<WaitingFor> waitingFor = new ConcurrentLinkedQueue<>();
+
+ @Override
+ public void onFlush(long segment, int position)
+ {
+ Iterator<WaitingFor> iter = waitingFor.iterator();
+ while (iter.hasNext())
+ {
+ WaitingFor wait = iter.next();
+ if (wait.segment == segment && wait.position <= position)
+ {
+ wait.run();
+ iter.remove();
+ }
+ }
+ }
+
+ @Override
+ public void onFlushFailed(Throwable cause)
+ {
+ // TODO: panic
+ }
+
+ public void submit(RecordPointer pointer, Runnable runnable)
+ {
+ WaitingFor wait = new WaitingFor(pointer.segment, pointer.position, runnable);
+ waitingFor.add(wait);
+ if (isFlushed(pointer))
+ wait.run();
+ }
+ }
+
+ private static class WaitingFor extends RecordPointer implements Runnable
+ {
+ private final AtomicReference<Runnable> onFlushed;
Review Comment:
I mean if we don't invoke on the caller that submits - I agree this can permit double invocation, but we could just not do this?
--
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] Read+Write sides of the replay determinism: [cassandra]
Posted by "ifesdjeen (via GitHub)" <gi...@apache.org>.
ifesdjeen commented on code in PR #3431:
URL: https://github.com/apache/cassandra/pull/3431#discussion_r1688038870
##########
src/java/org/apache/cassandra/journal/Journal.java:
##########
@@ -112,31 +116,92 @@ public class Journal<K, V> implements Shutdownable
private final WaitQueue segmentPrepared = newWaitQueue();
private final WaitQueue allocatorThreadWaitQueue = newWaitQueue();
private final BooleanSupplier allocatorThreadWaitCondition = () -> (availableSegment == null);
+ private final FlusherCallbacks flusherCallbacks;
SequentialExecutorPlus closer;
//private final Set<Descriptor> invalidations = Collections.newSetFromMap(new ConcurrentHashMap<>());
+ private class FlusherCallbacks implements Flusher.Callbacks
+ {
+ private final Queue<WaitingFor> waitingFor = new ConcurrentLinkedQueue<>();
+
+ @Override
+ public void onFlush(long segment, int position)
+ {
+ Iterator<WaitingFor> iter = waitingFor.iterator();
Review Comment:
Switched to MPSC queue, and added an array for draining. Will do a bigger improvement that will introduce callbacks native to Journal in a follow-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] Read+Write sides of the replay determinism: [cassandra]
Posted by "ifesdjeen (via GitHub)" <gi...@apache.org>.
ifesdjeen commented on code in PR #3431:
URL: https://github.com/apache/cassandra/pull/3431#discussion_r1688042616
##########
src/java/org/apache/cassandra/journal/Journal.java:
##########
@@ -112,31 +116,92 @@ public class Journal<K, V> implements Shutdownable
private final WaitQueue segmentPrepared = newWaitQueue();
private final WaitQueue allocatorThreadWaitQueue = newWaitQueue();
private final BooleanSupplier allocatorThreadWaitCondition = () -> (availableSegment == null);
+ private final FlusherCallbacks flusherCallbacks;
SequentialExecutorPlus closer;
//private final Set<Descriptor> invalidations = Collections.newSetFromMap(new ConcurrentHashMap<>());
+ private class FlusherCallbacks implements Flusher.Callbacks
+ {
+ private final Queue<WaitingFor> waitingFor = new ConcurrentLinkedQueue<>();
+
+ @Override
+ public void onFlush(long segment, int position)
+ {
+ Iterator<WaitingFor> iter = waitingFor.iterator();
+ while (iter.hasNext())
+ {
+ WaitingFor wait = iter.next();
+ if (wait.segment == segment && wait.position <= position)
+ {
+ wait.run();
+ iter.remove();
+ }
+ }
+ }
+
+ @Override
+ public void onFlushFailed(Throwable cause)
+ {
+ // TODO: panic
+ }
+
+ public void submit(RecordPointer pointer, Runnable runnable)
+ {
+ WaitingFor wait = new WaitingFor(pointer.segment, pointer.position, runnable);
+ waitingFor.add(wait);
+ if (isFlushed(pointer))
+ wait.run();
+ }
+ }
+
+ private static class WaitingFor extends RecordPointer implements Runnable
+ {
+ private final AtomicReference<Runnable> onFlushed;
Review Comment:
Yeah; the intention here was to make sure that we run the runnable only once. You are of course right that it journal thread will promptly catch up any that could have run immediately.
--
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] Read+Write sides of the replay determinism: [cassandra]
Posted by "belliottsmith (via GitHub)" <gi...@apache.org>.
belliottsmith commented on code in PR #3431:
URL: https://github.com/apache/cassandra/pull/3431#discussion_r1686580277
##########
src/java/org/apache/cassandra/journal/Journal.java:
##########
@@ -112,31 +116,92 @@ public class Journal<K, V> implements Shutdownable
private final WaitQueue segmentPrepared = newWaitQueue();
private final WaitQueue allocatorThreadWaitQueue = newWaitQueue();
private final BooleanSupplier allocatorThreadWaitCondition = () -> (availableSegment == null);
+ private final FlusherCallbacks flusherCallbacks;
SequentialExecutorPlus closer;
//private final Set<Descriptor> invalidations = Collections.newSetFromMap(new ConcurrentHashMap<>());
+ private class FlusherCallbacks implements Flusher.Callbacks
+ {
+ private final Queue<WaitingFor> waitingFor = new ConcurrentLinkedQueue<>();
+
+ @Override
+ public void onFlush(long segment, int position)
+ {
+ Iterator<WaitingFor> iter = waitingFor.iterator();
+ while (iter.hasNext())
+ {
+ WaitingFor wait = iter.next();
+ if (wait.segment == segment && wait.position <= position)
+ {
+ wait.run();
+ iter.remove();
+ }
+ }
+ }
+
+ @Override
+ public void onFlushFailed(Throwable cause)
+ {
+ // TODO: panic
+ }
+
+ public void submit(RecordPointer pointer, Runnable runnable)
+ {
+ WaitingFor wait = new WaitingFor(pointer.segment, pointer.position, runnable);
+ waitingFor.add(wait);
+ if (isFlushed(pointer))
+ wait.run();
Review Comment:
Can this not permit invoking `run` twice?
--
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] Read+Write sides of the replay determinism: [cassandra]
Posted by "ifesdjeen (via GitHub)" <gi...@apache.org>.
ifesdjeen commented on code in PR #3431:
URL: https://github.com/apache/cassandra/pull/3431#discussion_r1684105733
##########
src/java/org/apache/cassandra/service/accord/SavedCommand.java:
##########
@@ -0,0 +1,609 @@
+/*
+ * 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.accord;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.List;
+import java.util.Optional;
+import java.util.function.Function;
+
+import com.google.common.annotations.VisibleForTesting;
+
+import accord.api.Result;
+import accord.local.Command;
+import accord.local.CommonAttributes;
+import accord.local.Listeners;
+import accord.local.SaveStatus;
+import accord.local.Status;
+import accord.primitives.Ballot;
+import accord.primitives.PartialDeps;
+import accord.primitives.PartialTxn;
+import accord.primitives.Route;
+import accord.primitives.Seekables;
+import accord.primitives.Timestamp;
+import accord.primitives.TxnId;
+import accord.primitives.Writes;
+import accord.utils.Invariants;
+import org.apache.cassandra.io.util.DataInputPlus;
+import org.apache.cassandra.io.util.DataOutputPlus;
+import org.apache.cassandra.journal.ValueSerializer;
+import org.apache.cassandra.service.accord.serializers.CommandSerializers;
+import org.apache.cassandra.service.accord.serializers.DepsSerializer;
+import org.apache.cassandra.service.accord.serializers.KeySerializers;
+import org.apache.cassandra.service.accord.serializers.WaitingOnSerializer;
+import org.apache.cassandra.utils.Throwables;
+
+import static org.apache.cassandra.db.TypeSizes.SHORT_SIZE;
+
+public class SavedCommand
Review Comment:
I suggest we leave the discussed improvements, such as relying on status to know what to diff to a follow-up patch.
--
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