This is an automated email from the ASF dual-hosted git repository. edimitrova pushed a commit to branch cep-21-tcm-review in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/cep-21-tcm-review by this push: new c38301e23a Suggested tiny fixes No CI was run as it is just small fixes and CI is having a bad day with this branch anyway c38301e23a is described below commit c38301e23afd99d475ab2b4c479af3b5e1579268 Author: Ekaterina Dimitrova <ekaterina.dimitr...@datastax.com> AuthorDate: Tue Oct 17 19:52:08 2023 -0400 Suggested tiny fixes No CI was run as it is just small fixes and CI is having a bad day with this branch anyway --- ci/harry_simulation.sh | 4 +--- .../org/apache/cassandra/auth/AuthKeyspace.java | 4 ++-- .../statements/schema/CreateKeyspaceStatement.java | 4 +++- .../cassandra/locator/InetAddressAndPort.java | 4 ++-- .../schema/DistributedMetadataLogKeyspace.java | 10 ++++----- .../apache/cassandra/schema/ReplicationParams.java | 2 +- .../cassandra/service/StorageServiceMBean.java | 24 +++++++++++----------- .../cassandra/tcm/ClusterMetadataService.java | 8 +++----- .../org/apache/cassandra/tcm/log/LogState.java | 9 +++----- .../cassandra/tcm/ownership/PlacementForRange.java | 4 ++-- .../tcm/ownership/VersionedEndpoints.java | 6 ++++-- .../simulator/test/ShortPaxosSimulationTest.java | 8 ++++---- 12 files changed, 42 insertions(+), 45 deletions(-) diff --git a/ci/harry_simulation.sh b/ci/harry_simulation.sh index 537784b3b7..47d254463f 100755 --- a/ci/harry_simulation.sh +++ b/ci/harry_simulation.sh @@ -35,8 +35,6 @@ common=(-Dstorage-config=$current_dir/../test/conf -Dcassandra.test.sstableformatdevelopment=true -Djava.security.egd=file:/dev/urandom -Dcassandra.testtag=.jdk11 - -Dstorage-config=$current_dir/../test/conf - -Djava.awt.headless=true -Dcassandra.keepBriefBrief=true -Dcassandra.allow_simplestrategy=true -Dcassandra.strict.runtime.checks=true @@ -57,7 +55,7 @@ common=(-Dstorage-config=$current_dir/../test/conf -Dcassandra.test.logConfigPath=$current_dir/../test/conf/log4j2-dtest-simulator.xml -Dcassandra.test.logConfigProperty=log4j.configurationFile -Dlog4j2.configurationFile=$current_dir/../test/conf/log4j2-dtest-simulator.xml - -javaagent:$current_dir/../lib/jamm-0.3.2.jar + -javaagent:$current_dir/../lib/jamm-0.4.0.jar -javaagent:$current_dir/../build/test/lib/jars/simulator-asm.jar -Xbootclasspath/a:$current_dir/../build/test/lib/jars/simulator-bootstrap.jar -XX:ActiveProcessorCount=4 diff --git a/src/java/org/apache/cassandra/auth/AuthKeyspace.java b/src/java/org/apache/cassandra/auth/AuthKeyspace.java index 98a9496064..7546a2e948 100644 --- a/src/java/org/apache/cassandra/auth/AuthKeyspace.java +++ b/src/java/org/apache/cassandra/auth/AuthKeyspace.java @@ -41,13 +41,13 @@ public final class AuthKeyspace { } - public static final int DEFAULT_RF = CassandraRelevantProperties.SYSTEM_AUTH_DEFAULT_RF.getInt(); + private static final int DEFAULT_RF = CassandraRelevantProperties.SYSTEM_AUTH_DEFAULT_RF.getInt(); /** * Generation is used as a timestamp for automatic table creation on startup. * If you make any changes to the tables below, make sure to increment the * generation and document your change here. - * + * <p> * gen 0: original definition in 3.0 * gen 1: compression chunk length reduced to 16KiB, memtable_flush_period_in_ms now unset on all tables in 4.0 */ diff --git a/src/java/org/apache/cassandra/cql3/statements/schema/CreateKeyspaceStatement.java b/src/java/org/apache/cassandra/cql3/statements/schema/CreateKeyspaceStatement.java index 6d432fe5a8..68b91d0ad5 100644 --- a/src/java/org/apache/cassandra/cql3/statements/schema/CreateKeyspaceStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/schema/CreateKeyspaceStatement.java @@ -35,7 +35,9 @@ import org.apache.cassandra.db.guardrails.Guardrails; import org.apache.cassandra.exceptions.AlreadyExistsException; import org.apache.cassandra.locator.LocalStrategy; import org.apache.cassandra.locator.SimpleStrategy; -import org.apache.cassandra.schema.*; +import org.apache.cassandra.schema.Keyspaces; +import org.apache.cassandra.schema.KeyspaceMetadata; +import org.apache.cassandra.schema.Schema; import org.apache.cassandra.schema.KeyspaceParams.Option; import org.apache.cassandra.schema.Keyspaces.KeyspacesDiff; import org.apache.cassandra.service.ClientState; diff --git a/src/java/org/apache/cassandra/locator/InetAddressAndPort.java b/src/java/org/apache/cassandra/locator/InetAddressAndPort.java index 50f3368b20..60c7fd5bf1 100644 --- a/src/java/org/apache/cassandra/locator/InetAddressAndPort.java +++ b/src/java/org/apache/cassandra/locator/InetAddressAndPort.java @@ -48,7 +48,7 @@ import org.apache.cassandra.utils.FastByteOperations; * Opting for a full replacement class so that in the future if we change the nature * of the identifier the refactor will be easier in that we don't have to change the type * just the methods. - * + * <p> * Because an IP might contain multiple C* instances the identification must be done * using the IP + port. InetSocketAddress is undesirable for a couple of reasons. It's not comparable, * it's toString() method doesn't correctly bracket IPv6, it doesn't handle optional default values, @@ -181,7 +181,7 @@ public final class InetAddressAndPort extends InetSocketAddress implements Compa * The string returned is of the form: hostname / literal IP address : port * (without the whitespace). Literal IPv6 addresses will be wrapped with [ ] * to make the port number clear. - * + * <p> * If the host name is unresolved, no reverse name service lookup * is performed. The hostname part will be represented by an empty string. * diff --git a/src/java/org/apache/cassandra/schema/DistributedMetadataLogKeyspace.java b/src/java/org/apache/cassandra/schema/DistributedMetadataLogKeyspace.java index a8e4d67c31..278dcd97ff 100644 --- a/src/java/org/apache/cassandra/schema/DistributedMetadataLogKeyspace.java +++ b/src/java/org/apache/cassandra/schema/DistributedMetadataLogKeyspace.java @@ -60,7 +60,7 @@ public final class DistributedMetadataLogKeyspace * Generation is used as a timestamp for automatic table creation on startup. * If you make any changes to the tables below, make sure to increment the * generation and document your change here. - * + * <p> * gen 0: original definition in 5.0 */ public static final long GENERATION = 0; @@ -96,7 +96,7 @@ public final class DistributedMetadataLogKeyspace } catch (CasWriteTimeoutException t) { - logger.warn("Timed out wile trying to CAS", t); + logger.warn("Timed out while trying to CAS", t); return false; } catch (Throwable t) @@ -151,7 +151,7 @@ public final class DistributedMetadataLogKeyspace } catch (CasWriteTimeoutException t) { - logger.warn("Timed out wile trying to append item to the log: ", t.getMessage()); + logger.warn("Timed out while trying to append item to the log: {}", t.getMessage()); return false; } catch (Throwable t) @@ -160,7 +160,7 @@ public final class DistributedMetadataLogKeyspace return false; } } - + @VisibleForTesting public static void truncateLogState() { @@ -259,7 +259,7 @@ public final class DistributedMetadataLogKeyspace throw new RuntimeException(t); } } - }; + } private static UntypedResultSet execute(String query, ConsistencyLevel cl, Object ... params) { diff --git a/src/java/org/apache/cassandra/schema/ReplicationParams.java b/src/java/org/apache/cassandra/schema/ReplicationParams.java index 1872f3111b..7d78d45b1b 100644 --- a/src/java/org/apache/cassandra/schema/ReplicationParams.java +++ b/src/java/org/apache/cassandra/schema/ReplicationParams.java @@ -46,7 +46,7 @@ import static org.apache.cassandra.db.TypeSizes.sizeof; public final class ReplicationParams { - private static final ReplicationParams META = new ReplicationParams(MetaStrategy.class, ImmutableMap.of());; + private static final ReplicationParams META = new ReplicationParams(MetaStrategy.class, ImmutableMap.of()); public static final Serializer serializer = new Serializer(); public static final MessageSerializer messageSerializer = new MessageSerializer(); diff --git a/src/java/org/apache/cassandra/service/StorageServiceMBean.java b/src/java/org/apache/cassandra/service/StorageServiceMBean.java index f0b79ea03b..c5cc3e0c5d 100644 --- a/src/java/org/apache/cassandra/service/StorageServiceMBean.java +++ b/src/java/org/apache/cassandra/service/StorageServiceMBean.java @@ -1230,16 +1230,16 @@ public interface StorageServiceMBean extends NotificationEmitter public void setSkipStreamDiskSpaceCheck(boolean value); public boolean getSkipStreamDiskSpaceCheck(); - public void addToCms(List<String> ignoredEndpoints); - public void removeFromCms(boolean force); - public Map<String, String> describeCMS(); - public void sealPeriod(); - - public void unsafeRevertClusterMetadata(long epoch); - public String dumpClusterMetadata(long epoch, long transformToEpoch, String version) throws IOException; - public String dumpClusterMetadata() throws IOException; - public void unsafeLoadClusterMetadata(String file) throws IOException; - - public void setCommitsPaused(boolean paused); - public boolean getCommitsPaused(); + void addToCms(List<String> ignoredEndpoints); + void removeFromCms(boolean force); + Map<String, String> describeCMS(); + void sealPeriod(); + + void unsafeRevertClusterMetadata(long epoch); + String dumpClusterMetadata(long epoch, long transformToEpoch, String version) throws IOException; + String dumpClusterMetadata() throws IOException; + void unsafeLoadClusterMetadata(String file) throws IOException; + + void setCommitsPaused(boolean paused); + boolean getCommitsPaused(); } diff --git a/src/java/org/apache/cassandra/tcm/ClusterMetadataService.java b/src/java/org/apache/cassandra/tcm/ClusterMetadataService.java index 6ca65f2931..d01c63b419 100644 --- a/src/java/org/apache/cassandra/tcm/ClusterMetadataService.java +++ b/src/java/org/apache/cassandra/tcm/ClusterMetadataService.java @@ -253,7 +253,6 @@ public class ClusterMetadataService this.peerLogFetcher = peerLogFetcher; } - @SuppressWarnings("resource") public static void initializeForTools(boolean loadSSTables) { if (instance != null) @@ -276,7 +275,6 @@ public class ClusterMetadataService ClusterMetadataService.setInstance(cms); } - @SuppressWarnings("resource") public static void initializeForClients() { if (instance != null) @@ -424,7 +422,7 @@ public class ClusterMetadataService /** * dumps the cluster metadata at the given epoch, returns path to the generated file - * + * <p> * if the given Epoch is EMPTY, we dump the current metadata * * @param epoch dump clustermetadata at this epoch @@ -602,7 +600,7 @@ public class ClusterMetadataService /** * Fetches log entries from directly from CMS, at least to the specified epoch. - * + * <p> * This operation is blocking and also waits for all retrieved log entries to be * enacted, so on return all transformations to ClusterMetadata will be visible. * @return metadata with all currently committed entries enacted. @@ -659,7 +657,7 @@ public class ClusterMetadataService /** * * IMPORTANT: this call can return _without_ catching us up, so should only be used privately. - * + * <p> * Attempts to synchronously retrieve log entries from a non-CMS peer. * Fetches the log state representing the delta between the current local epoch and the one supplied. * This is to be used when a message from a peer contains an epoch higher than the current local epoch. As diff --git a/src/java/org/apache/cassandra/tcm/log/LogState.java b/src/java/org/apache/cassandra/tcm/log/LogState.java index fc1ef8a528..3919a91c73 100644 --- a/src/java/org/apache/cassandra/tcm/log/LogState.java +++ b/src/java/org/apache/cassandra/tcm/log/LogState.java @@ -73,7 +73,7 @@ public class LogState */ public final Replication transformations; - // Uses Replication rather than an just a list of entries primarily to avoid duplicating the existing serializer + // Uses Replication rather than just a list of entries primarily to avoid duplicating the existing serializer public LogState(ClusterMetadata baseState, Replication transformations) { this.baseState = baseState; @@ -192,10 +192,7 @@ public class LogState * should determine the starting period itself (typically by checking the system.sealed_periods table, but * falling back to a full log scan in the pathological case) and will read log entries from either the local or * distributed log table depending on the calling context. - * @param since - * @param snapshots - * @param reader - * @return + * @return LogState */ public static LogState getForRecovery(Epoch target) { @@ -211,7 +208,7 @@ public class LogState if (sealed.epoch.isAfter(target)) { // we need the snapshot from the preceding period plus some entries. Scan result includes the supplied - // start period so we have to either manually decrement the start period (or fetch a list of up to 2 items) + // start period, so we have to either manually decrement the start period (or fetch a list of up to 2 items) List<Sealed> before = Period.scanLogForRecentlySealed(SystemKeyspace.LocalMetadataLog, sealed.period - 1, 1); assert !before.isEmpty() : "No earlier snapshot found, started looking at " + (sealed.period - 1) + " target = " + target; preceding = before.get(0); diff --git a/src/java/org/apache/cassandra/tcm/ownership/PlacementForRange.java b/src/java/org/apache/cassandra/tcm/ownership/PlacementForRange.java index 4aaa1089f5..447bbb84c7 100644 --- a/src/java/org/apache/cassandra/tcm/ownership/PlacementForRange.java +++ b/src/java/org/apache/cassandra/tcm/ownership/PlacementForRange.java @@ -207,7 +207,7 @@ public class PlacementForRange // if any token is < the start or > the end of the ranges covered, error if (tokens.get(0).compareTo(min) < 0 || (!max.equals(min) && tokens.get(tokens.size()-1).compareTo(max) > 0)) - throw new IllegalArgumentException("New tokens exceed total bounds of current placement ranges " + tokens + " " + eprs); + throw new IllegalArgumentException("New tokens exceed total bounds of current placement ranges " + tokens + ' ' + eprs); Iterator<VersionedEndpoints.ForRange> iter = eprs.iterator(); VersionedEndpoints.ForRange current = iter.next(); for (Token token : tokens) @@ -279,7 +279,7 @@ public class PlacementForRange .add(replica, ReplicaCollection.Builder.Conflict.NONE) .build()); }); -; if (group == null) + if (group == null) replicaGroups.put(replica.range(), VersionedEndpoints.forRange(epoch, EndpointsForRange.of(replica))); return this; diff --git a/src/java/org/apache/cassandra/tcm/ownership/VersionedEndpoints.java b/src/java/org/apache/cassandra/tcm/ownership/VersionedEndpoints.java index c867b33f86..151214d4bb 100644 --- a/src/java/org/apache/cassandra/tcm/ownership/VersionedEndpoints.java +++ b/src/java/org/apache/cassandra/tcm/ownership/VersionedEndpoints.java @@ -61,11 +61,13 @@ public interface VersionedEndpoints<E extends Endpoints<E>> extends MetadataValu this.endpointsForRange = endpointsForRange; } + @Override public ForRange withLastModified(Epoch epoch) { return new ForRange(lastModified, endpointsForRange); } + @Override public Epoch lastModified() { return lastModified; @@ -149,6 +151,7 @@ public interface VersionedEndpoints<E extends Endpoints<E>> extends MetadataValu this.endpointsForToken = endpointsForRange; } + @Override public ForToken withLastModified(Epoch epoch) { return new ForToken(lastModified, endpointsForToken); @@ -159,13 +162,12 @@ public interface VersionedEndpoints<E extends Endpoints<E>> extends MetadataValu return new ForToken(lastModified, fn.apply(endpointsForToken)); } - public ForToken without(Set<InetAddressAndPort> remove) { return map(e -> e.without(remove)); } - + @Override public Epoch lastModified() { return lastModified; diff --git a/test/simulator/test/org/apache/cassandra/simulator/test/ShortPaxosSimulationTest.java b/test/simulator/test/org/apache/cassandra/simulator/test/ShortPaxosSimulationTest.java index c1f25b7d67..a0dcd7d03b 100644 --- a/test/simulator/test/org/apache/cassandra/simulator/test/ShortPaxosSimulationTest.java +++ b/test/simulator/test/org/apache/cassandra/simulator/test/ShortPaxosSimulationTest.java @@ -27,14 +27,14 @@ import org.apache.cassandra.simulator.paxos.PaxosSimulationRunner; /** * In order to run these tests in your IDE, you need to first build a simulator jara - * + * <p> * ant simulator-jars - * + * <p> * And then run your test using the following settings (omit add-* if you are running on jdk8): - * + * <p> -Dstorage-config=$MODULE_DIR$/test/conf -Djava.awt.headless=true - -javaagent:$MODULE_DIR$/lib/jamm-0.3.2.jar + -javaagent:$MODULE_DIR$/lib/jamm-0.4.0.jar -ea -Dcassandra.debugrefcount=true -Xss384k --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org