Skip to content

Commit a75d999

Browse files
SK-2274 warning log when user provide limits
1 parent 86e7c6e commit a75d999

6 files changed

Lines changed: 24 additions & 5 deletions

File tree

common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</parent>
1212

1313
<artifactId>common</artifactId>
14-
<version>1.0.0</version>
14+
<version>1.0.1</version>
1515
<name>${project.groupId}:${project.artifactId}</name>
1616

1717

common/src/main/java/com/skyflow/logs/InfoLogs.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ public enum InfoLogs {
9292
VALIDATE_GET_DETECT_RUN_REQUEST("Validating get detect run request."),
9393
REIDENTIFY_TEXT_SUCCESS("Text data re-identified."),
9494

95-
PROCESSING_BATCHES("Processing batch")
95+
PROCESSING_BATCHES("Processing batch"),
96+
SET_CONCURRENCY_LIMIT("Setting concurrency limit to %s1"),
97+
SET_BATCH_SIZE("Setting batch size to %s1"),
9698
;
9799

98100

common/src/main/java/com/skyflow/logs/WarningLogs.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
public enum WarningLogs {
44
INVALID_BATCH_SIZE_PROVIDED("Invalid value for batch size provided, switching to default value."),
55
INVALID_CONCURRENCY_LIMIT_PROVIDED("Invalid value for concurrency limit provided, switching to default value."),
6+
BATCH_SIZE_EXCEEDS_MAX_LIMIT("Provided batch size exceeds the maximum limit, switching to max limit."),
7+
CONCURRENCY_EXCEEDS_MAX_LIMIT("Provided concurrency limit exceeds the maximum limit, switching to max limit.")
68
;
79

810
private final String log;

v2/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<dependency>
2525
<groupId>com.skyflow</groupId>
2626
<artifactId>common</artifactId>
27-
<version>1.0.0</version>
27+
<version>1.0.1</version>
2828
</dependency>
2929

3030
</dependencies>

v3/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<dependency>
4444
<groupId>com.skyflow</groupId>
4545
<artifactId>common</artifactId>
46-
<version>1.0.0</version>
46+
<version>1.0.1</version>
4747
</dependency>
4848
</dependencies>
4949

v3/src/main/java/com/skyflow/vault/controller/VaultController.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,12 @@ private void configureInsertConcurrencyAndBatchSize(int totalRequests) {
306306
if (userProvidedBatchSize != null) {
307307
try {
308308
int batchSize = Integer.parseInt(userProvidedBatchSize);
309+
if (batchSize > Constants.MAX_DETOKENIZE_BATCH_SIZE) {
310+
LogUtil.printWarningLog(WarningLogs.BATCH_SIZE_EXCEEDS_MAX_LIMIT.getLog());
311+
}
309312
int maxBatchSize = Math.min(batchSize, Constants.MAX_INSERT_BATCH_SIZE);
310313
if (maxBatchSize > 0) {
314+
// LogUtil.printInfoLog(InfoLogs.SET_BATCH_SIZE.getLog() + maxBatchSize);
311315
this.insertBatchSize = maxBatchSize;
312316
} else {
313317
LogUtil.printWarningLog(WarningLogs.INVALID_BATCH_SIZE_PROVIDED.getLog());
@@ -326,8 +330,11 @@ private void configureInsertConcurrencyAndBatchSize(int totalRequests) {
326330
try {
327331
int concurrencyLimit = Integer.parseInt(userProvidedConcurrencyLimit);
328332
int maxConcurrencyLimit = Math.min(concurrencyLimit, Constants.MAX_INSERT_CONCURRENCY_LIMIT);
329-
333+
if (concurrencyLimit > Constants.MAX_DETOKENIZE_CONCURRENCY_LIMIT) {
334+
LogUtil.printWarningLog(WarningLogs.CONCURRENCY_EXCEEDS_MAX_LIMIT.getLog());
335+
}
330336
if (maxConcurrencyLimit > 0) {
337+
// LogUtil.printInfoLog(InfoLogs.SET_CONCURRENCY_LIMIT.getLog() + maxConcurrencyLimit);
331338
this.insertConcurrencyLimit = Math.min(maxConcurrencyLimit, maxConcurrencyNeeded);
332339
} else {
333340
LogUtil.printWarningLog(WarningLogs.INVALID_CONCURRENCY_LIMIT_PROVIDED.getLog());
@@ -357,8 +364,12 @@ private void configureDetokenizeConcurrencyAndBatchSize(int totalRequests) {
357364
if (userProvidedBatchSize != null) {
358365
try {
359366
int batchSize = Integer.parseInt(userProvidedBatchSize);
367+
if (batchSize > Constants.MAX_DETOKENIZE_BATCH_SIZE) {
368+
LogUtil.printWarningLog(WarningLogs.BATCH_SIZE_EXCEEDS_MAX_LIMIT.getLog());
369+
}
360370
int maxBatchSize = Math.min(batchSize, Constants.MAX_DETOKENIZE_BATCH_SIZE);
361371
if (maxBatchSize > 0) {
372+
// LogUtil.printInfoLog(InfoLogs.SET_BATCH_SIZE.getLog() + maxBatchSize);
362373
this.detokenizeBatchSize = maxBatchSize;
363374
} else {
364375
LogUtil.printWarningLog(WarningLogs.INVALID_BATCH_SIZE_PROVIDED.getLog());
@@ -376,9 +387,13 @@ private void configureDetokenizeConcurrencyAndBatchSize(int totalRequests) {
376387
if (userProvidedConcurrencyLimit != null) {
377388
try {
378389
int concurrencyLimit = Integer.parseInt(userProvidedConcurrencyLimit);
390+
if (concurrencyLimit > Constants.MAX_DETOKENIZE_CONCURRENCY_LIMIT) {
391+
LogUtil.printWarningLog(WarningLogs.CONCURRENCY_EXCEEDS_MAX_LIMIT.getLog());
392+
}
379393
int maxConcurrencyLimit = Math.min(concurrencyLimit, Constants.MAX_DETOKENIZE_CONCURRENCY_LIMIT);
380394

381395
if (maxConcurrencyLimit > 0) {
396+
// LogUtil.printInfoLog(InfoLogs.SET_CONCURRENCY_LIMIT.getLog() + maxConcurrencyLimit);
382397
this.detokenizeConcurrencyLimit = Math.min(maxConcurrencyLimit, maxConcurrencyNeeded);
383398
} else {
384399
LogUtil.printWarningLog(WarningLogs.INVALID_CONCURRENCY_LIMIT_PROVIDED.getLog());

0 commit comments

Comments
 (0)