Skip to content

Commit 0e4c2f4

Browse files
committed
Default to nb instead of nc for sstable formats
patch by Berenguer Blasi; reviewed by Francisco Guerrero, Jacek Lewandowski, Michael Semb Wever for CASSANDRA-19010
1 parent 9280372 commit 0e4c2f4

14 files changed

Lines changed: 52 additions & 49 deletions

File tree

CASSANDRA-14092.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CASSANDRA-14092: MAXIMUM TTL EXPIRATION DATE
44
The maximum expiration timestamp that can be represented by the storage engine has been raised to
55
2106-02-07T06:28:13+00:00 from the previous 2038-01-19T03:14:06+00:00, which means that INSERTS using
66
TTL that would expire after this date are not currently supported. Notice that on previous versions <5.0
7-
or when 5.0 is ran in compatibility mode (<="nc" sstable formats) the limit stays at at 2038-01-19T03:14:06+00:00.
7+
or when 5.0 is ran in compatibility mode (<="oa" sstable formats) the limit stays at at 2038-01-19T03:14:06+00:00.
88

99
There is a new yaml property storage_compatibility_mode that determines the
1010
Cassandra major version we want to stay compatible with. Its default is CASSANDRA_4, which means that

NEWS.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ PLEASE READ: MAXIMUM TTL EXPIRATION DATE NOTICE (CASSANDRA-14092 & CASSANDRA-142
44

55
The maximum expiration timestamp that can be represented by the storage engine has been
66
raised to 2106-02-07T06:28:13+00:00 (2038-01-19T03:14:06+00:00 if in compatibility mode
7-
with Cassandra <5.0, sstable version <=nc), which means that inserts with TTL that expire after
7+
with Cassandra <5.0, sstable version <=oa), which means that inserts with TTL that expire after
88
this date are not currently supported. By default, INSERTS with TTL exceeding the
99
maximum supported date are rejected, but it's possible to choose a different
1010
expiration overflow policy. See CASSANDRA-14092.txt for more details.
@@ -165,7 +165,7 @@ New features
165165
- On virtual tables, it is not strictly necessary to specify `ALLOW FILTERING` for select statements which would
166166
normally require it, except `system_views.system_logs`.
167167
- More accurate skipping of sstables in read path due to better handling of min/max clustering and lower bound;
168-
SSTable format has been bumped to 'nc' because there are new fields in stats metadata\
168+
SSTable format has been bumped to 'oa' because there are new fields in stats metadata\
169169
- Added MaxSSTableSize and MaxSSTableDuration metrics to TableMetrics. The former returns the size of the biggest
170170
SSTable of a table or 0 when there is not any SSTable. The latter returns the maximum duration, computed as
171171
`maxTimestamp - minTimestamp`, effectively non-zero for SSTables produced by TimeWindowCompactionStrategy.

conf/cassandra.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2089,7 +2089,7 @@ drop_compact_storage_enabled: false
20892089
# The chosen storage compatiblity mode will determine the versions of the written sstables, commitlogs, hints,
20902090
# etc. Those storage elements will use the higher minor versions of the major version that corresponds to the
20912091
# Cassandra version we want to stay compatible with. For example, if we want to stay compatible with Cassandra 4.0
2092-
# or 4.1, the value of this property should be 4, and that will make us use 'nc' sstables.
2092+
# or 4.1, the value of this property should be 4, and that will make us use 'oa' sstables.
20932093
#
20942094
# This will also determine if certain features depending on newer formats are available. For example, extended TTLs
20952095
# up to 2106 depend on the sstable, commitlog, hints and messaging versions that were introduced by Cassandra 5.0,

conf/jvm-server.options

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@
193193

194194
# Defines how to handle INSERT requests with TTL exceeding the maximum supported expiration date:
195195
# * REJECT: this is the default policy and will reject any requests with expiration date timestamp
196-
# after 2106-02-07T06:28:13+00:00 or 2038-01-19T03:14:06+00:00 depending on compatibility mode (<="nc" sstable formats)
196+
# after 2106-02-07T06:28:13+00:00 or 2038-01-19T03:14:06+00:00 depending on compatibility mode (<="oa" sstable formats)
197197
# * CAP: any insert with TTL expiring after 2106-02-07T06:28:13+00:00 or 2038-01-19T03:14:06+00:00,
198-
# depending on compatibility mode (<="nc" sstable formats), will expire on 2106-02-07T06:28:13+00:00
198+
# depending on compatibility mode (<="oa" sstable formats), will expire on 2106-02-07T06:28:13+00:00
199199
# or 2038-01-19T03:14:06+00:00 and the client will receive a warning.
200200
# * CAP_NOWARN: same as previous, except that the client warning will not be emitted.
201201
#

