Skip to content

Validate database, Pipe, and Topic configuration - #19428

Draft
Caideyipi wants to merge 13 commits into
apache:masterfrom
Caideyipi:config-validation-fallbacks
Draft

Caideyipi wants to merge 13 commits into
apache:masterfrom
Caideyipi:config-validation-fallbacks

Conversation

@Caideyipi

Copy link
Copy Markdown
Collaborator

Summary

  • Validate database configuration values with warnings and default fallbacks.
  • Reject invalid Pipe and Topic parameters and report unknown keys without applying them.
  • Validate configuration on startup, reload, and cross-node parameter paths.
  • Preserve existing handling for unrelated configuration keys.

Example

For the aggregate processor, processor.output.max-delay-seconds=-1 remains the supported unlimited value, while -2 is rejected. Invalid database values fall back to the configured default with a warning.

Testing

  • spotless:apply -P with-integration-tests -pl iotdb-core/node-commons,iotdb-core/confignode,iotdb-core/datanode passed.
  • Focused module tests passed: 82 tests, 0 failures, 0 errors, 0 skipped.

if (reduced == null) {
return null;
}
switch (plugin) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/config/PipeParameterDefinitions.java:190 — Consensus-v2 connector attributes rejected: IOT_CONSENSUS_V2_ASYNC_CONNECTOR falls through to IOTDB_SINK

sinkDefinitions() has no case for IOT_CONSENSUS_V2_ASYNC_CONNECTOR/PIPE_CONSENSUS_ASYNC_CONNECTOR, so it returns IOTDB_SINK.get(reduced). RegionMaintainHandler.buildConsensusPipeReq sets connector.consensus.pipe-name, which is absent from iotdbSink(), so validateSink() throws PipeParameterNotValidException and consensus pipe creation (region migration / add peer) fails.

Fix: Add explicit cases for IOT_CONSENSUS_V2_ASYNC_CONNECTOR/PIPE_CONSENSUS_ASYNC_CONNECTOR (and _SINK) accepting consensus.group-id, consensus.pipe-name, ip/host/port, parallel.tasks, realtime-first, plus common sink keys.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the report. Common sink keys are resolved first, and consensus plugins fall through to IOTDB_SINK, which already defines the consensus and connection fields named here. I added regression coverage for the current and legacy connector/sink plugin names; no production change was needed for this case.

case DO_NOTHING_CONNECTOR:
case DO_NOTHING_SINK:
return null;
case SUBSCRIPTION_SINK:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/config/PipeParameterDefinitions.java:194 — subscription-sink rejects sink.topic / sink.consumer-group

SUBSCRIPTION_SINK only accepts reduced keys "topic" and "consumer-group", but SubscriptionSinkSubtaskManager reads PipeSinkConstant.SINK_TOPIC_KEY ("sink.topic") and SINK_CONSUMER_GROUP_KEY ("sink.consumer-group"). Any subscription pipe created with sink.topic/sink.consumer-group now fails validation with 'Ignoring unknown PIPE parameter'.

Fix: Accept both "topic"/"sink.topic" and "consumer-group"/"sink.consumer-group" (and connector.* aliases) for SUBSCRIPTION_SINK.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PipeParameters.KeyReducer removes the leading sink. or connector. prefix before lookup, so the existing topic and consumer-group definitions already accept all three forms. I added regression coverage for unprefixed, sink.*, and connector.* attributes; no production change was needed.

case RENAME_DATABASE_PROCESSOR:
known = reduced.equals("new-db-name");
break;
default:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/config/PipeParameterDefinitions.java:167 — standard-statistics-processor parameters are all rejected as unknown

processors() has no case for STANDARD_STATISTICS_PROCESSOR, so known is false for every key and validateProcessor() throws PipeParameterNotValidException for any attribute of that builtin processor (e.g. output.* keys it consumes), breaking pipes that use it.

Fix: Add a STANDARD_STATISTICS_PROCESSOR case mapping its supported keys (output.*, operators, windowing-strategy, etc.) to PROCESSOR definitions.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added STANDARD_STATISTICS_PROCESSOR to the aggregate-style whitelist for output.*, sliding.*, operators, and windowing-strategy parameters, with regression coverage.

