-
Notifications
You must be signed in to change notification settings - Fork 38
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
Remove hard-coded collation in JDBC adapter #1518
Changes from all commits
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 |
---|---|---|
|
@@ -227,15 +227,11 @@ jobs: | |
name: MySQL 5.7 integration test | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
mysql: | ||
image: mysql:5.7 | ||
env: | ||
MYSQL_ROOT_PASSWORD: mysql | ||
ports: | ||
- 3306:3306 | ||
|
||
steps: | ||
- name: Run MySQL 5.7 | ||
run: | | ||
docker run -e MYSQL_ROOT_PASSWORD=mysql -p 3306:3306 -d mysql:5.7 --character-set-server=utf8mb4 --collation-server=utf8mb4_bin | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 8 | ||
|
@@ -260,15 +256,11 @@ jobs: | |
name: MySQL 8.0 integration test | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
mysql: | ||
image: mysql:8.0 | ||
env: | ||
MYSQL_ROOT_PASSWORD: mysql | ||
ports: | ||
- 3306:3306 | ||
|
||
steps: | ||
- name: Run MySQL 8.0 | ||
run: | | ||
docker run -e MYSQL_ROOT_PASSWORD=mysql -p 3306:3306 -d mysql:8.0 --character-set-server=utf8mb4 --collation-server=utf8mb4_bin | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 8 | ||
|
@@ -293,15 +285,11 @@ jobs: | |
name: MySQL 8.1 integration test | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
mysql: | ||
image: mysql:8.1 | ||
env: | ||
MYSQL_ROOT_PASSWORD: mysql | ||
ports: | ||
- 3306:3306 | ||
|
||
steps: | ||
- name: Run MySQL 8.1 | ||
run: | | ||
docker run -e MYSQL_ROOT_PASSWORD=mysql -p 3306:3306 -d mysql:8.1 --character-set-server=utf8mb4 --collation-server=utf8mb4_bin | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 8 | ||
|
@@ -607,6 +595,7 @@ jobs: | |
MSSQL_PID: "Express" | ||
SA_PASSWORD: "SqlServer17" | ||
ACCEPT_EULA: "Y" | ||
MSSQL_COLLATION: "Japanese_BIN2" | ||
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. Also, for SQL Server, we set |
||
ports: | ||
- 1433:1433 | ||
|
||
|
@@ -642,6 +631,7 @@ jobs: | |
MSSQL_PID: "Express" | ||
SA_PASSWORD: "SqlServer19" | ||
ACCEPT_EULA: "Y" | ||
MSSQL_COLLATION: "Japanese_BIN2" | ||
ports: | ||
- 1433:1433 | ||
|
||
|
@@ -677,6 +667,7 @@ jobs: | |
MSSQL_PID: "Express" | ||
SA_PASSWORD: "SqlServer22" | ||
ACCEPT_EULA: "Y" | ||
MSSQL_COLLATION: "Japanese_BIN2" | ||
ports: | ||
- 1433:1433 | ||
|
||
|
@@ -733,15 +724,11 @@ jobs: | |
name: MariaDB 10 integration test | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
mariadb: | ||
image: mariadb:10.11 | ||
env: | ||
MYSQL_ROOT_PASSWORD: mysql | ||
ports: | ||
- 3306:3306 | ||
|
||
steps: | ||
- name: Run MariaDB 10.11 | ||
run: | | ||
docker run -e MYSQL_ROOT_PASSWORD=mysql -p 3306:3306 -d mariadb:10.11 --character-set-server=utf8mb4 --collation-server=utf8mb4_bin | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 8 | ||
|
@@ -774,14 +761,12 @@ jobs: | |
HEAP_NEWSIZE: 512m | ||
ports: | ||
- 9042:9042 | ||
mysql: | ||
image: mysql:8 | ||
env: | ||
MYSQL_ROOT_PASSWORD: mysql | ||
ports: | ||
- 3306:3306 | ||
|
||
steps: | ||
- name: Run MySQL 8 | ||
run: | | ||
docker run -e MYSQL_ROOT_PASSWORD=mysql -p 3306:3306 -d mysql:8 --character-set-server=utf8mb4 --collation-server=utf8mb4_bin | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 8 | ||
|
@@ -806,15 +791,11 @@ jobs: | |
name: ScalarDB Server integration test | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
mysql: | ||
image: mysql:8 | ||
env: | ||
MYSQL_ROOT_PASSWORD: mysql | ||
ports: | ||
- 3306:3306 | ||
|
||
steps: | ||
- name: Run MySQL 8 | ||
run: | | ||
docker run -e MYSQL_ROOT_PASSWORD=mysql -p 3306:3306 -d mysql:8 --character-set-server=utf8mb4 --collation-server=utf8mb4_bin | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 8 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.scalar.db.storage.cassandra; | ||
|
||
import com.scalar.db.api.DistributedStorageJapaneseIntegrationTestBase; | ||
import java.util.Collections; | ||
import java.util.Map; | ||
import java.util.Properties; | ||
|
||
public class CassandraJapaneseIntegrationTest | ||
extends DistributedStorageJapaneseIntegrationTestBase { | ||
@Override | ||
protected Properties getProperties(String testName) { | ||
return CassandraEnv.getProperties(testName); | ||
} | ||
|
||
@Override | ||
protected Map<String, String> getCreationOptions() { | ||
return Collections.singletonMap(CassandraAdmin.REPLICATION_FACTOR, "1"); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.scalar.db.storage.cosmos; | ||
|
||
import com.scalar.db.api.DistributedStorageJapaneseIntegrationTestBase; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
import java.util.Properties; | ||
|
||
public class CosmosJapaneseIntegrationTest extends DistributedStorageJapaneseIntegrationTestBase { | ||
|
||
@Override | ||
protected Properties getProperties(String testName) { | ||
return CosmosEnv.getProperties(testName); | ||
} | ||
|
||
@Override | ||
protected String getNamespace() { | ||
String namespace = super.getNamespace(); | ||
Optional<String> databasePrefix = CosmosEnv.getDatabasePrefix(); | ||
return databasePrefix.map(prefix -> prefix + namespace).orElse(namespace); | ||
} | ||
|
||
@Override | ||
protected Map<String, String> getCreationOptions() { | ||
return CosmosEnv.getCreationOptions(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.scalar.db.storage.dynamo; | ||
|
||
import com.scalar.db.api.DistributedStorageJapaneseIntegrationTestBase; | ||
import java.util.Map; | ||
import java.util.Properties; | ||
|
||
public class DynamoJapaneseIntegrationTest extends DistributedStorageJapaneseIntegrationTestBase { | ||
|
||
@Override | ||
protected Properties getProperties(String testName) { | ||
return DynamoEnv.getProperties(testName); | ||
} | ||
|
||
@Override | ||
protected Map<String, String> getCreationOptions() { | ||
return DynamoEnv.getCreationOptions(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.scalar.db.storage.jdbc; | ||
|
||
import com.scalar.db.api.DistributedStorageJapaneseIntegrationTestBase; | ||
import java.util.Properties; | ||
|
||
public class JdbcDatabaseJapaneseIntegrationTest | ||
extends DistributedStorageJapaneseIntegrationTestBase { | ||
|
||
@Override | ||
protected Properties getProperties(String testName) { | ||
return JdbcEnv.getProperties(testName); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,16 +23,12 @@ class RdbEngineMysql implements RdbEngineStrategy { | |
|
||
@Override | ||
public String[] createSchemaSqls(String fullSchema) { | ||
return new String[] { | ||
"CREATE SCHEMA " + enclose(fullSchema) + " character set utf8 COLLATE utf8_bin" | ||
}; | ||
return new String[] {"CREATE SCHEMA " + enclose(fullSchema)}; | ||
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. Removed the hard-coded collation for MySQL. |
||
} | ||
|
||
@Override | ||
public String[] createSchemaIfNotExistsSqls(String schema) { | ||
return new String[] { | ||
"CREATE SCHEMA IF NOT EXISTS " + enclose(schema) + " character set utf8 COLLATE utf8_bin" | ||
}; | ||
return new String[] {"CREATE SCHEMA IF NOT EXISTS " + enclose(schema)}; | ||
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. Ditto. |
||
} | ||
|
||
@Override | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -176,7 +176,7 @@ public String getDataTypeForEngine(DataType scalarDbDataType) { | |
case INT: | ||
return "INT"; | ||
case TEXT: | ||
return "VARCHAR(8000) COLLATE Latin1_General_BIN"; | ||
return "VARCHAR(8000)"; | ||
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. Removed the hard-coded collation for SQL Server. |
||
default: | ||
throw new AssertionError(); | ||
} | ||
|
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.
Because we need to run MySQL with the collation-related parameters, we run
docker run
command here.