Skip to content
Closed
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<>(
"mysql.engine",
"the storage engine to store graph data/schema, innodb or rocksdb.",
disallowEmpty(),
"InnoDB"
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,8 @@ public String toString() {
}

protected void initTables() {
Session session = this.sessions.session();
for (MysqlTable table : this.tables()) {
table.init(session);
table.init(this.sessions);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,22 @@ public abstract class MysqlTable
// The template for insert and delete statements
private String insertTemplate;
private String deleteTemplate;
private MysqlSessions sessions;

public MysqlTable(String table) {
super(table);
this.insertTemplate = null;
this.deleteTemplate = null;
this.sessions = null;
}

public abstract TableDefine tableDefine();

public void init(MysqlSessions sessions) {
this.sessions = sessions;
this.init(sessions.session());
}

@Override
public void init(Session session) {
this.createTable(session, this.tableDefine());
Expand Down Expand Up @@ -117,7 +124,11 @@ protected void createTable(Session session, TableDefine tableDefine) {
}

protected String engine() {
return " ENGINE=InnoDB";
StringBuilder sql = new StringBuilder();
sql.append(" ENGINE=");
sql.append(this.sessions.config().get(MysqlOptions.STORAGE_ENGINE));
LOG.debug("MySQL storage engine innodb/rocksdb: {}", sql.toString());
return sql.toString();
}

protected void dropTable(Session session) {
Expand Down