doc/modules/cassandra/pages/managing/tools/sstable/sstablemetadata.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ It is possible to specify `--scan` option to get additional statistics about a t
271271
Example
272272

273273
....
274-
sstablemetadata -s /var/lib/cassandra/data/data/ks/tb-dbead8501c9511ee805bb3deafc4499b/nc-1-big-Data.db
274+
sstablemetadata -s /var/lib/cassandra/data/data/ks/tb-dbead8501c9511ee805bb3deafc4499b/oa-1-big-Data.db
275275
....
276276

277277
This gives you statistics such as:

doc/modules/cassandra/pages/managing/tools/sstable/sstablepartitions.adoc

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ Use the path to the SSTable file as the only argument.
4646
Example:
4747

4848
....
49-
sstablepartitions data/data/k/t-d7be5e90e90111ed8b54efe3c39cb0bb/nc-8-big-Data.db
49+
sstablepartitions data/data/k/t-d7be5e90e90111ed8b54efe3c39cb0bb/oa-8-big-Data.db
5050
51-
Processing k.t-d7be5e90e90111ed8b54efe3c39cb0bb #8 (big-nc) (1.368 GiB uncompressed, 534.979 MiB on disk)
51+
Processing k.t-d7be5e90e90111ed8b54efe3c39cb0bb #8 (big-oa) (1.368 GiB uncompressed, 534.979 MiB on disk)
5252
Partition size Row count Cell count Tombstone count
5353
~p50 767.519 KiB 770 1916 0
5454
~p75 2.238 MiB 2299 5722 0
@@ -70,7 +70,7 @@ Example:
7070
....
7171
sstablepartitions data/data/k/t-d7be5e90e90111ed8b54efe3c39cb0bb
7272
73-
Processing k.t-d7be5e90e90111ed8b54efe3c39cb0bb #8 (big-nc) (1.368 GiB uncompressed, 534.979 MiB on disk)
73+
Processing k.t-d7be5e90e90111ed8b54efe3c39cb0bb #8 (big-oa) (1.368 GiB uncompressed, 534.979 MiB on disk)
7474
Partition size Row count Cell count Tombstone count
7575
~p50 767.519 KiB 770 1916 0
7676
~p75 2.238 MiB 2299 5722 0
@@ -82,7 +82,7 @@ Processing k.t-d7be5e90e90111ed8b54efe3c39cb0bb #8 (big-nc) (1.368 GiB uncompres
8282
max 356.067 MiB 310706 932118 2450
8383
count 210
8484
85-
Processing k.t-d7be5e90e90111ed8b54efe3c39cb0bb #9 (big-nc) (457.540 MiB uncompressed, 174.880 MiB on disk)
85+
Processing k.t-d7be5e90e90111ed8b54efe3c39cb0bb #9 (big-oa) (457.540 MiB uncompressed, 174.880 MiB on disk)
8686
Partition size Row count Cell count Tombstone count
8787
~p50 1.865 MiB 1597 4768 0
8888
~p75 13.858 MiB 14237 42510 0
@@ -102,15 +102,15 @@ Use the `--min-size` option to specify the minimum size a partition must have to
102102
Example:
103103

104104
....
105-
sstablepartitions data/data/k/t-d7be5e90e90111ed8b54efe3c39cb0bb/nc-8-big-Data.db --min-size 100MiB
105+
sstablepartitions data/data/k/t-d7be5e90e90111ed8b54efe3c39cb0bb/oa-8-big-Data.db --min-size 100MiB
106106
107-
Processing k.t-d7be5e90e90111ed8b54efe3c39cb0bb #8 (big-nc) (1.368 GiB uncompressed, 534.979 MiB on disk)
107+
Processing k.t-d7be5e90e90111ed8b54efe3c39cb0bb #8 (big-oa) (1.368 GiB uncompressed, 534.979 MiB on disk)
108108
Partition: '13' (0000000d) live, size: 105.056 MiB, rows: 91490, cells: 274470, tombstones: 50 (row:50, range:0, complex:0, cell:0, row-TTLd:0, cell-TTLd:0)
109109
Partition: '1' (00000001) live, size: 127.241 MiB, rows: 111065, cells: 333195, tombstones: 50 (row:50, range:0, complex:0, cell:0, row-TTLd:0, cell-TTLd:0)
110110
Partition: '8' (00000008) live, size: 356.067 MiB, rows: 310706, cells: 932118, tombstones: 0 (row:0, range:0, complex:0, cell:0, row-TTLd:0, cell-TTLd:0)
111111
Partition: '2' (00000002) live, size: 213.341 MiB, rows: 186582, cells: 559125, tombstones: 978 (row:978, range:0, complex:0, cell:0, row-TTLd:0, cell-TTLd:0)
112-
Summary of k.t-d7be5e90e90111ed8b54efe3c39cb0bb #8 (big-nc):
113-
File: /Users/adelapena/src/cassandra/trunk/data/data/k/t-d7be5e90e90111ed8b54efe3c39cb0bb/nc-8-big-Data.db
112+
Summary of k.t-d7be5e90e90111ed8b54efe3c39cb0bb #8 (big-oa):
113+
File: /Users/adelapena/src/cassandra/trunk/data/data/k/t-d7be5e90e90111ed8b54efe3c39cb0bb/oa-8-big-Data.db
114114
4 partitions match
115115
Keys: 13 1 8 2
116116
Partition size Row count Cell count Tombstone count
@@ -132,15 +132,15 @@ Use the `--min-tombstones` option to specify the minimum number of tombstones a
132132
Example:
133133

