From 41a534989a288f7fc3a234aa23d99bf03a9bf455 Mon Sep 17 00:00:00 2001 From: absurdfarce Date: Mon, 8 Dec 2025 17:33:46 -0600 Subject: [PATCH] Set config properties that are exposed via setters early in the process to avoid any order-of-operations problems. --- .../workflow/commons/settings/SchemaSettings.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/workflow/commons/src/main/java/com/datastax/oss/dsbulk/workflow/commons/settings/SchemaSettings.java b/workflow/commons/src/main/java/com/datastax/oss/dsbulk/workflow/commons/settings/SchemaSettings.java index ff47fe7e4..7717a420b 100644 --- a/workflow/commons/src/main/java/com/datastax/oss/dsbulk/workflow/commons/settings/SchemaSettings.java +++ b/workflow/commons/src/main/java/com/datastax/oss/dsbulk/workflow/commons/settings/SchemaSettings.java @@ -176,6 +176,16 @@ public class SchemaSettings { public SchemaSettings(Config config, SchemaGenerationStrategy schemaGenerationStrategy) { this.config = config; this.schemaGenerationStrategy = schemaGenerationStrategy; + + /* Issue 502 + * + * We set these two values early because (a) they're entirely driven by settings in the HOCON config and + * (b) they're exposed via accessor methods below (isAllowExtraFields and isAllowMissingFields). To avoid + * any order-of-operations issues in which a SchemaSettings instance may have been created (but not yet + * initialized) and these values are accessed we set them as early as possible here. + */ + allowExtraFields = config.getBoolean(ALLOW_EXTRA_FIELDS); + allowMissingFields = config.getBoolean(ALLOW_MISSING_FIELDS); } public void init( @@ -470,8 +480,6 @@ public void init( // Misc nullToUnset = config.getBoolean(NULL_TO_UNSET); - allowExtraFields = config.getBoolean(ALLOW_EXTRA_FIELDS); - allowMissingFields = config.getBoolean(ALLOW_MISSING_FIELDS); splits = ConfigUtils.getThreads(config, SPLITS); // Final checks related to graph operations