fix: add check for invalid encode/compress algorithm - 3.3.6#35315
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces validation for column compression algorithms during table creation and alteration in both the mnode and vnode components. It ensures that the specified compression settings are compatible with the column's data type. Additionally, the test suite has been expanded to cover invalid compression configurations. Feedback was provided regarding an inconsistency in mndBuildStbFromReq where default compression was not being applied when no compression was specified, unlike in mndBuildStbFromAlter.
There was a problem hiding this comment.
Pull request overview
This PR adds server-side validation to reject unsupported column encode/compress/level configurations during CREATE/ALTER operations, ensuring invalid compression settings cannot be persisted in mnode/vnode metadata.
Changes:
- Add
validColCmprByType()checks during STABLE create/alter flows in mnode. - Add compression validation for normal table create/add-column/modify-compress flows in vnode meta.
- Extend mnode STABLE tests to cover invalid encode/compress algorithm and invalid level rejection across create/alter entry points.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| source/dnode/vnode/src/meta/metaTable2.c | Validates column compression algorithms for normal table creation and column compression updates. |
| source/dnode/mnode/impl/src/mndStb.c | Adds compression validation when building STABLE metadata from create/alter requests. |
| source/dnode/mnode/impl/test/stb/stb.cpp | Adds unit tests for invalid compress settings in CREATE/ALTER STABLE scenarios. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4c10d36 to
e1f5fae
Compare
Description
Add server-side validation of column encode/compress/level algorithms at all entry points in mnode and vnode to prevent unsupported compression configurations from being persisted.
Changes:
mndStb.c): AddvalidColCmprByType()checks inmndBuildStbFromReq(),mndBuildStbFromAlter(), andmndAddSuperTableColumn()for CREATE/ALTER STABLE operationsmetaTable2.c): Add validation inmetaCreateNormalTable(),metaAddTableColumn(), andmetaUpdateTableColCompress2()for normal table operationsstb.cpp): Add test cases for invalid encode, compress algorithm, and compress level rejection during CREATE STABLE, ALTER STABLE ADD COLUMN WITH COMPRESS, and ALTER STABLE MODIFY COLUMN COMPRESSIssue(s)
Checklist
Please check the items in the checklist if applicable.