134134
....
135-
sstablepartitions data/data/k/t-d7be5e90e90111ed8b54efe3c39cb0bb/nc-8-big-Data.db --min-tombstones 1000
135+
sstablepartitions data/data/k/t-d7be5e90e90111ed8b54efe3c39cb0bb/oa-8-big-Data.db --min-tombstones 1000
136136
137-
Processing k.t-d7be5e90e90111ed8b54efe3c39cb0bb #8 (big-nc) (1.368 GiB uncompressed, 534.979 MiB on disk)
137+
Processing k.t-d7be5e90e90111ed8b54efe3c39cb0bb #8 (big-oa) (1.368 GiB uncompressed, 534.979 MiB on disk)
138138
Partition: '55' (00000037) live, size: 1.290 MiB, rows: 2317, cells: 3474, tombstones: 1159 (row:1159, range:0, complex:0, cell:0, row-TTLd:0, cell-TTLd:0)
139139
Partition: '28' (0000001c) live, size: 1.198 MiB, rows: 2099, cells: 3147, tombstones: 1050 (row:1050, range:0, complex:0, cell:0, row-TTLd:0, cell-TTLd:0)
140140
Partition: '89' (00000059) live, size: 1.346 MiB, rows: 2226, cells: 3339, tombstones: 1113 (row:1113, range:0, complex:0, cell:0, row-TTLd:0, cell-TTLd:0)
141141
Partition: '21' (00000015) live, size: 3.853 MiB, rows: 4900, cells: 9927, tombstones: 2450 (row:2450, range:0, complex:0, cell:0, row-TTLd:0, cell-TTLd:0)
142-
Summary of k.t-d7be5e90e90111ed8b54efe3c39cb0bb #8 (big-nc):
143-
File: /Users/adelapena/src/cassandra/trunk/data/data/k/t-d7be5e90e90111ed8b54efe3c39cb0bb/nc-8-big-Data.db
142+
Summary of k.t-d7be5e90e90111ed8b54efe3c39cb0bb #8 (big-oa):
143+
File: /Users/adelapena/src/cassandra/trunk/data/data/k/t-d7be5e90e90111ed8b54efe3c39cb0bb/oa-8-big-Data.db
144144
4 partitions match
145145
Keys: 55 28 89 21
146146
Partition size Row count Cell count Tombstone count
@@ -162,10 +162,10 @@ Use the `--csv` option to output a CSV machine-readable output, combined with an
162162
Example:
163163

