Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,12 @@ public static synchronized MysqlOptions instance() {
disallowEmpty(),
"disable"
);

public static final ConfigOption<String> STORAGE_ENGINE =
new ConfigOption<>(
"jdbc.storage_engine",
"The storage engine of backend store database, like InnoDB/MyISAM/RocksDB for MySQL.",
disallowEmpty(),
"InnoDB"
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ public Session() {
}
}

public HugeConfig config() {
return MysqlSessions.this.config();
}

public void open() throws SQLException {
if (this.conn != null && !this.conn.isClosed()) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected void createTable(Session session, TableDefine tableDefine) {
}
}
sql.append("))");
sql.append(this.engine());
sql.append(this.engine(session));
sql.append(";");

LOG.debug("Create table: {}", sql);
Expand All @@ -116,8 +116,9 @@ protected void createTable(Session session, TableDefine tableDefine) {
}
}

protected String engine() {
return " ENGINE=InnoDB";
protected String engine(Session session) {
String engine = session.config().get(MysqlOptions.STORAGE_ENGINE);
return " ENGINE=" + engine;
}

protected void dropTable(Session session) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import com.baidu.hugegraph.backend.store.mysql.MysqlBackendEntry;
import com.baidu.hugegraph.backend.store.mysql.MysqlTable;
import com.baidu.hugegraph.backend.store.mysql.MysqlSessions.Session;
import com.baidu.hugegraph.type.define.HugeKeys;

public abstract class PostgresqlTable extends MysqlTable {
Expand All @@ -46,7 +47,7 @@ protected String buildTruncateTemplate() {
}

@Override
protected String engine() {
protected String engine(Session session) {
return Strings.EMPTY;
}

Expand Down