loserwang1024 opened a new issue, #2939:
URL: https://github.com/apache/fluss/issues/2939

   ### Search before asking
   
   - [x] I searched in the [issues](https://github.com/apache/fluss/issues) and 
found nothing similar.
   
   
   ### Fluss version
   
   0.9.0 (latest release)
   
   ### Please describe the bug 🐞
   
   Currently, when a user manually creates a partition via the Admin API or 
when the client dynamically creates a partition during a write, there is no 
validation that the partition time value is:
   1. Correctly formatted — matching the pattern expected by the configured 
TABLE_AUTO_PARTITION_TIME_UNIT (e.g., yyyyMMdd for DAY, yyyy for YEAR).
   2. Not out-of-date — i.e., not older than the earliest partition retained by 
the auto-partition retention policy (TABLE_AUTO_PARTITION_NUM_RETENTION).
   
   This means a user can currently:
   * Create a partition like 2024-03-25 on a table with YEAR unit (wrong 
format), which will never be managed by auto-partition.
   * Create a partition that is already beyond the retention window, which will 
be immediately eligible for deletion.
   
   
   
   ### Solution
   
   Add a shared utility method PartitionUtils.validateAutoPartitionTime in 
fluss-common that:
   1. Returns early if auto-partition is not enabled for the table.
   2. Validates the partition value matches the format string for the 
configured time unit (e.g., yyyyMMdd for DAY).
   3. Validates the partition value is not older than currentTime - numToRetain 
units, throwing InvalidPartitionException with a descriptive message in both 
failure cases.
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to