Repository navigation
fix: skip folder markers during ETL merge - #27747
Conversation
Filter directory and unsupported entries before ETL merge processing, and return a normal error instead of panicking when an unsupported path reaches the reader. Add regression coverage for object-store folder markers and supported extension controls.
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review completed: APPROVE.
Root cause matches issue #27740: S3/MinIO folder markers can be exposed as non-directory entries with an empty name, which previously reached newETLReader and panicked. The IsDir + exact .csv/.tae filtering closes the production path, and newETLReader now returns ErrNotSupported instead of panicking as defense in depth. No correctness, lifecycle/unhappy-path, compatibility, or material performance regression found.
Validation on PR head 12a39fc: focused regression tests passed; full ./pkg/util/export passed (15.443s); git diff --check passed.
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue #27740 ## What this PR does / why we need it: Backport of #27747 to `4.2-dev`. S3-compatible object stores can expose zero-byte folder marker objects while ETL merge scans a log directory. The merge task previously treated every listed entry as a data file, so a marker without a `.csv` or `.tae` extension reached `newETLReader` and panicked the CN. This change: - filters directory and unsupported entries before adding them to an ETL merge batch; - dispatches readers by the exact final file extension; - returns `ErrNotSupported` instead of panicking if an unsupported path reaches `newETLReader`; - adds deterministic regression coverage for zero-byte marker objects, directory entries, supported ETL files, and misleading suffixes. The source patch applies cleanly to the latest `4.2-dev`, and its stable patch-id matches #27747. Validation on `4.2-dev`: - focused `TestMergeMainSkipsNonETLEntries`, `TestIsETLFile`, and `Test_newETLReader` tests passed with non-empty selection; - full `./pkg/util/export` package tests passed; - `molint` passed for `./pkg/util/export`; - `golangci-lint -c .golangci.yml ./pkg/util/export` passed with 0 issues. BVT is not applicable because this changes only the internal ETL background file-selection contract and has no SQL-visible behavior.
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#27740 ## What this PR does / why we need it: S3-compatible object stores can expose zero-byte folder marker objects while ETL merge scans a log directory. The merge task previously treated every listed entry as a data file, so a marker without a `.csv` or `.tae` extension reached `newETLReader` and panicked the CN. This change: - filters directory and unsupported entries before adding them to an ETL merge batch; - dispatches readers by the exact final file extension; - returns `ErrNotSupported` instead of panicking if an unsupported path reaches `newETLReader`; - adds deterministic regression coverage for zero-byte marker objects, directory entries, supported ETL files, and misleading suffixes. Validation: - focused `TestMergeMainSkipsNonETLEntries`, `TestIsETLFile`, and `Test_newETLReader` tests passed with non-empty selection; - full `./pkg/util/export` package tests passed; - `molint` passed for `./pkg/util/export`; - `golangci-lint -c .golangci.yml ./pkg/util/export` passed with 0 issues. BVT is not applicable because this changes only the internal ETL background file-selection contract and has no SQL-visible behavior. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: XuPeng-SH <[email protected]>
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#27740 ## What this PR does / why we need it: S3-compatible object stores can expose zero-byte folder marker objects while ETL merge scans a log directory. The merge task previously treated every listed entry as a data file, so a marker without a `.csv` or `.tae` extension reached `newETLReader` and panicked the CN. This change: - filters directory and unsupported entries before adding them to an ETL merge batch; - dispatches readers by the exact final file extension; - returns `ErrNotSupported` instead of panicking if an unsupported path reaches `newETLReader`; - adds deterministic regression coverage for zero-byte marker objects, directory entries, supported ETL files, and misleading suffixes. Validation: - focused `TestMergeMainSkipsNonETLEntries`, `TestIsETLFile`, and `Test_newETLReader` tests passed with non-empty selection; - full `./pkg/util/export` package tests passed; - `molint` passed for `./pkg/util/export`; - `golangci-lint -c .golangci.yml ./pkg/util/export` passed with 0 issues. BVT is not applicable because this changes only the internal ETL background file-selection contract and has no SQL-visible behavior. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: XuPeng-SH <[email protected]>
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#27740 ## What this PR does / why we need it: S3-compatible object stores can expose zero-byte folder marker objects while ETL merge scans a log directory. The merge task previously treated every listed entry as a data file, so a marker without a `.csv` or `.tae` extension reached `newETLReader` and panicked the CN. This change: - filters directory and unsupported entries before adding them to an ETL merge batch; - dispatches readers by the exact final file extension; - returns `ErrNotSupported` instead of panicking if an unsupported path reaches `newETLReader`; - adds deterministic regression coverage for zero-byte marker objects, directory entries, supported ETL files, and misleading suffixes. Validation: - focused `TestMergeMainSkipsNonETLEntries`, `TestIsETLFile`, and `Test_newETLReader` tests passed with non-empty selection; - full `./pkg/util/export` package tests passed; - `molint` passed for `./pkg/util/export`; - `golangci-lint -c .golangci.yml ./pkg/util/export` passed with 0 issues. BVT is not applicable because this changes only the internal ETL background file-selection contract and has no SQL-visible behavior. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: XuPeng-SH <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
issue #27740
What this PR does / why we need it:
S3-compatible object stores can expose zero-byte folder marker objects while
ETL merge scans a log directory. The merge task previously treated every
listed entry as a data file, so a marker without a
.csvor.taeextensionreached
newETLReaderand panicked the CN.This change:
batch;
ErrNotSupportedinstead of panicking if an unsupported path reachesnewETLReader;directory entries, supported ETL files, and misleading suffixes.
Validation:
TestMergeMainSkipsNonETLEntries,TestIsETLFile, andTest_newETLReadertests passed with non-empty selection;./pkg/util/exportpackage tests passed;molintpassed for./pkg/util/export;golangci-lint -c .golangci.yml ./pkg/util/exportpassed with 0 issues.BVT is not applicable because this changes only the internal ETL background
file-selection contract and has no SQL-visible behavior.