You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "aweisberg (via GitHub)" <gi...@apache.org> on 2023/08/01 16:37:14 UTC
[GitHub] [cassandra-accord] aweisberg commented on a diff in pull request #50: State Eviction
aweisberg commented on code in PR #50:
URL: https://github.com/apache/cassandra-accord/pull/50#discussion_r1280893667
##########
accord-core/src/main/java/accord/impl/InMemoryCommandStore.java:
##########
@@ -459,45 +408,63 @@ void update(Ranges add)
}
}
- class CFKLoader implements CommandLoader<TxnId>
+ static class CFKEntry extends TxnId
{
- private Command loadForCFK(TxnId data)
+ final boolean uninitialised;
+ public CFKEntry(TxnId copy, boolean uninitialised)
+ {
+ super(copy);
+ this.uninitialised = uninitialised;
+ }
+ }
+
+ class CFKLoader implements CommandLoader<CFKEntry>
+ {
+ final RoutableKey key;
+ CFKLoader(RoutableKey key)
+ {
+ this.key = key;
+ }
+
+ private Command loadForCFK(CFKEntry entry)
{
- GlobalCommand globalCommand = ifPresent(data);
+ GlobalCommand globalCommand = ifPresent(entry);
if (globalCommand != null)
return globalCommand.value();
- throw new IllegalStateException("Could not find command for CFK for " + data);
+ if (entry.uninitialised)
+ return uninitialised(entry);
+ throw new IllegalStateException("Could not find command for CFK for " + entry);
}
@Override
- public TxnId txnId(TxnId txnId)
+ public TxnId txnId(CFKEntry txnId)
{
return loadForCFK(txnId).txnId();
}
@Override
- public Timestamp executeAt(TxnId txnId)
+ public Timestamp executeAt(CFKEntry txnId)
{
return loadForCFK(txnId).executeAt();
}
@Override
- public SaveStatus saveStatus(TxnId txnId)
+ public SaveStatus saveStatus(CFKEntry txnId)
{
return loadForCFK(txnId).saveStatus();
}
@Override
- public List<TxnId> depsIds(TxnId data)
+ public List<TxnId> depsIds(CFKEntry data)
{
PartialDeps deps = loadForCFK(data).partialDeps();
return deps != null ? deps.txnIds() : Collections.emptyList();
}
@Override
- public TxnId saveForCFK(Command command)
+ public CFKEntry saveForCFK(Command command)
{
- return command.txnId();
+ return new CFKEntry(command.txnId(), command.saveStatus() == SaveStatus.Uninitialised);
Review Comment:
Changed
--
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