frankgh commented on code in PR #147:
URL:
https://github.com/apache/cassandra-analytics/pull/147#discussion_r2482409494
##########
cassandra-analytics-cdc-sidecar/src/main/java/org/apache/cassandra/cdc/sidecar/SidecarCdcClient.java:
##########
@@ -150,4 +167,225 @@ public String hostname()
}
};
}
+
+ public static final class ClientConfig
+ {
+ public static final String SIDECAR_PORT = "sidecar_port";
+ public static final String MAX_RETRIES_KEY = "maxRetries";
+ public static final String DEFAULT_MILLIS_TO_SLEEP_KEY =
"defaultMillisToSleep";
+ public static final String MAX_MILLIS_TO_SLEEP_KEY =
"maxMillisToSleep";
Review Comment:
no longer needed
```suggestion
```
##########
cassandra-analytics-cdc-sidecar/src/main/java/org/apache/cassandra/cdc/sidecar/SidecarCdcClient.java:
##########
@@ -150,4 +167,225 @@ public String hostname()
}
};
}
+
+ public static final class ClientConfig
+ {
+ public static final String SIDECAR_PORT = "sidecar_port";
+ public static final String MAX_RETRIES_KEY = "maxRetries";
+ public static final String DEFAULT_MILLIS_TO_SLEEP_KEY =
"defaultMillisToSleep";
+ public static final String MAX_MILLIS_TO_SLEEP_KEY =
"maxMillisToSleep";
+ public static final String MAX_BUFFER_SIZE_BYTES_KEY =
"maxBufferSizeBytes";
+ public static final String CHUNK_BUFFER_SIZE_BYTES_KEY =
"chunkBufferSizeBytes";
+ public static final String MAX_POOL_SIZE_KEY = "maxPoolSize";
+ public static final String TIMEOUT_SECONDS_KEY = "timeoutSeconds";
+ public static final String CASSANDRA_ROLE_KEY = "cassandra_role";
+ public static final String DEFAULT_CASSANDRA_ROLE = null;
+
+ private final int userProvidedPort;
+ private final int maxRetries;
+ private final int maxPoolSize;
+ private final int timeoutSeconds;
+ private final long millisToSleep;
+ private final long maxMillisToSleep;
+ private final long maxBufferSize;
+ private final long chunkSize;
+ private final String cassandraRole;
+ private final Map<FileType, Long> maxBufferOverride;
+ private final Map<FileType, Long> chunkBufferOverride;
+
+ // CHECKSTYLE IGNORE: Constructor with many parameters
+ private ClientConfig(int userProvidedPort,
+ int maxRetries,
+ long millisToSleep,
+ long maxMillisToSleep,
+ long maxBufferSize,
+ long chunkSize,
+ int maxPoolSize,
+ int timeoutSeconds,
+ String cassandraRole,
+ Map<FileType, Long> maxBufferOverride,
+ Map<FileType, Long> chunkBufferOverride)
+ {
+ this.userProvidedPort = userProvidedPort;
+ this.maxRetries = maxRetries;
+ this.millisToSleep = millisToSleep;
+ this.maxMillisToSleep = maxMillisToSleep;
+ this.maxBufferSize = maxBufferSize;
+ this.chunkSize = chunkSize;
+ this.maxPoolSize = maxPoolSize;
+ this.timeoutSeconds = timeoutSeconds;
+ this.cassandraRole = cassandraRole;
+ this.maxBufferOverride = maxBufferOverride;
+ this.chunkBufferOverride = chunkBufferOverride;
+ }
+
+ public int userProvidedPort()
+ {
+ return userProvidedPort;
+ }
+
+ public int effectivePort()
+ {
+ return userProvidedPort == -1 ? DEFAULT_SIDECAR_PORT :
userProvidedPort;
+ }
+
+ public int maxRetries()
+ {
+ return maxRetries;
+ }
+
+ public long millisToSleep()
+ {
+ return millisToSleep;
+ }
+
+ public long maxMillisToSleep()
+ {
+ return maxMillisToSleep;
+ }
+
+ public long maxBufferSize()
+ {
+ return maxBufferSize(FileType.COMMITLOG);
+ }
+
+ public long maxBufferSize(FileType fileType)
+ {
+ return maxBufferOverride.getOrDefault(fileType, maxBufferSize);
+ }
+
+ public Map<FileType, Long> maxBufferOverride()
+ {
+ return maxBufferOverride;
+ }
+
+ public long chunkBufferSize()
+ {
+ return chunkBufferSize(FileType.COMMITLOG);
+ }
+
+ public long chunkBufferSize(FileType fileType)
+ {
+ return chunkBufferOverride.getOrDefault(fileType, chunkSize);
+ }
+
+ public Map<FileType, Long> chunkBufferOverride()
+ {
+ return chunkBufferOverride;
+ }
+
+ public int maxPoolSize()
+ {
+ return maxPoolSize;
+ }
+
+ public int timeoutSeconds()
+ {
+ return timeoutSeconds;
+ }
+
+ @Nullable
+ public String cassandraRole()
+ {
+ return cassandraRole;
+ }
+
+ public static ClientConfig create()
+ {
+ return ClientConfig.create(-1, DEFAULT_MAX_RETRIES,
DEFAULT_MILLIS_TO_SLEEP);
+ }
+
+ public static ClientConfig create(int userProvidedPort, int
effectivePort)
+ {
+ return ClientConfig.create(userProvidedPort, DEFAULT_MAX_RETRIES,
DEFAULT_MILLIS_TO_SLEEP);
+ }
+
+ public static ClientConfig create(int userProvidedPort, int
maxRetries, long millisToSleep)
+ {
+ Map<FileType, Long> chunkOverride = new HashMap<>();
+ chunkOverride.put(FileType.COMMITLOG, 4 * 1024 * 1024L); // 4MB
chunks
+
+ Map<FileType, Long> maxBufferOverride = new HashMap<>();
+ maxBufferOverride.put(FileType.COMMITLOG, 8 * 1024 * 1024L);
Review Comment:
this is unused, is that on purpose, or are we missing something here?
##########
cassandra-analytics-cdc-sidecar/src/main/java/org/apache/cassandra/cdc/sidecar/SidecarCdcClient.java:
##########
@@ -150,4 +167,225 @@ public String hostname()
}
};
}
+
+ public static final class ClientConfig
+ {
+ public static final String SIDECAR_PORT = "sidecar_port";
+ public static final String MAX_RETRIES_KEY = "maxRetries";
+ public static final String DEFAULT_MILLIS_TO_SLEEP_KEY =
"defaultMillisToSleep";
+ public static final String MAX_MILLIS_TO_SLEEP_KEY =
"maxMillisToSleep";
+ public static final String MAX_BUFFER_SIZE_BYTES_KEY =
"maxBufferSizeBytes";
+ public static final String CHUNK_BUFFER_SIZE_BYTES_KEY =
"chunkBufferSizeBytes";
+ public static final String MAX_POOL_SIZE_KEY = "maxPoolSize";
+ public static final String TIMEOUT_SECONDS_KEY = "timeoutSeconds";
+ public static final String CASSANDRA_ROLE_KEY = "cassandra_role";
Review Comment:
No longer needed
```suggestion
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]