Record Class BulkLoadStrategy
- Record Components:
mode- the ordering moderevalidate- whetherDatabaseSupport.enableConstraints(Connection, Database, BulkLoadHandle)should re-validate existing rows when re-enabling enforcement (only meaningful for vendor mechanisms that can do so; the session-based PostgreSQL/MySQL mechanisms cannot and ignore it)
DatabaseFiller orders table fills relative to foreign-key dependencies.
By default (ordered()) the fill engine respects the foreign-key dependency graph:
a child table is never filled before its parent. On the parallel path this means filling one
topological level at a time with a barrier between levels, which serializes deep, narrow
dependency chains (e.g. TPC-C's warehouse → district → customer → open_order → order_line).
unorderedBulk() trades that ordering for speed on chained schemas. Bloviate's generated
data is referentially consistent by construction — a foreign-key column's generator is
seeded from the referenced primary-key column's seed, so child and parent produce identical key
values regardless of insert order (see
DatabaseUtils.columnSeed(Column, long)). That makes it safe to disable
foreign-key enforcement for the duration of the fill, insert all tables concurrently with
no topological barrier, then re-enable enforcement. For the same seed, the resulting row content is
identical to an ordered fill across every deterministic column — physical (on-disk) row order may
differ, and columns whose generator is non-deterministic (e.g. wall-clock temporal values, or a
custom plugin that reads external state) are reproducible only to the extent that generator is.
Bulk mode only takes effect on the parallel path (a DataSource with
DatabaseFiller.Builder.threads(int) > 1) and only when the active
DatabaseSupport reports DatabaseSupport.supportsBulkLoad(). Otherwise the engine
logs a warning and uses the ordered path. PostgreSQL and MySQL support it; CockroachDB does not and
falls back.
- Since:
- 2.17.0
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionBulkLoadStrategy(BulkLoadStrategy.Mode mode, boolean revalidate) Validates the mode. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanWhether this strategy isBulkLoadStrategy.Mode.UNORDERED_BULK.mode()Returns the value of themoderecord component.static BulkLoadStrategyordered()The back-compatible default: fill in foreign-key dependency order, never disabling constraints.booleanReturns the value of therevalidaterecord component.final StringtoString()Returns a string representation of this record class.static BulkLoadStrategyDisable foreign-key enforcement, fill every table concurrently with no topological barrier, then re-enable enforcement without re-validating (safe because the data is consistent by construction).
-
Constructor Details
-
BulkLoadStrategy
Validates the mode.- Throws:
IllegalArgumentException- ifmodeis null
-
-
Method Details
-
ordered
The back-compatible default: fill in foreign-key dependency order, never disabling constraints.- Returns:
- an
BulkLoadStrategy.Mode.ORDEREDstrategy
-
unorderedBulk
Disable foreign-key enforcement, fill every table concurrently with no topological barrier, then re-enable enforcement without re-validating (safe because the data is consistent by construction).- Returns:
- an
BulkLoadStrategy.Mode.UNORDERED_BULKstrategy
-
isUnordered
public boolean isUnordered()Whether this strategy isBulkLoadStrategy.Mode.UNORDERED_BULK.- Returns:
truefor unordered bulk loading
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
mode
-
revalidate
public boolean revalidate()Returns the value of therevalidaterecord component.- Returns:
- the value of the
revalidaterecord component
-