From 6b21fabb6a6272424a07c590c7845c61b1e45541 Mon Sep 17 00:00:00 2001 From: Tyler Jones Date: Wed, 13 Sep 2023 14:55:15 -0700 Subject: [PATCH] Iteration 2: Google format --- .../ingest/utils/ParameterProvider.java | 48 +++++-------------- .../internal/ParameterProviderTest.java | 2 +- 2 files changed, 13 insertions(+), 37 deletions(-) diff --git a/src/main/java/net/snowflake/ingest/utils/ParameterProvider.java b/src/main/java/net/snowflake/ingest/utils/ParameterProvider.java index c076d6d6d..0c33a84fc 100644 --- a/src/main/java/net/snowflake/ingest/utils/ParameterProvider.java +++ b/src/main/java/net/snowflake/ingest/utils/ParameterProvider.java @@ -166,9 +166,7 @@ private void setParameterMap(Map parameterOverrides, Properties MAX_CLIENT_LAG_ENABLED, MAX_CLIENT_LAG_ENABLED_DEFAULT, parameterOverrides, props); } - /** - * @return Longest interval in milliseconds between buffer flushes - */ + /** @return Longest interval in milliseconds between buffer flushes */ public long getBufferFlushIntervalInMs() { if (getMaxClientLagEnabled()) { if (cachedBufferFlushIntervalMs != -1L) { @@ -225,9 +223,7 @@ private boolean getMaxClientLagEnabled() { return (val instanceof Boolean) ? (Boolean) val : false; } - /** - * @return Time in milliseconds between checks to see if the buffer should be flushed - */ + /** @return Time in milliseconds between checks to see if the buffer should be flushed */ public long getBufferFlushCheckIntervalInMs() { Object val = this.parameterMap.getOrDefault( @@ -238,9 +234,7 @@ public long getBufferFlushCheckIntervalInMs() { return (long) val; } - /** - * @return Duration in milliseconds to delay data insertion to the buffer when throttled - */ + /** @return Duration in milliseconds to delay data insertion to the buffer when throttled */ public long getInsertThrottleIntervalInMs() { Object val = this.parameterMap.getOrDefault( @@ -251,9 +245,7 @@ public long getInsertThrottleIntervalInMs() { return (long) val; } - /** - * @return Percent of free total memory at which we throttle row inserts - */ + /** @return Percent of free total memory at which we throttle row inserts */ public int getInsertThrottleThresholdInPercentage() { Object val = this.parameterMap.getOrDefault( @@ -265,9 +257,7 @@ public int getInsertThrottleThresholdInPercentage() { return (int) val; } - /** - * @return Absolute size in bytes of free total memory at which we throttle row inserts - */ + /** @return Absolute size in bytes of free total memory at which we throttle row inserts */ public int getInsertThrottleThresholdInBytes() { Object val = this.parameterMap.getOrDefault( @@ -278,9 +268,7 @@ public int getInsertThrottleThresholdInBytes() { return (int) val; } - /** - * @return true if jmx metrics are enabled for a client - */ + /** @return true if jmx metrics are enabled for a client */ public boolean hasEnabledSnowpipeStreamingMetrics() { Object val = this.parameterMap.getOrDefault( @@ -291,9 +279,7 @@ public boolean hasEnabledSnowpipeStreamingMetrics() { return (boolean) val; } - /** - * @return Blob format version - */ + /** @return Blob format version */ public Constants.BdecVersion getBlobFormatVersion() { Object val = this.parameterMap.getOrDefault(BLOB_FORMAT_VERSION, BLOB_FORMAT_VERSION_DEFAULT); if (val instanceof Constants.BdecVersion) { @@ -322,9 +308,7 @@ public int getIOTimeCpuRatio() { return (int) val; } - /** - * @return the max retry count when waiting for a blob upload task to finish - */ + /** @return the max retry count when waiting for a blob upload task to finish */ public int getBlobUploadMaxRetryCount() { Object val = this.parameterMap.getOrDefault( @@ -335,9 +319,7 @@ public int getBlobUploadMaxRetryCount() { return (int) val; } - /** - * @return The max memory limit in bytes - */ + /** @return The max memory limit in bytes */ public long getMaxMemoryLimitInBytes() { Object val = this.parameterMap.getOrDefault( @@ -345,9 +327,7 @@ public long getMaxMemoryLimitInBytes() { return (val instanceof String) ? Long.parseLong(val.toString()) : (long) val; } - /** - * @return Return whether memory optimization for Parquet is enabled. - */ + /** @return Return whether memory optimization for Parquet is enabled. */ public boolean getEnableParquetInternalBuffering() { Object val = this.parameterMap.getOrDefault( @@ -355,9 +335,7 @@ public boolean getEnableParquetInternalBuffering() { return (val instanceof String) ? Boolean.parseBoolean(val.toString()) : (boolean) val; } - /** - * @return The max channel size in bytes - */ + /** @return The max channel size in bytes */ public long getMaxChannelSizeInBytes() { Object val = this.parameterMap.getOrDefault( @@ -365,9 +343,7 @@ public long getMaxChannelSizeInBytes() { return (val instanceof String) ? Long.parseLong(val.toString()) : (long) val; } - /** - * @return The max chunk size in bytes that could avoid OOM at server side - */ + /** @return The max chunk size in bytes that could avoid OOM at server side */ public long getMaxChunkSizeInBytes() { Object val = this.parameterMap.getOrDefault(MAX_CHUNK_SIZE_IN_BYTES, MAX_CHUNK_SIZE_IN_BYTES_DEFAULT); diff --git a/src/test/java/net/snowflake/ingest/streaming/internal/ParameterProviderTest.java b/src/test/java/net/snowflake/ingest/streaming/internal/ParameterProviderTest.java index 5062275ad..4e5ed12f2 100644 --- a/src/test/java/net/snowflake/ingest/streaming/internal/ParameterProviderTest.java +++ b/src/test/java/net/snowflake/ingest/streaming/internal/ParameterProviderTest.java @@ -5,7 +5,6 @@ import java.util.Properties; import net.snowflake.ingest.utils.ParameterProvider; import org.junit.Assert; -import org.junit.Before; import org.junit.Test; public class ParameterProviderTest { @@ -154,6 +153,7 @@ public void testMaxClientLagEnabledPluralTimeUnit() { ParameterProvider parameterProvider = new ParameterProvider(parameterMap, prop); Assert.assertEquals(2000, parameterProvider.getBufferFlushIntervalInMs()); } + @Test public void testMaxClientLagEnabledMinuteTimeUnit() { Properties prop = new Properties();