164164
....
165-
sstablepartitions data/data/k/t-d7be5e90e90111ed8b54efe3c39cb0bb/nc-8-big-Data.db --min-size 100MiB --csv
165+
sstablepartitions data/data/k/t-d7be5e90e90111ed8b54efe3c39cb0bb/oa-8-big-Data.db --min-size 100MiB --csv
166166
key,keyBinary,live,offset,size,rowCount,cellCount,tombstoneCount,rowTombstoneCount,rangeTombstoneCount,complexTombstoneCount,cellTombstoneCount,rowTtlExpired,cellTtlExpired,directory,keyspace,table,index,snapshot,backup,generation,format,version
167-
"13",0000000d,true,186403543,110158965,91490,274470,50,50,0,0,0,0,0,/Users/adelapena/src/cassandra/trunk/data/data/k/t-d7be5e90e90111ed8b54efe3c39cb0bb/nc-8-big-Data.db,k,t,,,,8,big,nc
168-
"1",00000001,true,325141542,133422183,111065,333195,50,50,0,0,0,0,0,/Users/adelapena/src/cassandra/trunk/data/data/k/t-d7be5e90e90111ed8b54efe3c39cb0bb/nc-8-big-Data.db,k,t,,,,8,big,nc
169-
"8",00000008,true,477133752,373362819,310706,932118,0,0,0,0,0,0,0,/Users/adelapena/src/cassandra/trunk/data/data/k/t-d7be5e90e90111ed8b54efe3c39cb0bb/nc-8-big-Data.db,k,t,,,,8,big,nc
170-
"2",00000002,true,851841363,223704192,186582,559125,978,978,0,0,0,0,0,/Users/adelapena/src/cassandra/trunk/data/data/k/t-d7be5e90e90111ed8b54efe3c39cb0bb/nc-8-big-Data.db,k,t,,,,8,big,nc
167+
"13",0000000d,true,186403543,110158965,91490,274470,50,50,0,0,0,0,0,/Users/adelapena/src/cassandra/trunk/data/data/k/t-d7be5e90e90111ed8b54efe3c39cb0bb/oa-8-big-Data.db,k,t,,,,8,big,oa
168+
"1",00000001,true,325141542,133422183,111065,333195,50,50,0,0,0,0,0,/Users/adelapena/src/cassandra/trunk/data/data/k/t-d7be5e90e90111ed8b54efe3c39cb0bb/oa-8-big-Data.db,k,t,,,,8,big,oa
169+
"8",00000008,true,477133752,373362819,310706,932118,0,0,0,0,0,0,0,/Users/adelapena/src/cassandra/trunk/data/data/k/t-d7be5e90e90111ed8b54efe3c39cb0bb/oa-8-big-Data.db,k,t,,,,8,big,oa
170+
"2",00000002,true,851841363,223704192,186582,559125,978,978,0,0,0,0,0,/Users/adelapena/src/cassandra/trunk/data/data/k/t-d7be5e90e90111ed8b54efe3c39cb0bb/oa-8-big-Data.db,k,t,,,,8,big,oa
171171
....

src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ protected SSTableReader(Builder<?, ?> builder, Owner owner)
458458
this.openReason = builder.getOpenReason();
459459
this.first = builder.getFirst();
460460
this.last = builder.getLast();
461-
this.bounds = AbstractBounds.strictlyWrapsAround(first.getToken(), last.getToken())
461+
this.bounds = first == null || last == null || AbstractBounds.strictlyWrapsAround(first.getToken(), last.getToken())
462462
? null // this will cause the validation to fail, but the reader is opened with no validation,
463463
// e.g. for scrubbing, we should accept screwed bounds
464464
: AbstractBounds.bounds(first.getToken(), true, last.getToken(), true);

src/java/org/apache/cassandra/io/sstable/format/Version.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ protected Version(SSTableFormat format, String version)
7474
public abstract boolean hasOldBfFormat();
7575

7676
/**
77-
* @deprecated it is replaced by {@link #hasImprovedMinMax()} since 'nc' and to be completetly removed since 'oa'
77+
* @deprecated it is replaced by {@link #hasImprovedMinMax()} since 'oa' and to be completetly removed after 'oa'
7878
*/
7979
/** @deprecated See CASSANDRA-18134 */
8080
@Deprecated(since = "5.0")
8181
public abstract boolean hasAccurateMinMax();
8282

8383
/**
84-
* @deprecated it is replaced by {@link #hasImprovedMinMax()} since 'nc' and to be completetly removed since 'oa'
84+
* @deprecated it is replaced by {@link #hasImprovedMinMax()} since 'oa' and to be completetly removed after 'oa'
8585
*/
8686
/** @deprecated See CASSANDRA-18134 */
8787
@Deprecated(since = "5.0")

src/java/org/apache/cassandra/io/sstable/format/big/BigFormat.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ public BigTableWriter.Builder builder(Descriptor descriptor)
337337