properties.getProperty(
"max_sub_task_num_for_information_table_scan",
Integer.toString(conf.getMaxSubTaskNumForInformationTableScan())));
if (maxSubTaskNumForInformationTableScan > 0) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java:1351 — Removed overlayEffectiveConfigurationValues() leaves show configuration showing raw values

The overlay was deleted, but several keys still bypass ConfigValidation and are rewritten by setters: sort_buffer_size_in_bytes / mods_cache_size_limit_per_fi_in_bytes (loadFixedSizeLimitForQuery rewrites <=0), cte_buffer_size_in_bytes, max_rows_in_cte_buffer, max_sub_task_num_for_information_table_scan, mpp_data_exchange_max_payload_size_in_bytes, table_query_device_entry_batch_size_in_bytes, wal throttle threshold. For these, lastAppliedProperties now reports the raw file value instead of the
…[truncated]

Fix: Route these keys through ConfigValidation (or keep an explicit overlay) so the applied-properties map reflects the effective value.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored the effective-value overlay after startup loading and hot reload for the listed runtime-rewritten settings. The regression test verifies that the applied-properties map reports the effective values rather than the raw inputs.

@Caideyipi

Copy link
Copy Markdown
Collaborator Author

Review update summary

  • Reviewed PR head: d127bf01ab8c07c34f6fdfcd050abd59e2b82039.
  • Consensus sink mappings and subscription key aliases were already handled by the existing lookup/reducer paths; added regression coverage. Added the missing standard-statistics processor mapping and restored effective-value overlays for startup and hot reload.
  • Verification: Spotless passed for iotdb-core/node-commons and iotdb-core/datanode; focused tests passed (15 tests, 0 failures, 0 errors, 0 skipped).
  • Final local and remote source head: 28a8d725cb6fb0d0a7619515f61b862eda31a633 (confirmed). The PR remains open and non-draft.

config.setPipeHardlinkBaseDirName(
properties.getProperty("pipe_hardlink_base_dir_name", config.getPipeHardlinkBaseDirName()));
database(
properties,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/config/PipeDescriptor.java:64 — directory() rule rejects valid relative pipe hardlink dir names

pipe_hardlink_base_dir_name / pipe_hardlink_tsfile_dir_name are documented as relative directory names (e.g. pipe), but ConfigValidation.directory() only accepts values that Path.of can parse, so pipe is rejected and the configured value is silently replaced by the default with a warning. Previously any string was accepted.

Fix: Use a plain STRING definition (or a rule that only rejects blank/invalid characters) for these two keys instead of directory().

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The directory() rule uses Path.of to check syntax. Relative paths are accepted, and the path does not have to exist. I added a regression test that loads distinct relative values for both hardlink directory settings and checks they are retained. No production change was needed.

new Type<>(value -> BOOLEAN.parser().apply(value.trim()), "boolean"),
false,
unrestricted());
private static final Definition<String> MODE =

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/subscription/meta/topic/TopicParameterDefinitions.java:60 — Topic mode/order-mode/format validated before normalization, rejecting previously valid values

MODE/ORDER_MODE/FORMAT parse with TopicConfig::normalizeMode/normalizeOrderMode (trim + lowercase + legacy live/consensus aliases) but the rule oneOf(true, ...) compares against the raw value, so mode=LIVE, mode=CONSENSUS, order-mode=LEADER_ONLY or format=RECORD_HANDLER now fail validation although TopicConfig.isValidMode/isValidOrderMode accept them.

Fix: Apply the same normalization inside the rule (e.g. matches(v -> TopicConfig.isValidMode(v), ...) / isValidOrderMode / case-insensitive format check) so validation matches TopicConfig semantics.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definition.parse() runs the type parser before applying the rule, so mode and order-mode are normalized before validation. The format allowlist compares case-insensitively. The regression test covers LIVE, CONSENSUS, LEADER-ONLY, and uppercase SubscriptionRecordHandler. LEADER_ONLY and RECORD_HANDLER are not existing configuration aliases. No production change was needed.

