diff options
author | Harald Musum <musum@yahooinc.com> | 2022-02-17 13:02:08 +0100 |
---|---|---|
committer | Harald Musum <musum@yahooinc.com> | 2022-02-17 13:02:08 +0100 |
commit | e0fa3f37de4edc8ebd2cf6e303198a0995f7ae3a (patch) | |
tree | 293377278e884d3eac81b2f20f363d5412176ca6 /zkfacade | |
parent | 29860079406de9843751214da61ddcc4c5d687f5 (diff) |
Fail writing data if number of bytes exceeds juteMaxBuffer
Diffstat (limited to 'zkfacade')
-rw-r--r-- | zkfacade/src/main/java/com/yahoo/vespa/curator/Curator.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/zkfacade/src/main/java/com/yahoo/vespa/curator/Curator.java b/zkfacade/src/main/java/com/yahoo/vespa/curator/Curator.java index 82d114ae540..f96e46d90d8 100644 --- a/zkfacade/src/main/java/com/yahoo/vespa/curator/Curator.java +++ b/zkfacade/src/main/java/com/yahoo/vespa/curator/Curator.java @@ -61,8 +61,7 @@ public class Curator implements VespaCurator, AutoCloseable { private static final Duration BASE_SLEEP_TIME = Duration.ofSeconds(1); private static final int MAX_RETRIES = 10; private static final RetryPolicy DEFAULT_RETRY_POLICY = new ExponentialBackoffRetry((int) BASE_SLEEP_TIME.toMillis(), MAX_RETRIES); - - protected final RetryPolicy retryPolicy = DEFAULT_RETRY_POLICY; + private static final long juteMaxBuffer = 52428800; // Should correspond with value in ZookeeperServerConfig private final CuratorFramework curatorFramework; private final ConnectionSpec connectionSpec; @@ -183,6 +182,10 @@ public class Curator implements VespaCurator, AutoCloseable { */ // TODO: Use create().orSetData() in Curator 4 and later public void set(Path path, byte[] data) { + if (data.length > juteMaxBuffer) + throw new IllegalArgumentException("Cannot not set data at " + path.getAbsolute() + ", " + + data.length + " bytes, max bytes is " + juteMaxBuffer); + if ( ! exists(path)) create(path); |