[Bug][Dynamic partition] Forward show dynamic partition tables stmt to Master (#6190)
1. Only Master FE has these info. Also catch more exception of dynamic partition scheduler. 2. Forward admin show frontend config stmt to Master if set forward_to_master=true
This commit is contained in:
@ -75,4 +75,13 @@ public class AdminShowConfigStmt extends ShowStmt {
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RedirectStatus getRedirectStatus() {
|
||||
if (ConnectContext.get().getSessionVariable().getForwardToMaster()) {
|
||||
return RedirectStatus.FORWARD_NO_SYNC;
|
||||
} else {
|
||||
return RedirectStatus.NO_FORWARD;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +88,12 @@ public class RoutineLoadDataSourceProperties {
|
||||
|
||||
public void analyze() throws UserException {
|
||||
if (properties.isEmpty()) {
|
||||
throw new AnalysisException("No properties");
|
||||
if (!isAlter) {
|
||||
throw new AnalysisException("No data source properties");
|
||||
} else {
|
||||
// for alter routine load stmt, the datasource property can by null
|
||||
return;
|
||||
}
|
||||
}
|
||||
Preconditions.checkState(!Strings.isNullOrEmpty(timezone), "timezone must be set before analyzing");
|
||||
checkDataSourceProperties();
|
||||
|
||||
@ -89,4 +89,9 @@ public class ShowDynamicPartitionStmt extends ShowStmt {
|
||||
public ShowResultSetMetaData getMetaData() {
|
||||
return SHOW_DYNAMIC_PARTITION_META_DATA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RedirectStatus getRedirectStatus() {
|
||||
return RedirectStatus.FORWARD_NO_SYNC;
|
||||
}
|
||||
}
|
||||
@ -46,12 +46,15 @@ import org.apache.doris.common.util.PropertyAnalyzer;
|
||||
import org.apache.doris.common.util.RangeUtils;
|
||||
import org.apache.doris.common.util.TimeUtils;
|
||||
import org.apache.doris.thrift.TStorageMedium;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Range;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -181,9 +184,10 @@ public class DynamicPartitionScheduler extends MasterDaemon {
|
||||
// only support single column partition now
|
||||
try {
|
||||
RangeUtils.checkRangeIntersect(partitionItem.getItems(), addPartitionKeyRange);
|
||||
} catch (DdlException e) {
|
||||
} catch (Exception e) {
|
||||
isPartitionExists = true;
|
||||
if (addPartitionKeyRange.equals(partitionItem.getItems())) {
|
||||
LOG.info("partition range {} exist in table {}, clear fail msg", addPartitionKeyRange, olapTable.getName());
|
||||
clearCreatePartitionFailedMsg(olapTable.getId());
|
||||
} else {
|
||||
recordCreatePartitionFailedMsg(db.getFullName(), olapTable.getName(), e.getMessage(), olapTable.getId());
|
||||
@ -209,7 +213,6 @@ public class DynamicPartitionScheduler extends MasterDaemon {
|
||||
setStorageMediumProperty(partitionProperties, dynamicPartitionProperty, now, hotPartitionNum, idx);
|
||||
}
|
||||
|
||||
|
||||
String partitionName = dynamicPartitionProperty.getPrefix() + DynamicPartitionUtil.getFormattedPartitionName(
|
||||
dynamicPartitionProperty.getTimeZone(), prevBorder, dynamicPartitionProperty.getTimeUnit());
|
||||
SinglePartitionDesc rangePartitionDesc = new SinglePartitionDesc(true, partitionName,
|
||||
@ -341,7 +344,7 @@ public class DynamicPartitionScheduler extends MasterDaemon {
|
||||
String partitionFormat;
|
||||
try {
|
||||
partitionFormat = DynamicPartitionUtil.getPartitionFormat(partitionColumn);
|
||||
} catch (DdlException e) {
|
||||
} catch (Exception e) {
|
||||
recordCreatePartitionFailedMsg(db.getFullName(), olapTable.getName(), e.getMessage(), olapTable.getId());
|
||||
continue;
|
||||
}
|
||||
@ -360,7 +363,7 @@ public class DynamicPartitionScheduler extends MasterDaemon {
|
||||
try {
|
||||
Catalog.getCurrentCatalog().dropPartition(db, olapTable, dropPartitionClause);
|
||||
clearDropPartitionFailedMsg(olapTable.getId());
|
||||
} catch (DdlException e) {
|
||||
} catch (Exception e) {
|
||||
recordDropPartitionFailedMsg(db.getFullName(), tableName, e.getMessage(), olapTable.getId());
|
||||
} finally {
|
||||
olapTable.writeUnlock();
|
||||
@ -372,7 +375,7 @@ public class DynamicPartitionScheduler extends MasterDaemon {
|
||||
try {
|
||||
Catalog.getCurrentCatalog().addPartition(db, tableName, addPartitionClause);
|
||||
clearCreatePartitionFailedMsg(olapTable.getId());
|
||||
} catch (DdlException e) {
|
||||
} catch (Exception e) {
|
||||
recordCreatePartitionFailedMsg(db.getFullName(), tableName, e.getMessage(), olapTable.getId());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user