338338
static class BigVersion extends Version
339339
{
340-
public static final String current_version = DatabaseDescriptor.getStorageCompatibilityMode().isBefore(5) ? "nc" : "oa";
340+
public static final String current_version = DatabaseDescriptor.getStorageCompatibilityMode().isBefore(5) ? "nb" : "oa";
341341
public static final String earliest_supported_version = "ma";
342342

343343
// ma (3.0.0): swap bf hash order
@@ -349,8 +349,8 @@ static class BigVersion extends Version
349349

350350
// na (4.0-rc1): uncompressed chunks, pending repair session, isTransient, checksummed sstable metadata file, new Bloomfilter format
351351
// nb (4.0.0): originating host id
352-
// nc (5.0): improved min/max, partition level deletion presence marker, key range (CASSANDRA-18134)
353-
// oa (5.0): Long deletionTime to prevent TTL overflow
352+
// oa (5.0): improved min/max, partition level deletion presence marker, key range (CASSANDRA-18134)
353+
// Long deletionTime to prevent TTL overflow
354354
// token space coverage
355355
//
356356
// NOTE: When adding a new version:
@@ -389,18 +389,18 @@ static class BigVersion extends Version
389389

390390
hasCommitLogLowerBound = version.compareTo("mb") >= 0;
391391
hasCommitLogIntervals = version.compareTo("mc") >= 0;
392-
hasAccurateMinMax = version.matches("(m[d-z])|(n[a-z])"); // deprecated in 'nc' and to be removed in 'oa'
393-
hasLegacyMinMax = version.matches("(m[a-z])|(n[a-z])"); // deprecated in 'nc' and to be removed in 'oa'
392+
hasAccurateMinMax = version.matches("(m[d-z])|(n[a-z])"); // deprecated in 'oa' and to be removed after 'oa'
393+
hasLegacyMinMax = version.matches("(m[a-z])|(n[a-z])"); // deprecated in 'oa' and to be removed after 'oa'
394394
// When adding a new version you might need to add it here
395395
hasOriginatingHostId = version.compareTo("nb") >= 0 || version.matches("(m[e-z])");
396396
hasMaxCompressedLength = version.compareTo("na") >= 0;
397397
hasPendingRepair = version.compareTo("na") >= 0;
398398
hasIsTransient = version.compareTo("na") >= 0;
399399
hasMetadataChecksum = version.compareTo("na") >= 0;
400400
hasOldBfFormat = version.compareTo("na") < 0;
401-
hasImprovedMinMax = version.compareTo("nc") >= 0;
402-
hasPartitionLevelDeletionPresenceMarker = version.compareTo("nc") >= 0;
403-
hasKeyRange = version.compareTo("nc") >= 0;
401+
hasImprovedMinMax = version.compareTo("oa") >= 0;
402+
hasPartitionLevelDeletionPresenceMarker = version.compareTo("oa") >= 0;
403+
hasKeyRange = version.compareTo("oa") >= 0;
404404
hasUintDeletionTime = version.compareTo("oa") >= 0;
405405
hasTokenSpaceCoverage = version.compareTo("oa") >= 0;
406406
}

test/distributed/org/apache/cassandra/distributed/upgrade/MixedModeTTLOverflowUpgradeTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
import static org.apache.cassandra.utils.StorageCompatibilityMode.UPGRADING;
3434

3535
/**
36-
* Tests TTL the overflow policy triggers at the correct limit: year 2038 <=nc or 2186 >nc
36+
* Tests TTL the overflow policy triggers at the correct limit: year 2038 <=nb or 2186 >=oa
3737
* <p>
38-
* <=nc overflow policy triggers at year 2038. That could be <=4.1 or 5.0 with 4.x storage compatibility
39-
* >nc overflow policy triggers at year 2106. That is >=5.0 using >=5.x storage compatibility
38+
* <=oa overflow policy triggers at year 2038. That could be <=4.1 or 5.0 with 4.x storage compatibility
39+
* >oa overflow policy triggers at year 2106. That is >=5.0 using >=5.x storage compatibility
4040
*
4141
* @see StorageCompatibilityMode
4242
*/
@@ -94,13 +94,13 @@ public void testTTLOverflowAfterUpgrade() throws Throwable
9494
assertPolicyTriggersAt2038(cluster.coordinator(1));
9595
assertPolicyTriggersAt2038(cluster.coordinator(2));
9696

97-
// We restart one node on 5.0 >nc hence 2038 should still be the limit as the other node is 5.0 <=nc
98-
// We're on compatibility mode where nc and oa nodes are a possibility
97+
// We restart one node on 5.0 >oa hence 2038 should still be the limit as the other node is 5.0 <=oa
98+
// We're on compatibility mode where oa and oa nodes are a possibility
9999
restartNodeWithCompatibilityMode(cluster, 1, UPGRADING);
100100
assertPolicyTriggersAt2038(cluster.coordinator(1));
101101
assertPolicyTriggersAt2038(cluster.coordinator(2));
102102

103-
// We restart the other node so they're all on 5.0 >nc hence 2106 should be the limit
103+
// We restart the other node so they're all on 5.0 >oa hence 2106 should be the limit
104104
restartNodeWithCompatibilityMode(cluster, 2, UPGRADING);
105105
assertPolicyTriggersAt2106(cluster.coordinator(1));
106106
assertPolicyTriggersAt2106(cluster.coordinator(2));

0 commit comments

Comments
 (0)