-
Notifications
You must be signed in to change notification settings - Fork 40
Optimize JDBC adaptor for MySQL #2801
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ | |
| import com.scalar.db.storage.jdbc.query.SelectQuery; | ||
| import com.scalar.db.storage.jdbc.query.SelectWithLimitQuery; | ||
| import com.scalar.db.storage.jdbc.query.UpsertQuery; | ||
| import java.sql.Connection; | ||
| import java.sql.Driver; | ||
| import java.sql.JDBCType; | ||
| import java.sql.ResultSet; | ||
|
|
@@ -448,7 +449,19 @@ public TimestampTZColumn parseTimestampTZColumn(ResultSet resultSet, String colu | |
| } | ||
|
|
||
| @Override | ||
| public Map<String, String> getConnectionProperties() { | ||
| public Map<String, String> getConnectionProperties(JdbcConfig config) { | ||
| if (config.getDatabaseConfig().getScanFetchSize() == Integer.MIN_VALUE) { | ||
| // If the scan fetch size is set to Integer.MIN_VALUE, use the streaming mode. | ||
| return Collections.emptyMap(); | ||
| } | ||
|
|
||
| // Otherwise, use the cursor fetch mode. | ||
| return Collections.singletonMap("useCursorFetch", "true"); | ||
| } | ||
|
Comment on lines
+452
to
460
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If a user sets |
||
|
|
||
| @Override | ||
| public void setConnectionToReadOnly(Connection connection, boolean readOnly) throws SQLException { | ||
| // Observed performance degradation when using read-only connections in MySQL. So we do not | ||
| // set the read-only mode for MySQL connections. | ||
| } | ||
|
Comment on lines
+462
to
+466
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't call
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a question. We don't know the reason for the behavior?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, we don't know the exact reason. We just observed performance degradation when we call |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[question] Is this behavior only for MySQL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need to add an integration test using
scalar.db.scan_fetch_size = Integer.MIN_VALUEjust in case ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, let me do that.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added integration tests for it in bdb1309. Thanks!