Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ limitations under the License.

ZooKeeper has both namespace and bytes quotas. You can use the ZooKeeperMain class to set up quotas.
This fork backports the native quota enforcement released in Apache ZooKeeper 3.8.7
(ZOOKEEPER-3301 and ZOOKEEPER-4219). Per-namespace quota metrics
(ZOOKEEPER-3301, ZOOKEEPER-4219, and ZOOKEEPER-4377). Per-namespace quota metrics
(ZOOKEEPER-4211) are not included.
Soft limits produce warnings; hard limits reject writes with `QuotaExceededException`.
Both checks require the startup JVM property `-Dzookeeper.enforceQuota=true`, which defaults to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public static KeeperException create(Code code) {
return new TotalEphemeralLimitExceeded();
case OK:
default:
throw new IllegalArgumentException("Invalid exception code");
throw new IllegalArgumentException("Invalid exception code:" + code.code);
}
}

Expand Down Expand Up @@ -439,10 +439,15 @@ public int intValue() {
/**
* Get the Code value for a particular integer error code
* @param code int error code
* @return Code value corresponding to specified int code, or null
* @return Code value corresponding to specified int code
* @throws IllegalArgumentException if the client does not recognize the code
*/
public static Code get(int code) {
return lookup.get(code);
Code codeVal = lookup.get(code);
if (codeVal == null) {
throw new IllegalArgumentException("The current client version cannot lookup this code:" + code);
}
return codeVal;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.apache.zookeeper.cli.CliWrapperException;
import org.junit.Test;

Expand All @@ -39,4 +40,14 @@ public void testEphemeralErrorDecoding() {
assertTrue(error instanceof KeeperException.TotalEphemeralLimitExceeded);
assertEquals("/session", error.getPath());
}

@Test
public void testUnknownWireErrorIsExplicit() {
try {
KeeperException.create(KeeperException.Code.get(Integer.MIN_VALUE), "/unknown");
fail("An unknown wire error must be reported explicitly");
} catch (IllegalArgumentException expected) {
assertTrue(expected.getMessage().contains(Integer.toString(Integer.MIN_VALUE)));
}
}
}
Loading