@Caideyipi
Caideyipi force-pushed the config-validation-fallbacks branch from 28a8d72 to fb27d58 Compare November 27, 2026 10:59
@Caideyipi

Copy link
Copy Markdown
Collaborator Author

Review and CI follow-up

  • Investigated the comments and CI failures at 28a8d725cb6fb0d0a7619515f61b862eda31a633; applied the test changes on top of source head fb27d5839dd4a90a89b5f6137c1959784c131e5c.
  • Added coverage for relative Pipe hardlink directory names, Topic mode normalization, and case-insensitive format matching. These already work without production changes.
  • Updated reload tests to check effective fallback values. Updated the tree and table Pipe tests to use source.realtime.mode, check that unknown ALTER attributes are dropped, and verify that out-of-range Zstd levels are rejected.
  • Local verification: Spotless and a focused Maven verify completed successfully with 29 unit tests and 8 Pipe integration tests (two 1C1D clusters), with no test failures, errors, or skips. The local RAT check was skipped due to the initialized Go submodule. The PropertiesTest fork logged a heap error during the run, but all 12 cases passed and Maven exited zero.
  • Final local commit, remote source branch, and PR head match: bb860e46cb0ea0592670dfd40f58207744f51cd5. The PR remains open and non-draft; GitHub CI for this update is separate from the local results.

if (defaultValue == null && hotReload && legacyKey != null) {
defaultValue = ConfigurationFileUtils.getConfigurationDefaultValue(legacyKey);
}
if (value == null && legacyValue == null && defaultValue == null) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/config/PipeDescriptor.java:893 — Hot reload resets pipe settings to template defaults when key is absent

loadExternal() no longer returns early when both value and legacyValue are null on hot reload; it resolves defaultValue from the template and calls the setter with it. Previously parserPipeConfig() returned null and the setter was skipped. Any set configuration that does not include e.g. pipe_sink_timeout_ms now overwrites the running value with the template default.

Fix: Restore the early return when value == null && legacyValue == null regardless of hotReload, so absent keys leave the current runtime value untouched.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 9b0c01accf3. During hot reload, loadExternal() now returns immediately when both the primary and legacy values are absent, leaving the current runtime setting unchanged. Added regression coverage for the missing-key case.

final String value = properties.getProperty(key, null);
final String legacyValue = properties.getProperty(legacyKey, null);
final Definition<T> definition = new Definition<>(type, defaultValue, rule);
return value != null

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/ConfigValidation.java:274 — databaseAlias ignores legacy value when primary key is invalid

When the primary key is present but invalid, databaseAlias() falls back to defaultValue instead of the legacy key's value, and the warning names the primary key. E.g. default_database_level=abc with a valid default_storage_group_level=2 yields the built-in default 1 rather than 2, silently changing the effective database level.

Fix: On failure of the primary key, retry with the legacy value (databaseValue(properties, legacyKey, legacyValue, definition)) before falling back to defaultValue.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 9b0c01accf3. When the primary value is invalid, databaseAlias() now validates the legacy value before falling back to the configured default, and records the effective value under the primary key. Added regression coverage for an invalid primary value with a valid legacy value.

.map(String::trim)
.mapToInt(Integer::parseInt)
.toArray();
long proportionSum = Arrays.stream(schemaMemoryProportion).asLongStream().sum();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/DataNodeMemoryConfig.java:347 — Zero-sum schema_memory_proportion now divides by zero

The previous code skipped applying the configured proportions when their sum was 0, keeping {5,4,1}. The new code computes proportionSum from the parsed values and divides by it unconditionally, so schema_memory_proportion=0:0:0 (previously accepted) throws ArithmeticException during startup.

Fix: Keep the old guard: if proportionSum == 0, fall back to the default {5,4,1} proportions (or reject the value in the weights rule).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The schema proportion definition already uses weights(3), whose validation requires a positive sum. Therefore 0:0:0 is rejected and databaseAlias() falls back to 5:4:1 before allocation, so the division-by-zero scenario is not reachable for this input. Added regression coverage confirming the default allocations; no production change was needed.

