ifesdjeen commented on code in PR #3458:
URL: https://github.com/apache/cassandra/pull/3458#discussion_r1716527620


##########
src/java/org/apache/cassandra/tcm/log/LogReader.java:
##########
@@ -110,6 +112,54 @@ default LogState getLogState(Epoch startEpoch)
         }
     }
 
+    default LogState getLogState(Epoch start, Epoch end)
+    {
+        try
+        {
+            ClusterMetadata closestSnapshot = 
snapshots().getSnapshotBefore(start);
+
+            // Snapshot could not be found, fetch enough epochs to reconstruct 
the start metadata
+            if (closestSnapshot == null)
+            {
+                closestSnapshot = new 
ClusterMetadata(DatabaseDescriptor.getPartitioner());
+                ImmutableList.Builder<Entry> entries = new 
ImmutableList.Builder<>();
+                EntryHolder entryHolder = getEntries(Epoch.EMPTY, end);
+                for (Entry entry : entryHolder.entries)
+                {
+                    if (entry.epoch.isAfter(start))
+                        entries.add(entry);
+                    else
+                        closestSnapshot = 
entry.transform.execute(closestSnapshot).success().metadata;
+                }
+                return new LogState(closestSnapshot, entries.build());
+            }
+            else if (closestSnapshot.epoch.isBefore(start))
+            {
+                ImmutableList.Builder<Entry> entries = new 
ImmutableList.Builder<>();
+                // TODO (required): EntryHolder#add seems not to play along 
with the low epoch bound.

Review Comment:
   I could not find how



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to