Skip to content

Commit

Permalink
[chore](ddl) support force_enable_feature_binlog (apache#41796)
Browse files Browse the repository at this point in the history
... for testing
  • Loading branch information
w41ter authored Oct 15, 2024
1 parent af7eb15 commit 604d3ac
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2387,6 +2387,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"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -43,6 +45,11 @@ public CreateDbStmt(boolean ifNotExists, DbName dbName, Map<String, String> prop
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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ public DatabaseProperty getDbProperties() {

public void setDbProperties(DatabaseProperty dbProperties) {
this.dbProperties = dbProperties;
if (PropertyAnalyzer.hasBinlogConfig(dbProperties.getProperties())) {
binlogConfig = dbProperties.getBinlogConfig();
}
}

public long getUsedDataQuotaWithLock() {
Expand Down

0 comments on commit 604d3ac

Please sign in to comment.