github-actions[bot] commented on code in PR #65219:
URL: https://github.com/apache/doris/pull/65219#discussion_r3528082626
##########
fe/fe-core/src/main/java/org/apache/doris/clone/DynamicPartitionScheduler.java:
##########
@@ -296,23 +335,29 @@ private ArrayList<AddPartitionOp>
getAddPartitionOp(Database db, OlapTable olapT
int hotPartitionNum = dynamicPartitionProperty.getHotPartitionNum();
String storagePolicyName = dynamicPartitionProperty.getStoragePolicy();
+ // Partition naming uses the same `now` clock as border computation,
+ // so names and values are based on the same timezone (UTC for
TIMESTAMPTZ).
String nowPartitionPrevBorder =
DynamicPartitionUtil.getPartitionRangeString(
dynamicPartitionProperty, now, 0, partitionFormat);
String nowPartitionName = dynamicPartitionProperty.getPrefix()
- +
DynamicPartitionUtil.getFormattedPartitionName(dynamicPartitionProperty.getTimeZone(),
+ +
DynamicPartitionUtil.getFormattedPartitionName(borderTimeZone,
nowPartitionPrevBorder,
dynamicPartitionProperty.getTimeUnit());
+ // UTC-based lower bound of the current partition, used to identify the
+ // current partition by range in getHistoricalPartitions().
+ String currentUtcBorder = DynamicPartitionUtil.getPartitionRangeString(
+ dynamicPartitionProperty, now, 0, partitionFormat);
+ currentUtcBorder = convertToUtcTimestamp(partitionColumn,
currentUtcBorder, borderTimeZone);
for (; idx <= dynamicPartitionProperty.getEnd(); idx++) {
+ // Borders for both partition values and names: use now.
String prevBorder = DynamicPartitionUtil.getPartitionRangeString(
dynamicPartitionProperty, now, idx, partitionFormat);
String nextBorder = DynamicPartitionUtil.getPartitionRangeString(
dynamicPartitionProperty, now, idx + 1, partitionFormat);
- // Save original border for partition name (must not contain UTC
suffix)
+ // Save pre-conversion border for naming (UTC-based for
TIMESTAMPTZ).
String prevBorderForName = prevBorder;
- prevBorder = convertToUtcTimestamp(partitionColumn, prevBorder,
- dynamicPartitionProperty.getTimeZone());
- nextBorder = convertToUtcTimestamp(partitionColumn, nextBorder,
- dynamicPartitionProperty.getTimeZone());
+ prevBorder = convertToUtcTimestamp(partitionColumn, prevBorder,
borderTimeZone);
Review Comment:
This fixes newly computed TIMESTAMPTZ ranges to UTC, but existing
dynamic-partition tables that already have the old configured-timezone ranges
will now block the fixed ranges. For example, before this change `time_zone =
'Asia/Shanghai'` created `p20260706` as `[2026-07-05 16:00:00+00:00, 2026-07-06
16:00:00+00:00)`. After upgrade this code wants `[2026-07-06 00:00:00+00:00,
2026-07-07 00:00:00+00:00)`, which overlaps the old partition but is not equal.
The overlap check below then sets `isPartitionExists`, records a
create-partition failure, and `continue`s, so the UTC-aligned partition is not
created while the shifted partition remains. Please add an
upgrade/compatibility path for existing TIMESTAMPTZ dynamic partitions, or gate
the UTC-boundary behavior so existing tables do not get stuck with overlapping
old ranges.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]