Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add conf entry mysql.engine to change storage engine of mysql, defaul… #553

Closed
wants to merge 1 commit into from
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",
wenzhenghu marked this conversation as resolved.
Show resolved Hide resolved
"the storage engine to store graph data/schema, innodb or rocksdb.",
wenzhenghu marked this conversation as resolved.
Show resolved Hide resolved
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);
wenzhenghu marked this conversation as resolved.
Show resolved Hide resolved
}
}

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();
wenzhenghu marked this conversation as resolved.
Show resolved Hide resolved
sql.append(" ENGINE=");
sql.append(this.sessions.config().get(MysqlOptions.STORAGE_ENGINE));
LOG.debug("MySQL storage engine innodb/rocksdb: {}", sql.toString());
wenzhenghu marked this conversation as resolved.
Show resolved Hide resolved
return sql.toString();
}

protected void dropTable(Session session) {
Expand Down