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 ccc3081c18 Small JavaDoc, warnings, and code style fixes ccc3081c18 is described below commit ccc3081c1845b2a4664314b5cd9ba1ae4d8f543d Author: Ekaterina Dimitrova <ekaterina.dimitr...@datastax.com> AuthorDate: Tue Oct 24 12:12:15 2023 -0400 Small JavaDoc, warnings, and code style fixes --- .../apache/cassandra/config/CassandraRelevantProperties.java | 2 +- .../org/apache/cassandra/tcm/ClusterMetadataService.java | 8 ++++---- src/java/org/apache/cassandra/tcm/Period.java | 2 +- src/java/org/apache/cassandra/tcm/Processor.java | 4 ++-- src/java/org/apache/cassandra/tcm/RecentlySealedPeriods.java | 2 +- src/java/org/apache/cassandra/tcm/RemoteProcessor.java | 3 --- src/java/org/apache/cassandra/tcm/Retry.java | 9 +++++++-- src/java/org/apache/cassandra/tcm/listeners/LogListener.java | 2 +- .../cassandra/tcm/listeners/MetadataSnapshotListener.java | 2 +- src/java/org/apache/cassandra/tcm/log/LocalLog.java | 7 +++---- src/java/org/apache/cassandra/tcm/log/LogStorage.java | 4 ++-- src/java/org/apache/cassandra/tcm/membership/Directory.java | 2 +- src/java/org/apache/cassandra/tcm/migration/Election.java | 4 ++-- .../cassandra/tcm/transformations/cms/FinishAddToCMS.java | 2 +- .../apache/cassandra/tcm/transformations/cms/Initialize.java | 12 ++++-------- 15 files changed, 31 insertions(+), 34 deletions(-) diff --git a/src/java/org/apache/cassandra/config/CassandraRelevantProperties.java b/src/java/org/apache/cassandra/config/CassandraRelevantProperties.java index 554e407bbf..b8b3a4c04b 100644 --- a/src/java/org/apache/cassandra/config/CassandraRelevantProperties.java +++ b/src/java/org/apache/cassandra/config/CassandraRelevantProperties.java @@ -513,7 +513,7 @@ public enum CassandraRelevantProperties TCM_PROGRESS_BARRIER_TIMEOUT_MILLIS("cassandra.progress_barrier_timeout_ms", "3600000"), /** - * Maximum sized of the {@code RecentlySealedPeriods} in-memory index. + * Maximum size of the {@code RecentlySealedPeriods} in-memory index. */ TCM_RECENTLY_SEALED_PERIOD_INDEX_SIZE("cassandra.recently_sealed_period_index_size", "10"), diff --git a/src/java/org/apache/cassandra/tcm/ClusterMetadataService.java b/src/java/org/apache/cassandra/tcm/ClusterMetadataService.java index 9575e4b635..80d0b40f04 100644 --- a/src/java/org/apache/cassandra/tcm/ClusterMetadataService.java +++ b/src/java/org/apache/cassandra/tcm/ClusterMetadataService.java @@ -82,9 +82,9 @@ import static org.apache.cassandra.utils.Clock.Global.nanoTime; import static org.apache.cassandra.utils.Collectors3.toImmutableSet; /** - * the entry point to TCM. It is responsible for transforming cluster metadata consistently in the cluster. + * The entry point to TCM. It is responsible for transforming cluster metadata consistently in the cluster. * Transformation is performed by the current {@link Processor}. - * + * <p> * There are 3 processors availabe that are used depending on the node state: * <ul> * <li>gossip - the processor is used during upgrade</li> @@ -606,7 +606,7 @@ public class ClusterMetadataService } /** - * Fetches log entries from directly from CMS, at least to the specified epoch. + * Fetches log entries 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. @@ -796,7 +796,7 @@ public class ClusterMetadataService return commitsPaused.get(); } /** - * Switchable implementation that allow us to go between local and remote implementation whenever we need it. + * Switchable implementation that allows us to go between local and remote implementation whenever we need it. * When the node becomes a member of CMS, it switches back to being a regular member of a cluster, and all * the CMS handlers get disabled. */ diff --git a/src/java/org/apache/cassandra/tcm/Period.java b/src/java/org/apache/cassandra/tcm/Period.java index 03c07ded32..88743003bd 100644 --- a/src/java/org/apache/cassandra/tcm/Period.java +++ b/src/java/org/apache/cassandra/tcm/Period.java @@ -53,7 +53,7 @@ public class Period /** * Last resort fallback to find where in the log table (either local or distributed) we can find a - * given epoch. If the current ClusterMetadata.period > Period.FIRST (as should be the case normally), + * given epoch. If the current {@code ClusterMetadata.period} > {@code Period.FIRST} (as should be the case normally), * we start there and walk backwards through the log table. Otherwise, we walk forwards. * Note, this method is only used (and should only be used) as a last resort in case the local index of * max epoch to period (in system.metadata_sealed_periods) is not available. diff --git a/src/java/org/apache/cassandra/tcm/Processor.java b/src/java/org/apache/cassandra/tcm/Processor.java index e3f12852c2..61d8fd0736 100644 --- a/src/java/org/apache/cassandra/tcm/Processor.java +++ b/src/java/org/apache/cassandra/tcm/Processor.java @@ -53,7 +53,7 @@ public interface Processor * Fetches log from CMS up to the highest currently known epoch. * <p> * After fetching, all items _at least_ up to returned epoch will be visible. - * + * <p> * This method deliberately does not necessitate passing an epoch, since it guarantees catching up to the _latest_ * epoch. Users that require catching up to _at least_ some epoch need to guard this call with a check of whether * local epoch is already at that point. @@ -62,7 +62,7 @@ public interface Processor { return fetchLogAndWait(null); // wait for the highest possible epoch } -; + default ClusterMetadata fetchLogAndWait(Epoch waitFor) { return fetchLogAndWait(waitFor, diff --git a/src/java/org/apache/cassandra/tcm/RecentlySealedPeriods.java b/src/java/org/apache/cassandra/tcm/RecentlySealedPeriods.java index cca1d7a213..cd3f2a7d9e 100644 --- a/src/java/org/apache/cassandra/tcm/RecentlySealedPeriods.java +++ b/src/java/org/apache/cassandra/tcm/RecentlySealedPeriods.java @@ -102,7 +102,7 @@ public final class RecentlySealedPeriods * the max in a sealed period, we would start with the period following * that. If the target epoch is equal to or after the max in the latest * sealed period, assume that the period following that has yet to be sealed. - * @param epoch + * @param epoch the target epoch * @return */ public Sealed lookupPeriodForReplication(Epoch epoch) diff --git a/src/java/org/apache/cassandra/tcm/RemoteProcessor.java b/src/java/org/apache/cassandra/tcm/RemoteProcessor.java index 188c88820a..1da1572353 100644 --- a/src/java/org/apache/cassandra/tcm/RemoteProcessor.java +++ b/src/java/org/apache/cassandra/tcm/RemoteProcessor.java @@ -71,7 +71,6 @@ public final class RemoteProcessor implements Processor } @Override - @SuppressWarnings("resource") public Commit.Result commit(Entry.Id entryId, Transformation transform, Epoch lastKnown, Retry.Deadline retryPolicy) { // Replay everything in-flight before attempting a commit @@ -264,13 +263,11 @@ public final class RemoteProcessor implements Processor private final Deque<InetAddressAndPort> candidates; private final boolean checkLive; - @SuppressWarnings("resource") public CandidateIterator(Collection<InetAddressAndPort> initialContacts) { this(initialContacts, true); } - @SuppressWarnings("resource") public CandidateIterator(Collection<InetAddressAndPort> initialContacts, boolean checkLive) { this.candidates = new ConcurrentLinkedDeque<>(initialContacts); diff --git a/src/java/org/apache/cassandra/tcm/Retry.java b/src/java/org/apache/cassandra/tcm/Retry.java index 33b04fa372..9900568a7a 100644 --- a/src/java/org/apache/cassandra/tcm/Retry.java +++ b/src/java/org/apache/cassandra/tcm/Retry.java @@ -66,9 +66,9 @@ public abstract class Retry } /** - * Determines whether the retry strategy has reached the maximum retry attempts or has surpassed the deadline. + * Determines whether the retry strategy has reached the maximum retry attempts. * - * @return {@code true} if the maximum retry attempts are reached or the deadline has been surpassed; {@code false} otherwise. + * @return {@code true} if the maximum retry attempts are reached; {@code false} otherwise. */ public boolean reachedMax() { @@ -244,6 +244,11 @@ public abstract class Retry }; } + /** + * Determines whether the retry strategy has reached the maximum retry attempts or has surpassed the deadline. + * + * @return {@code true} if the maximum retry attempts are reached or the deadline has been surpassed; {@code false} otherwise. + */ @Override public boolean reachedMax() { diff --git a/src/java/org/apache/cassandra/tcm/listeners/LogListener.java b/src/java/org/apache/cassandra/tcm/listeners/LogListener.java index 0b172d613c..0b7457d1ee 100644 --- a/src/java/org/apache/cassandra/tcm/listeners/LogListener.java +++ b/src/java/org/apache/cassandra/tcm/listeners/LogListener.java @@ -23,7 +23,7 @@ import org.apache.cassandra.tcm.log.Entry; /** * Invoked each time the log is updated - * + * <p> * Not guaranteed to see all transformations */ public interface LogListener diff --git a/src/java/org/apache/cassandra/tcm/listeners/MetadataSnapshotListener.java b/src/java/org/apache/cassandra/tcm/listeners/MetadataSnapshotListener.java index 3467cbf629..5fb2f6a868 100644 --- a/src/java/org/apache/cassandra/tcm/listeners/MetadataSnapshotListener.java +++ b/src/java/org/apache/cassandra/tcm/listeners/MetadataSnapshotListener.java @@ -28,7 +28,7 @@ import org.apache.cassandra.tcm.Transformation; import org.apache.cassandra.tcm.log.Entry; /** - * {@code LogListener} that store a snapshot of the cluster metadata when a period has been sealed. + * {@code LogListener} that stores a snapshot of the cluster metadata when a period has been sealed. * <p> * Snapshots can be used to make local startup quicker as the node doesn't have to replay all the history of the metadata log. * Likewise, when a node wants to catch up from a peer or the CMS, the responder may send the most recent snapshot + additional entries (i.e a Replication). diff --git a/src/java/org/apache/cassandra/tcm/log/LocalLog.java b/src/java/org/apache/cassandra/tcm/log/LocalLog.java index 8caf80df9a..cc62f3aecb 100644 --- a/src/java/org/apache/cassandra/tcm/log/LocalLog.java +++ b/src/java/org/apache/cassandra/tcm/log/LocalLog.java @@ -95,7 +95,7 @@ public abstract class LocalLog implements Closeable /** * Custom comparator for pending entries. In general, we would like entries in the pending set to be ordered by epoch, * from smallest to highest, so that `#first()` call would return the smallest entry. - * + * <p> * However, snapshots should be applied out of order, and snapshots with higher epoch should be applied before snapshots * with a lower epoch in cases when there are multiple snapshots present. */ @@ -312,12 +312,12 @@ public abstract class LocalLog implements Closeable /** * Called by implementations of {@link #processPending()}. - * + * <p> * Implementations have to guarantee there can be no more than one caller of {@link #processPendingInternal()} * at a time, as we are making calls to pre- and post- commit hooks. In other words, this method should be called * _exclusively_ from the implementation, outside of it there's no way to ensure mutual exclusion without * additional guards. - * + * <p> * Please note that we are using a custom comparator for pending entries, which ensures that FORCE_SNAPSHOT entries * are going to be prioritised over other entry kinds. After application of the snapshot entry, any entry with epoch * lower than the one that snapshot has enacted, are simply going to be dropped. The rest of entries (i.e. ones @@ -576,7 +576,6 @@ public abstract class LocalLog implements Closeable } } - @SuppressWarnings({ "unchecked", "rawtypes" }) class AsyncRunnable implements Interruptible.Task { private final AtomicReference<Condition> subscriber; diff --git a/src/java/org/apache/cassandra/tcm/log/LogStorage.java b/src/java/org/apache/cassandra/tcm/log/LogStorage.java index 6d3627b402..e00468a85c 100644 --- a/src/java/org/apache/cassandra/tcm/log/LogStorage.java +++ b/src/java/org/apache/cassandra/tcm/log/LogStorage.java @@ -24,7 +24,7 @@ public interface LogStorage extends LogReader { /** * Appends the log entry to the period - * @param period the period to which the log entry belong + * @param period the period to which the log entry belongs * @param entry the log entry */ void append(long period, Entry entry); @@ -35,7 +35,7 @@ public interface LogStorage extends LogReader /** * We are using system keyspace even on CMS nodes (at least for now) since otherwise it is tricky * to implement replay from the log, given the distributed metadata log table is created not - * during startup, but is initialized as a distributed table. We can, in theory, add an ability + * during startup, but it is initialized as a distributed table. We can, in theory, add an ability * to have distributed _system_ tables to avoid this duplication, but this doesn't seem to be * a priority now, especially given there's nothing that prevents us from truncating the log * table up to the last snapshot at any given time. diff --git a/src/java/org/apache/cassandra/tcm/membership/Directory.java b/src/java/org/apache/cassandra/tcm/membership/Directory.java index 254021f58d..df61f85ecc 100644 --- a/src/java/org/apache/cassandra/tcm/membership/Directory.java +++ b/src/java/org/apache/cassandra/tcm/membership/Directory.java @@ -680,7 +680,7 @@ public class Directory implements MetadataValue<Directory> /** * returns true if this directory is functionally equivalent to the given one - * + * <p> * does not check equality of lastModified */ @VisibleForTesting diff --git a/src/java/org/apache/cassandra/tcm/migration/Election.java b/src/java/org/apache/cassandra/tcm/migration/Election.java index 155cd509ff..4a8091f0d7 100644 --- a/src/java/org/apache/cassandra/tcm/migration/Election.java +++ b/src/java/org/apache/cassandra/tcm/migration/Election.java @@ -180,7 +180,7 @@ public class Election } /** - * Sends the specified message to specified nodes and wait for the responses. + * Sends the specified message to specified nodes and waits for the responses. * * @param messaging the messaging service to use to send the message to the different nodes * @param sendTo the nodes to which the message must be sent @@ -194,7 +194,7 @@ public class Election { Accumulator<Pair<InetAddressAndPort, RSP>> responses = new Accumulator<>(sendTo.size()); CountDownLatch cdl = CountDownLatch.newCountDownLatch(sendTo.size()); - RequestCallback<RSP> callback = new RequestCallbackWithFailure<RSP>() + RequestCallback<RSP> callback = new RequestCallbackWithFailure<>() { @Override public void onResponse(Message<RSP> msg) diff --git a/src/java/org/apache/cassandra/tcm/transformations/cms/FinishAddToCMS.java b/src/java/org/apache/cassandra/tcm/transformations/cms/FinishAddToCMS.java index 7477983bf6..e5709e73b1 100644 --- a/src/java/org/apache/cassandra/tcm/transformations/cms/FinishAddToCMS.java +++ b/src/java/org/apache/cassandra/tcm/transformations/cms/FinishAddToCMS.java @@ -35,7 +35,7 @@ import static org.apache.cassandra.tcm.transformations.cms.EntireRange.affectedR public class FinishAddToCMS extends BaseMembershipTransformation { - public static final AsymmetricMetadataSerializer<Transformation, FinishAddToCMS> serializer = new SerializerBase<FinishAddToCMS>() + public static final AsymmetricMetadataSerializer<Transformation, FinishAddToCMS> serializer = new SerializerBase<>() { public FinishAddToCMS createTransformation(InetAddressAndPort addr) { diff --git a/src/java/org/apache/cassandra/tcm/transformations/cms/Initialize.java b/src/java/org/apache/cassandra/tcm/transformations/cms/Initialize.java index 9241d59db3..0a21f0e4ff 100644 --- a/src/java/org/apache/cassandra/tcm/transformations/cms/Initialize.java +++ b/src/java/org/apache/cassandra/tcm/transformations/cms/Initialize.java @@ -37,21 +37,17 @@ import static org.apache.cassandra.tcm.transformations.cms.EntireRange.affectedR public class Initialize extends ForceSnapshot { - public static final AsymmetricMetadataSerializer<Transformation, Initialize> serializer = new AsymmetricMetadataSerializer<Transformation, Initialize>() - { - public void serialize(Transformation t, DataOutputPlus out, Version version) throws IOException - { + public static final AsymmetricMetadataSerializer<Transformation, Initialize> serializer = new AsymmetricMetadataSerializer<>() { + public void serialize(Transformation t, DataOutputPlus out, Version version) throws IOException { Initialize initialize = (Initialize) t; ClusterMetadata.serializer.serialize(initialize.baseState, out, version); } - public Initialize deserialize(DataInputPlus in, Version version) throws IOException - { + public Initialize deserialize(DataInputPlus in, Version version) throws IOException { return new Initialize(ClusterMetadata.serializer.deserialize(in, version)); } - public long serializedSize(Transformation t, Version version) - { + public long serializedSize(Transformation t, Version version) { Initialize initialize = (Initialize) t; return ClusterMetadata.serializer.serializedSize(initialize.baseState, version); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org