[chore](ddl) support force_enable_feature_binlog #41796 (#42926)

cherry pick from #41796
This commit is contained in:
walter
2024-10-31 09:53:45 +08:00
committed by GitHub
parent fce4695f37
commit ae88d032db
3 changed files with 15 additions and 0 deletions

View File

@ -2345,6 +2345,11 @@ public class Config extends ConfigBase {
"Whether to enable binlog feature"})
public static boolean enable_feature_binlog = false;
@ConfField(mutable = false, description = {
"是否默认为 Database/Table 启用binlog特性",
"Whether to enable binlog feature for Database/Table by default"})
public static boolean force_enable_feature_binlog = false;
@ConfField(mutable = false, masterOnly = false, varType = VariableAnnotation.EXPERIMENTAL, description = {
"设置 binlog 消息最字节长度",
"Set the maximum byte length of binlog message"})

View File

@ -18,12 +18,14 @@
package org.apache.doris.analysis;
import org.apache.doris.catalog.Env;
import org.apache.doris.common.Config;
import org.apache.doris.common.ErrorCode;
import org.apache.doris.common.ErrorReport;
import org.apache.doris.common.FeNameFormat;
import org.apache.doris.common.UserException;
import org.apache.doris.common.util.InternalDatabaseUtil;
import org.apache.doris.common.util.PrintableMap;
import org.apache.doris.common.util.PropertyAnalyzer;
import org.apache.doris.mysql.privilege.PrivPredicate;
import org.apache.doris.qe.ConnectContext;
@ -43,6 +45,11 @@ public class CreateDbStmt extends DdlStmt {
this.ctlName = dbName.getCtl();
this.dbName = dbName.getDb();
this.properties = properties == null ? new HashMap<>() : properties;
if (Config.force_enable_feature_binlog
&& !this.properties.containsKey(PropertyAnalyzer.PROPERTIES_BINLOG_ENABLE)) {
this.properties.put(PropertyAnalyzer.PROPERTIES_BINLOG_ENABLE, "true");
}
}
public String getFullDbName() {

View File

@ -273,6 +273,9 @@ public class Database extends MetaObject implements Writable, DatabaseIf<Table>
public void setDbProperties(DatabaseProperty dbProperties) {
this.dbProperties = dbProperties;
if (PropertyAnalyzer.hasBinlogConfig(dbProperties.getProperties())) {
binlogConfig = dbProperties.getBinlogConfig();
}
}
public long getUsedDataQuotaWithLock() {