Skip to content

Commit 1ba4a42

Browse files
chore: centralize default chunk size and update value to 1000 across migration options
1 parent d17ea76 commit 1ba4a42

3 files changed

Lines changed: 24 additions & 8 deletions

File tree

extensions/saas/sources/migration/src/main/java/tools/dynamia/modules/saas/migration/api/AccountCloneOptions.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@
1919
*/
2020
public class AccountCloneOptions {
2121

22-
/** ID of the account to clone data from. Required. */
22+
/**
23+
* ID of the account to clone data from. Required.
24+
*/
2325
private Serializable sourceAccountId;
2426

25-
/** ID of the (already existing) target account. Required. */
27+
/**
28+
* ID of the (already existing) target account. Required.
29+
*/
2630
private Serializable targetAccountId;
2731

2832
/**
@@ -32,8 +36,10 @@ public class AccountCloneOptions {
3236
*/
3337
private IdentityStrategy identityStrategy = IdentityStrategy.REGENERATE_IDS;
3438

35-
/** Records per page during export/import. Default: 500. */
36-
private int chunkSize = 5000;
39+
/**
40+
* Records per page during export/import. Default: 500.
41+
*/
42+
private int chunkSize = AccountExportOptions.DEFAULT_CHUNK_SIZE;
3743

3844
/**
3945
* When {@code true}, entity errors are fatal. When {@code false}, they are
@@ -90,6 +96,9 @@ public void setIdentityStrategy(IdentityStrategy identityStrategy) {
9096
}
9197

9298
public int getChunkSize() {
99+
if (chunkSize <= 0) {
100+
chunkSize = AccountExportOptions.DEFAULT_CHUNK_SIZE;
101+
}
93102
return chunkSize;
94103
}
95104

extensions/saas/sources/migration/src/main/java/tools/dynamia/modules/saas/migration/api/AccountExportOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
public class AccountExportOptions {
2121

22-
public static final int DEFAULT_CHUNK_SIZE = 5000;
22+
public static final int DEFAULT_CHUNK_SIZE = 1000;
2323

2424
/**
2525
* Number of records to read from DB per pagination page. Default: 5000.

extensions/saas/sources/migration/src/main/java/tools/dynamia/modules/saas/migration/api/AccountImportOptions.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,15 @@ public class AccountImportOptions {
2626
*/
2727
private Serializable targetAccountId;
2828

29-
/** How to handle primary keys when persisting imported entities. */
29+
/**
30+
* How to handle primary keys when persisting imported entities.
31+
*/
3032
private IdentityStrategy identityStrategy = IdentityStrategy.REGENERATE_IDS;
3133

32-
/** Number of entities to persist per transaction batch. Default: 500. */
33-
private int chunkSize = 500;
34+
/**
35+
* Number of entities to persist per transaction batch. Default: 500.
36+
*/
37+
private int chunkSize = AccountExportOptions.DEFAULT_CHUNK_SIZE;
3438

3539
/**
3640
* When {@code true}, the import fails immediately if any entity cannot be
@@ -79,6 +83,9 @@ public void setIdentityStrategy(IdentityStrategy identityStrategy) {
7983
}
8084

8185
public int getChunkSize() {
86+
if (chunkSize <= 0) {
87+
chunkSize = AccountExportOptions.DEFAULT_CHUNK_SIZE;
88+
}
8289
return chunkSize;
8390
}
8491

0 commit comments

Comments
 (0)