Repository navigation
Fix tier folder recovery and DiskFull status after configuration reload - #19161
Conversation
Caideyipi
left a comment
There was a problem hiding this comment.
Reviewed 378f1a0. Found one recovery regression involving discarded FolderManagers that captured data directories before a configuration reload. A focused regression test successfully selected a TsFile folder on the added directory, then failed the recovery assertion: expected Running, actual ReadOnly (1 test, 1 failure, 0 errors).
| } | ||
| reloadMetricProperties(commonProperties); | ||
| if (wasReadOnlyForDiskFull) { | ||
| commonConfig.setRunningIfDiskFull(); |
There was a problem hiding this comment.
[P2] Refresh non-tier data-directory recovery checks on reload
With this clearing step removed, checks from ordinary FolderManagers also survive a successful reload, but only TierManager checks follow the new configuration. For example, SnapshotLoader.createLinksFromSnapshotDirToDataDirWithoutLog() constructs a plain FolderManager from getLocalDataDirs(). If construction fails while the old data disk is full, DirectoryStrategy.setFolders() registers a callback over List.copyOf(oldDirs). After dn_data_dirs adds a free disk, new tier and snapshot-loading managers can use that disk, while the discarded snapshot manager's callback still checks only the full old disk. Even after the aggregate disk-space check passes, tryRecoverFromDiskFull() therefore keeps the whole DataNode in ReadOnly(DiskFull). Please refresh or retire checks owned by these reloadable data-directory consumers as well, while preserving independent sources such as WAL. A regression should cover failed snapshot-manager construction, adding a free data directory through reload, and subsequent heartbeat recovery.
There was a problem hiding this comment.
Thanks, good catch. Fixed in cfd1dce: SnapshotLoader, LoadStagingDirs, and LoadUtil now check their current configured directories for DiskFull recovery, while independent sources such as WAL remain registered. The new SnapshotLoaderDiskFullReloadTest covers failed snapshot FolderManager construction, adding a writable data directory, and the heartbeat recovery check (tryRecoverFromDiskFull). It also verifies that an unavailable WAL source still keeps the node ReadOnly. The focused tests passed.
| private FolderManager getFolderManager(int tierLevel, String folderName) | ||
| throws DiskSpaceInsufficientException { | ||
| TierFolderManager entry = folderManagers.get(new TierDirectory(tierLevel, folderName)); | ||
| if (entry == null) { | ||
| throw new IndexOutOfBoundsException(tierLevel); | ||
| } |
There was a problem hiding this comment.
Provide both the tierLevel and the folderName in the exception.
There was a problem hiding this comment.
Updated in cfd1dce. The missing-key exception now includes the TierDirectory key, whose message contains both tierLevel and folderName (for example, TierDirectory[tierLevel=2, folderName=sequence]). TierManagerTest asserts both values.
Problem
When every directory managed by a
FolderManageris full during DataNode startup or configuration reload, construction fails.TierManagerpreviously skipped that manager in its tier lists. Freeing disk space could then restore the DataNode toRunning, but a later TsFile allocation could still fail withIndexOutOfBoundsExceptionor select the wrong tier because the list no longer matched the configured tier levels.A successful configuration reload could also clear
ReadOnly(DiskFull)even when the same directories remained full or another disk-full source had not recovered.Changes
FolderManager. Retry a failed construction on the next access and reuse successfully constructed managers.Runningafter a successful reload. Heartbeat recovery now requires both the aggregate disk-space check and every registered disk-full recovery check to pass.Verification
python3 .github/scripts/check-it-selection.pypassed.mvn spotless:apply -o -pl integration-test -P with-integration-tests -Ddevelocity.off=truepassed.mvn verify -o -DskipUTs '-Dit.test=IoTDBDiskFullFolderRecoveryIT' -DfailIfNoTests=false -Dfailsafe.failIfNoSpecifiedTests=false -pl integration-test -am -P with-integration-tests -Ddevelocity.off=truepassed: 1 test, 0 failures, 0 errors, 0 skipped. The IT verifiesReadOnly(DiskFull)during a full-directory reload, continued read-only status after an unchanged reload, recovery toRunning, and successful TsFile creation and query.The IT raises the disk-space warning threshold to exercise the real DataNode allocation and recovery paths without physically filling the host filesystem.