Skip to content

Commit f106fe6

Browse files
committed
Feedback
1 parent 8ebda98 commit f106fe6

File tree

10 files changed

+248
-308
lines changed

10 files changed

+248
-308
lines changed

src/java/org/apache/cassandra/db/ColumnFamilyStore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3253,7 +3253,7 @@ void onTableDropped()
32533253

32543254
data.notifyDropped(DatabaseDescriptor.getAutoSnapshotTtl());
32553255

3256-
// TODO (required): mutation tracking
3256+
// TODO (required): mutation tracking + table dropping
32573257
if (metadata().replicationType().isTracked())
32583258
throw new IllegalStateException("not implemented");
32593259
else

src/java/org/apache/cassandra/journal/ActiveSegment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ StaticSegment<K, V> asStatic()
142142
@Override
143143
public void persistMetadata()
144144
{
145-
throw new UnsupportedOperationException("Can not mutate active segment's metadata. It should be done on flush.");
145+
throw new UnsupportedOperationException("Can not mutate active segment's metadata.");
146146
}
147147

148148
/**

src/java/org/apache/cassandra/journal/Journal.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,7 @@ protected void closeActiveSegmentAndOpenAsStatic(ActiveSegment<K, V> activeSegme
923923
{
924924
closeActiveSegmentAndOpenAsStatic(activeSegment, null);
925925
}
926+
926927
protected void closeActiveSegmentAndOpenAsStatic(ActiveSegment<K, V> activeSegment, @Nullable Runnable onDone)
927928
{
928929
if (activeSegment.isEmpty())

src/java/org/apache/cassandra/journal/Metadata.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
2323
import java.util.zip.CRC32;
2424

25-
import accord.utils.Invariants;
2625
import org.apache.cassandra.io.util.*;
2726
import org.apache.cassandra.utils.Crc;
2827

@@ -38,20 +37,21 @@ public final class Metadata
3837
{
3938
private int fsyncLimit;
4039
// Indicates whether a segment needs to be replayed or no.
41-
private volatile boolean needsReplay = true;
40+
private volatile boolean needsReplay;
4241
private volatile int recordsCount;
4342
private static final AtomicIntegerFieldUpdater<Metadata> recordsCountUpdater =
4443
AtomicIntegerFieldUpdater.newUpdater(Metadata.class, "recordsCount");
4544

4645
static Metadata empty()
4746
{
48-
return new Metadata(0, 0);
47+
return new Metadata(0, 0, true);
4948
}
5049

51-
private Metadata(int recordsCount, int fsyncLimit)
50+
private Metadata(int recordsCount, int fsyncLimit, boolean needsReplay)
5251
{
5352
this.recordsCount = recordsCount;
5453
this.fsyncLimit = fsyncLimit;
54+
this.needsReplay = needsReplay;
5555
}
5656

5757
void update()
@@ -64,10 +64,9 @@ void fsyncLimit(int fsyncLimit)
6464
this.fsyncLimit = fsyncLimit;
6565
}
6666

67-
public void needsReplay(boolean needsReplay)
67+
public void clearNeedsReplay()
6868
{
69-
Invariants.require(this.needsReplay && !needsReplay, "needsReplay can only go from true to false. Old value: %s, new value: %s", this.needsReplay, needsReplay);
70-
this.needsReplay = needsReplay;
69+
this.needsReplay = false;
7170
}
7271

7372
int fsyncLimit()
@@ -112,7 +111,7 @@ static Metadata read(DataInputPlus in) throws IOException
112111
updateChecksumInt(crc, fsyncLimit);
113112
updateChecksumInt(crc, needsReplay ? 1 : 0);
114113
validateCRC(crc, in.readInt());
115-
return new Metadata(recordsCount, fsyncLimit);
114+
return new Metadata(recordsCount, fsyncLimit, needsReplay);
116115
}
117116

118117
void persist(Descriptor descriptor)
@@ -162,7 +161,7 @@ static <K> Metadata rebuild(Descriptor descriptor, KeySupport<K> keySupport)
162161
throw e;
163162
}
164163

165-
return new Metadata(recordsCount, fsyncLimit);
164+
return new Metadata(recordsCount, fsyncLimit, true);
166165
}
167166

168167
static <K> Metadata rebuildAndPersist(Descriptor descriptor, KeySupport<K> keySupport)

src/java/org/apache/cassandra/journal/Segments.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -136,20 +136,6 @@ void select(long minTimestamp, long maxTimestamp, Collection<Segment<K, V>> into
136136
into.add(segment);
137137
}
138138

139-
Segment<K, V>[] select(long[] segmentIds)
140-
{
141-
@SuppressWarnings({ "unchecked" })
142-
Segment<K, V>[] segments = new Segment[segmentIds.length];
143-
for (int i = 0; i < segmentIds.length; i++)
144-
segments[i] = Invariants.nonNull(this.segments.get(segmentIds[i]));
145-
return segments;
146-
}
147-
148-
Segment<K, V> select(long segmentId)
149-
{
150-
return Invariants.nonNull(this.segments.get(segmentId));
151-
}
152-
153139
boolean isSwitched(ActiveSegment<K, V> active)
154140
{
155141
for (Segment<K, V> segment : segments.values())

src/java/org/apache/cassandra/replication/DefaultStateTracker.java

Lines changed: 0 additions & 261 deletions
This file was deleted.

0 commit comments

Comments
 (0)