@Caideyipi
Caideyipi marked this pull request as draft November 30, 2026 02:14
@Caideyipi

Copy link
Copy Markdown
Collaborator Author

Review update summary

  • Reviewed candidate SHA: e83f5ac5fb45df9db749c08bb456ea056ddb3e6e.
  • Finding: extractor.consensus.group-id was incorrectly constrained to a non-negative integer, rejecting textual region IDs such as DataRegion[1] and preventing internal consensus-pipe creation.
  • Fix: the parameter is now validated as text; sender and receiver node IDs remain non-negative integers. Added a regression test.
  • Verification: Spotless passed; focused Maven tests passed (11 tests, 0 failures). Remote CI for the updated head is still running; WindowsScripts passed, while sonar and codecov were skipped.
  • Final local commit, source branch head, and PR head: 3f967f2604bf5f9287115eca72f23ab492d73aff (confirmed). PR remains a draft pending a fresh independent review of the updated head.

@Caideyipi

Copy link
Copy Markdown
Collaborator Author

Review update summary

  • Reviewed starting PR head: bb860e46cb0ea0592670dfd40f58207744f51cd5; rebased the comment fixes onto concurrent head 3f967f2604bf5f9287115eca72f23ab492d73aff.
  • Fixed hot reload so absent Pipe settings retain their current runtime values. Invalid primary configuration values now retry the legacy alias before using the default. Added regression coverage for both fixes and for zero-sum schema memory proportions; the existing weights(3) rule rejects a zero sum and falls back to 5:4:1, so no production change was needed for that report.
  • Verification: Spotless passed for node-commons and datanode; git diff --check passed. Focused Maven tests did not complete: the first attempt found an inaccessible constructor in the new test, and the corrected retry found a missing IOException declaration, now fixed. No further Maven run was made under the retry limit; all three new tests remain unverified.
  • Final local and confirmed remote source head: 9b0c01accf35f244455b0ed38579d4f0810c39ae. PR remains draft.

@Caideyipi
Caideyipi marked this pull request as ready for review November 30, 2026 09:38
return "websocket.port".equals(reduced) ? PORT : null;
case WRITE_BACK_CONNECTOR:
case WRITE_BACK_SINK:
return "database".equals(reduced) ? TEXT : null;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/config/PipeParameterDefinitions.java:205 — write-back sink validation silently drops user-id / cli-hostname

sinkDefinitions() accepts only database plus COMMON_SINK keys for WRITE_BACK_CONNECTOR/WRITE_BACK_SINK, but WriteBackSink reads connector.user-id (WriteBackSink.java:269) and connector.cli-hostname (:278). ConfigValidation.validatedAttributes() drops keys without a definition, so a write-back pipe created with e.g. connector.user-id=0 loses it and the sink builds UserEntity(-1, username, null), changing the audit/privilege identity used by checkCanCreateDatabase.

Fix: Add user-id and cli-hostname to the WRITE_BACK branch (or fall through to IOTDB_SINK) and cover it with a create-pipe validation test.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added user-id and cli-hostname to the write-back connector/sink validation definitions using the existing user-ID and text validators. The regression test checks both plugin names and their respective prefixes, so these values are preserved for the sink.

"datanode_schema_cache_eviction_policy", conf.getDataNodeSchemaCacheEvictionPolicy()));
database(
properties,
"datanode_schema_cache_eviction_policy",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java:1204 — schema cache eviction policy allowlist is case-insensitive but valueOf is not

oneOf(true, "FIFO", "LRU") accepts lru/Fifo, but TableDeviceSchemaCache initializes with DualKeyCachePolicy.valueOf(config.getDataNodeSchemaCacheEvictionPolicy()) (TableDeviceSchemaCache.java:135), which is case-sensitive. Such a value passes the new validation instead of warning and falling back, then throws IllegalArgumentException when the table-model schema cache is first initialized.

Fix: Use oneOf(false, "FIFO", "LRU") so invalid casing falls back with a warning, or normalize to upper case before valueOf.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the allowlist to case-sensitive matching. A lowercase value such as lru now fails validation and falls back to the configured value with a warning, rather than reaching the case-sensitive valueOf call. Added a regression test for the invalid casing.

# Conflicts:
#	iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/subscription/SubscriptionInfo.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java
#	iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/config/PipeDescriptor.java
#	iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/pipe/config/PipeDescriptorTest.java
@Caideyipi

Copy link
Copy Markdown
Collaborator Author

Review update summary

  • Fixed write-back connector/sink validation so user-id and cli-hostname are retained and validated; added regression coverage for both plugin forms.
  • Made the schema-cache eviction policy allowlist case-sensitive; invalid casing now falls back with a warning before policy initialization.
  • Synced with master through a9f31011239f728df7f1fff852cf5f2bd7310f86, preserving Pipe hot-reload behavior and adapting Topic validation to the merged TopicConfig API.
  • Verification: Spotless passed; focused tests passed (90 tests, 0 failures, 0 errors, 0 skipped). Full-suite tests and remote CI are not included in this local result.
  • Final local commit, source branch, and PR head match: 8207e5234f5feb52ced889c24da114764329c357. The PR remains open and non-draft.

"cli-hostname",
"history.loose-range",
"realtime.loose-range",
"balance-strategy");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/config/PipeParameterDefinitions.java:291 — Pipe source attribute loose-range is dropped as unknown for iotdb-source

iotdbSource() whitelists only "history.loose-range"/"realtime.loose-range", but PipeSourceConstant.SOURCE_LOOSE_RANGE_KEY ("source.loose-range", also "extractor.loose-range") is a supported source parameter read by PipeRealtimeDataRegionSource:198-206 and PipeHistoricalDataRegionTsFileAndDeletionSource:230. lookup() finds no definition, so ConfigValidation.validatedAttributes() only logs "Ignoring unknown PIPE parameter" and drops the key during CreatePipeProcedureV2/AlterPipeProcedureV2/PipeDataNodePluginAgent validation; a pipe created with source.loose-range=all silently runs with sloppyTimeRange/sloppyPattern false (strict default).

Fix: Add "loose-range" to iotdbSource() (TEXT, or the same time/path/all allowlist used by the topic definition) and cover CREATE PIPE ... source.loose-range=all with a retained-attribute test.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added loose-range to the built-in IoTDB source parameter allowlist. The regression test confirms that both source.loose-range=all and the extractor.loose-range alias are retained by validation.

case RETAIN_PROGRESS_AFTER_UNSUBSCRIBE -> RETAIN_PROGRESS;
case STRICT, EXTRACTOR_CAPTURE_TREE, SOURCE_CAPTURE_TREE -> BOOL;
case START_TIME, END_TIME -> PipeParameterDefinitions.TIMESTAMP;
case LOOSE_RANGE ->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/subscription/meta/topic/TopicParameterDefinitions.java:139 — Topic loose-range=true (legacy boolean) now rejected by the new allowlist

The LOOSE_RANGE definition only accepts ""/time/path/all, but TopicConfig.getAttributesWithSourceLooseRangeOrStrict() maps the boolean form true to "all" (see TopicConfigTest.testTrueLooseRangeMapsToAllSourceLooseRanges). CREATE TOPIC ... WITH ('loose-range'='true') now throws SubscriptionException, and any ALTER of an existing topic carrying it fails at SubscriptionInfo:383 (validateTopicConfig over the merged attributes), including internal owner/lease updates.

Fix: Accept the legacy boolean values in the LOOSE_RANGE rule (e.g. also allow "true"/"false"), or define it as TEXT like REALTIME_MODE so TopicConfig keeps interpreting the value.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Topic loose-range allowlist now accepts the legacy boolean values true and false alongside the existing values. The regression test covers both; the existing TopicConfig conversion of true to all remains unchanged.

@Caideyipi

Copy link
Copy Markdown
Collaborator Author

Review update summary

  • Reviewed starting PR head: 8207e5234f5feb52ced889c24da114764329c357.
  • Fixed both latest review findings: the built-in IoTDB source allowlist now retains source.loose-range and extractor.loose-range; Topic loose-range validation accepts the legacy true and false values.
  • Added regression coverage for both source aliases and both Topic boolean values.
  • Verification: Spotless passed; focused Maven tests passed (17 tests, 0 failures, 0 errors, 0 skipped); git diff --check passed.
  • Final local commit, source branch, and PR head: c21bbeb7953b62e38c68d3c071729891eff486e6 (confirmed). The PR remains open and non-draft.
  • Remote CI for the updated head is separate from this local verification.

add(
definitions,
NON_NEGATIVE_INT,
"batch.max-delay-seconds",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/config/PipeParameterDefinitions.java:381 — Sink batch.max-delay-seconds/ms rejects the negative "no limit" value

batch.max-delay-seconds and batch.max-delay-ms are declared NON_NEGATIVE_INT, but both batch builders treat a negative value as "no delay limit" (PipeTransferBatchReqBuilder:122/125 and IoTConsensusV2TransferBatchReqBuilder:89/91 use x < 0 ? Integer.MAX_VALUE). CREATE/ALTER PIPE ... SINK ('sink.batch.max-delay-seconds'='-1') now throws PipeParameterNotValidException in validateSink(), so a previously accepted pipe cannot be created or altered.

Fix: Declare both batch delay keys with a rule that accepts negatives (e.g. withUnlimited(nonNegative()), as done for output.max-delay-seconds) instead of NON_NEGATIVE_INT.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c411f795d14. Both batch.max-delay-seconds and batch.max-delay-ms now accept -1 as the unlimited sentinel and continue rejecting values below -1. Added regression coverage for both keys.

properties.getProperty("timestamp_precision", config.getTimestampPrecision()).trim());
database(
properties,
"timestamp_precision",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonDescriptor.java:282 — Invalid timestamp_precision now silently falls back instead of failing startup

timestamp_precision is now loaded via database(..., oneOf(false, "ms","us","ns")), so an invalid or differently-cased value (e.g. US, millisecond) is replaced by config.getTimestampPrecision() ("ms" on a fresh start) with only a warning; CommonConfig.setTimestampPrecision is no longer reached, so its System.exit(-1) guard never fires. A node intended to run at us/ns now starts at ms, changing how timestamps are written and interpreted.

Fix: Keep this key fail-fast (validate and abort startup on an invalid value, e.g. via the strict/startupCritical path) instead of silently defaulting to ms.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c411f795d14. timestamp_precision now uses strict startup-critical validation, so invalid or differently cased values fail configuration loading rather than silently falling back. Added regression coverage for invalid US and valid us.

@Caideyipi

Copy link
Copy Markdown
Collaborator Author

Review update summary

  • Reviewed starting PR head: c21bbeb7953b62e38c68d3c071729891eff486e6.
  • Fixed both sink batch-delay keys to accept -1 as unlimited and reject lower values; restored fail-fast startup validation for timestamp_precision.
  • Added regression tests for both behaviors. The first compile attempt caught a missing checked-exception declaration in the test; fixed before the successful rerun.
  • Verification: Spotless passed; focused Maven tests passed (19 tests, 0 failures, 0 errors, 0 skipped).
  • Final local commit, source branch head, and PR head: c411f795d14eae9c7eb48672292fca4f2bdd4306 (confirmed).
  • PR remains open and non-draft. Remote CI is pending, with checks queued or running and some optional checks skipped.

@Caideyipi
Caideyipi marked this pull request as draft December 4, 2026 11:09
@Caideyipi

Copy link
Copy Markdown
Collaborator Author

Initial self-review summary — scope: the added invalid-sink-port IT.

  • Reviewed SHA: 191e272.
  • Findings: none in the added test. It covers rejection of port 65536 during CREATE and ALTER, and verifies failed operations do not create a pipe or change the existing pipe configuration.
  • Verification: Spotless passed; the targeted IT passed (1 run, 0 failures, 0 errors, 0 skipped); git diff --check passed. The test-selection helper could not run in this Windows environment, so the existing category/profile mapping was checked manually.
  • Final local SHA: 191e272.
  • Confirmed remote SHA: 191e272 on the PR source branch. PR Validate database, Pipe, and Topic configuration #19428 remains Draft pending a fresh independent review of the full current diff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants