Merge branch 'cassandra-5.0' into trunk

* cassandra-5.0:
  Deprecate and ignore use_deterministic_table_id
This commit is contained in:
Caleb Rackliffe 2024-07-31 16:24:49 -05:00
commit f95c1b5bb3
8 changed files with 12 additions and 30 deletions

View File

@ -64,6 +64,7 @@
* Add the ability to disable bulk loading of SSTables (CASSANDRA-18781)
* Clean up obsolete functions and simplify cql_version handling in cqlsh (CASSANDRA-18787)
Merged from 5.0:
* Deprecate and ignore use_deterministic_table_id (CASSANDRA-19809)
* Prioritize built indexes in IndexStatusManager (CASSANDRA-19400)
* Add java.base/java.lang.reflect among opens for jvm11-client.options (CASSANDRA-19780)
* Move bcpkix-jdk18on to build dependencies, update to 1.78 and explicitly enumerate transitive dependencies (CASSANDRA-19739)

View File

@ -153,6 +153,7 @@ Upgrading
Deprecation
-----------
- `use_deterministic_table_id` is no longer supported and should be removed from cassandra.yaml. Table IDs may still be supplied explicitly on CREATE.
5.0
@ -365,6 +366,7 @@ Deprecation
in a future release. A single native port can be used for both encrypted and unencrypted traffic; see CASSANDRA-10559.
Cluster hosts running with dual native ports were not correctly identified in the system.peers tables and server-sent EVENTs,
causing clients that encrypt traffic to fail to maintain correct connection pools. For more information, see CASSANDRA-19392.
- Deprecated `use_deterministic_table_id` in cassandra.yaml. Table IDs may still be supplied explicitly on CREATE.
4.1
===

View File

@ -124,6 +124,7 @@ public class Config
public DiskFailurePolicy disk_failure_policy = DiskFailurePolicy.ignore;
public CommitFailurePolicy commit_failure_policy = CommitFailurePolicy.stop;
@Deprecated(since = "5.0.1")
public volatile boolean use_deterministic_table_id = false;
/* initial token in the ring */

View File

@ -1009,6 +1009,8 @@ public class DatabaseDescriptor
conf.native_transport_min_backoff_on_queue_overload,
conf.native_transport_max_backoff_on_queue_overload));
if (conf.use_deterministic_table_id)
logger.warn("use_deterministic_table_id is no longer supported and should be removed from cassandra.yaml.");
}
@VisibleForTesting
@ -3477,16 +3479,6 @@ public class DatabaseDescriptor
return conf.hinted_handoff_disabled_datacenters;
}
public static boolean useDeterministicTableID()
{
return conf != null && conf.use_deterministic_table_id;
}
public static void useDeterministicTableID(boolean value)
{
conf.use_deterministic_table_id = value;
}
public static void enableHintsForDC(String dc)
{
conf.hinted_handoff_disabled_datacenters.remove(dc);

View File

@ -31,7 +31,6 @@ import org.apache.cassandra.audit.AuditLogEntryType;
import org.apache.cassandra.auth.DataResource;
import org.apache.cassandra.auth.IResource;
import org.apache.cassandra.auth.Permission;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.cql3.*;
import org.apache.cassandra.cql3.functions.masking.ColumnMask;
import org.apache.cassandra.db.guardrails.Guardrails;
@ -127,7 +126,7 @@ public final class CreateTableStatement extends AlterSchemaStatement
// We do not want to set table ID here just yet, since we are using CQL for serialising a fully expanded CREATE TABLE statement.
this.expandedCql = builder.build().toCqlString(false, attrs.hasProperty(TableAttributes.ID), ifNotExists);
if (!attrs.hasProperty(TableAttributes.ID) && !DatabaseDescriptor.useDeterministicTableID())
if (!attrs.hasProperty(TableAttributes.ID))
builder.id(TableId.get(metadata));
TableMetadata table = builder.build();
table.validate();

View File

@ -327,7 +327,7 @@ public final class CreateViewStatement extends AlterSchemaStatement
if (attrs.hasProperty(TableAttributes.ID))
builder.id(attrs.getId());
else if (!builder.hasId() && !DatabaseDescriptor.useDeterministicTableID())
else if (!builder.hasId())
builder.id(TableId.get(metadata));
builder.params(attrs.asNewTableParams())

View File

@ -829,7 +829,7 @@ public class TableMetadata implements SchemaElement
{
// make sure vtables use deteriminstic ids so they can be referenced in calls cross-nodes
// see CASSANDRA-17295
if (DatabaseDescriptor.useDeterministicTableID() || kind == Kind.VIRTUAL)
if (kind == Kind.VIRTUAL)
id = TableId.unsafeDeterministic(keyspace, name);
else
id = TableId.generate();

View File

@ -27,7 +27,6 @@ import java.util.UUID;
import org.junit.Assert;
import org.junit.Test;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.cql3.Duration;
import org.apache.cassandra.db.Mutation;
@ -62,6 +61,7 @@ import static org.apache.cassandra.cql3.Duration.NANOS_PER_MINUTE;
import static org.apache.cassandra.tcm.membership.MembershipUtils.endpoint;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@ -725,24 +725,11 @@ public class CreateTest extends CQLTester
}
@Test
public void testUsingDeterministicTableID()
public void testNotUsingDeterministicTableIDOnCreate()
{
DatabaseDescriptor.useDeterministicTableID(true);
createTable("CREATE TABLE %s (id text PRIMARY KEY);");
TableMetadata tmd = currentTableMetadata();
assertEquals(TableId.unsafeDeterministic(tmd.keyspace, tmd.name), tmd.id);
}
@Test
public void testNotUsingDeterministicTableIDWhenDisabled()
{
DatabaseDescriptor.useDeterministicTableID(false);
createTable("CREATE TABLE %s (id text PRIMARY KEY);");
TableMetadata tmd = currentTableMetadata();
assertFalse(TableId.unsafeDeterministic(tmd.keyspace, tmd.name).equals(tmd.id));
assertNotEquals(TableId.unsafeDeterministic(tmd.keyspace, tmd.name), tmd.id);
}
private void assertThrowsConfigurationException(String errorMsg, String createStmt)