Check SSTables for latest version before dropping compact storage

patch by Ekaterina Dimitrova; reviewed by Andrés de la Peña and Sylvain Lebresne for CASSANDRA-16063
This commit is contained in:
Ekaterina Dimitrova 2020-10-13 15:42:51 +01:00 committed by Andrés de la Peña
parent 42989cee28
commit 0700dfa0bc
2 changed files with 10 additions and 0 deletions

View File

@ -1,4 +1,5 @@
3.0.23:
* Check SSTables for latest version before dropping compact storage (CASSANDRA-16063)
* Handle unexpected columns due to schema races (CASSANDRA-15899)
* Avoid failing compactions with very large partitions (CASSANDRA-15164)
* Use IF NOT EXISTS for index and UDT create statements in snapshot schema files (CASSANDRA-13935)

View File

@ -34,6 +34,7 @@ import org.apache.cassandra.db.marshal.BytesType;
import org.apache.cassandra.db.marshal.EmptyType;
import org.apache.cassandra.db.view.View;
import org.apache.cassandra.exceptions.*;
import org.apache.cassandra.io.sstable.format.SSTableReader;
import org.apache.cassandra.schema.IndexMetadata;
import org.apache.cassandra.schema.Indexes;
import org.apache.cassandra.schema.TableParams;
@ -277,6 +278,14 @@ public class AlterTableStatement extends SchemaAlteringStatement
if (!meta.isCompactTable())
throw new InvalidRequestException("Cannot DROP COMPACT STORAGE on table without COMPACT STORAGE");
// TODO: Global check of the sstables to be added as part of CASSANDRA-15897.
// Currently this is only a local check of the SSTables versions
for (SSTableReader ssTableReader : Keyspace.open(keyspace()).getColumnFamilyStore(columnFamily()).getLiveSSTables())
{
if (!ssTableReader.descriptor.version.isLatestVersion())
throw new InvalidRequestException("Cannot DROP COMPACT STORAGE until all SSTables are upgraded, please run `nodetool upgradesstables` first.");
}
cfm = meta.asNonCompact();
break;
case OPTS: