This is an automated email from the ASF dual-hosted git repository.
edimitrova pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/trunk by this push:
new bc40d3bb27 Fix RequestFailureReason constants codes patch by Ekaterina
Dimitrova; reviewed by Caleb Rackliffe and Stefan Miklosovic for
CASSANDRA-20126
bc40d3bb27 is described below
commit bc40d3bb27cac7979867def92fe84e5fa5011155
Author: Ekaterina Dimitrova <[email protected]>
AuthorDate: Wed Dec 4 15:46:30 2024 -0500
Fix RequestFailureReason constants codes
patch by Ekaterina Dimitrova; reviewed by Caleb Rackliffe and Stefan
Miklosovic for CASSANDRA-20126
---
CHANGES.txt | 1 +
.../cassandra/exceptions/RequestFailureReason.java | 8 +--
.../exceptions/RequestFailureReasonTest.java | 57 ++++++++++++++++++++++
3 files changed, 62 insertions(+), 4 deletions(-)
diff --git a/CHANGES.txt b/CHANGES.txt
index af48dfb1d3..08ff72184a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
5.1
+ * Fix RequestFailureReason constants codes (CASSANDRA-20126)
* Introduce SSTableSimpleScanner for compaction (CASSANDRA-20092)
* Include column drop timestamp in alter table transformation
(CASSANDRA-18961)
* Make JMX SSL configurable in cassandra.yaml (CASSANDRA-18508)
diff --git a/src/java/org/apache/cassandra/exceptions/RequestFailureReason.java
b/src/java/org/apache/cassandra/exceptions/RequestFailureReason.java
index 041aa5e9a3..1bc86ff061 100644
--- a/src/java/org/apache/cassandra/exceptions/RequestFailureReason.java
+++ b/src/java/org/apache/cassandra/exceptions/RequestFailureReason.java
@@ -38,10 +38,10 @@ public enum RequestFailureReason
READ_SIZE (4),
NODE_DOWN (5),
INDEX_NOT_AVAILABLE (6),
- NOT_CMS (7),
- INVALID_ROUTING (8),
- COORDINATOR_BEHIND (9),
- READ_TOO_MANY_INDEXES (10),
+ READ_TOO_MANY_INDEXES (7),
+ NOT_CMS (8),
+ INVALID_ROUTING (9),
+ COORDINATOR_BEHIND (10),
;
public static final Serializer serializer = new Serializer();
diff --git
a/test/unit/org/apache/cassandra/exceptions/RequestFailureReasonTest.java
b/test/unit/org/apache/cassandra/exceptions/RequestFailureReasonTest.java
new file mode 100644
index 0000000000..b2fdcd365d
--- /dev/null
+++ b/test/unit/org/apache/cassandra/exceptions/RequestFailureReasonTest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.exceptions;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class RequestFailureReasonTest
+{
+ private static final RequestFailureReason[] REASONS =
RequestFailureReason.values();
+ private static final Object[][] EXPECTED_VALUES =
+ {
+ { 0, "UNKNOWN" },
+ { 1, "READ_TOO_MANY_TOMBSTONES" },
+ { 2, "TIMEOUT" },
+ { 3, "INCOMPATIBLE_SCHEMA" },
+ { 4, "READ_SIZE" },
+ { 5, "NODE_DOWN" },
+ { 6, "INDEX_NOT_AVAILABLE" },
+ { 7, "READ_TOO_MANY_INDEXES" },
+ { 8, "NOT_CMS" },
+ { 9, "INVALID_ROUTING" },
+ { 10, "COORDINATOR_BEHIND" }
+ };
+
+ @Test
+ public void testEnumCodesAndNames()
+ {
+ for (int i = 0; i < REASONS.length; i++)
+ {
+ assertEquals("RequestFailureReason code mismatch for " +
+ REASONS[i].name(), EXPECTED_VALUES[i][0],
REASONS[i].code);
+ assertEquals("RequestFailureReason name mismatch for code " +
+ REASONS[i].code, EXPECTED_VALUES[i][1],
REASONS[i].name());
+ }
+
+ assertEquals("Number of RequestFailureReason enum constants has
changed. Update the test.",
+ EXPECTED_VALUES.length, REASONS.length);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]