Skip to content

Commit a866f92

Browse files
committed
Improve:
- Journal debugging vtable support - Background task tracing support Fix: - HLC_BOUND only valid for strictly lower HLC - HAS_UNIQUE_HLC can only be safely computed if READY_TO_EXECUTE - Break recursion in CommandStore.ensureReadyToCoordinate - Fix find intersecting shard scheduler - Separate adhoc ShardScheduler from normal to avoid overwriting - Should still use execution listeners to detect invalid reads for certain transactions even with dataStoreDetectsFutureReads patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20746
1 parent 30f0940 commit a866f92

File tree

8 files changed

+888
-9
lines changed

8 files changed

+888
-9
lines changed

modules/accord

Submodule accord updated 24 files

src/java/org/apache/cassandra/db/virtual/AccordDebugKeyspace.java

Lines changed: 410 additions & 6 deletions
Large diffs are not rendered by default.

src/java/org/apache/cassandra/service/accord/AccordCommandStore.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,12 @@ public Command loadCommand(TxnId txnId)
443443
return journal.loadCommand(id, txnId, unsafeGetRedundantBefore(), durableBefore());
444444
}
445445

446+
@VisibleForTesting
447+
public List<AccordJournal.DebugEntry> debugCommand(TxnId txnId)
448+
{
449+
return (List<AccordJournal.DebugEntry>) journal.debugCommand(id, txnId);
450+
}
451+
446452
public static Command prepareToCache(Command command)
447453
{
448454
// TODO (required): validate we don't have duplicate objects

src/java/org/apache/cassandra/service/accord/AccordJournal.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@
1919

2020
import java.io.IOException;
2121
import java.nio.ByteBuffer;
22+
import java.util.ArrayList;
2223
import java.util.Collection;
2324
import java.util.Collections;
2425
import java.util.Iterator;
26+
import java.util.List;
2527
import java.util.NavigableMap;
2628
import java.util.concurrent.TimeUnit;
2729
import java.util.concurrent.TimeoutException;
2830
import java.util.function.Consumer;
31+
import java.util.function.Supplier;
2932
import javax.annotation.Nullable;
3033

3134
import com.google.common.annotations.VisibleForTesting;
@@ -228,6 +231,39 @@ public Command loadCommand(int commandStoreId, TxnId txnId, RedundantBefore redu
228231
return builder.construct(redundantBefore);
229232
}
230233

234+
public static class DebugEntry implements Supplier<CommandChange.Builder>
235+
{
236+
public final long segment;
237+
public final int position;
238+
public final Builder builder;
239+
240+
public DebugEntry(long segment, int position, Builder builder)
241+
{
242+
this.segment = segment;
243+
this.position = position;
244+
this.builder = builder;
245+
}
246+
247+
@Override
248+
public CommandChange.Builder get()
249+
{
250+
return builder;
251+
}
252+
}
253+
254+
@Override
255+
public List<DebugEntry> debugCommand(int commandStoreId, TxnId txnId)
256+
{
257+
JournalKey key = new JournalKey(txnId, JournalKey.Type.COMMAND_DIFF, commandStoreId);
258+
List<DebugEntry> result = new ArrayList<>();
259+
journalTable.readAll(key, (long segment, int position, JournalKey k, ByteBuffer buffer, int userVersion) -> {
260+
Builder builder = new Builder(txnId);
261+
new AccordJournalTable.RecordConsumerAdapter<>(builder::deserializeNext).accept(segment, position, k, buffer, userVersion);
262+
result.add(new DebugEntry(segment, position, builder));
263+
});
264+
return result;
265+
}
266+
231267
@Override
232268
public Command.Minimal loadMinimal(int commandStoreId, TxnId txnId, Load load, RedundantBefore redundantBefore, DurableBefore durableBefore)
233269
{

src/java/org/apache/cassandra/service/accord/AccordJournalTable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public interface Reader
192192
void read(DataInputPlus input, Version userVersion) throws IOException;
193193
}
194194

195-
private static class RecordConsumerAdapter<K> implements RecordConsumer<K>
195+
static class RecordConsumerAdapter<K> implements RecordConsumer<K>
196196
{
197197
protected final Reader reader;
198198

0 commit comments

Comments
 (0)