Skip to content

Commit

Permalink
chore: change the driver
Browse files Browse the repository at this point in the history
  • Loading branch information
fengluodb committed Apr 29, 2024
1 parent 3fca5dc commit 798c7aa
Show file tree
Hide file tree
Showing 17 changed files with 24 additions and 38 deletions.
2 changes: 1 addition & 1 deletion api/v1alpha1/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type ResourceList struct {
type Target struct {
// the driver represents the database type
// +optional
// +kubebuilder:validation:Enum={mysql,postgresql,mongodb,redis,oceanbase,oracle}
// +kubebuilder:validation:Enum={mysql,postgresql,mongodb,redis,oceanbase-oracle}
Driver string `json:"driver,omitempty"`

// The database server's host name
Expand Down
3 changes: 1 addition & 2 deletions config/crd/bases/benchmark.apecloud.io_pgbenches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ spec:
- postgresql
- mongodb
- redis
- oceanbase
- oracle
- oceanbase-oracle
type: string
host:
type: string
Expand Down
3 changes: 1 addition & 2 deletions config/crd/bases/benchmark.apecloud.io_redisbenches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ spec:
- postgresql
- mongodb
- redis
- oceanbase
- oracle
- oceanbase-oracle
type: string
host:
type: string
Expand Down
3 changes: 1 addition & 2 deletions config/crd/bases/benchmark.apecloud.io_sysbenches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ spec:
- postgresql
- mongodb
- redis
- oceanbase
- oracle
- oceanbase-oracle
type: string
host:
type: string
Expand Down
3 changes: 1 addition & 2 deletions config/crd/bases/benchmark.apecloud.io_tpccs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ spec:
- postgresql
- mongodb
- redis
- oceanbase
- oracle
- oceanbase-oracle
type: string
host:
type: string
Expand Down
3 changes: 1 addition & 2 deletions config/crd/bases/benchmark.apecloud.io_tpcds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ spec:
- postgresql
- mongodb
- redis
- oceanbase
- oracle
- oceanbase-oracle
type: string
host:
type: string
Expand Down
3 changes: 1 addition & 2 deletions config/crd/bases/benchmark.apecloud.io_tpches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ spec:
- postgresql
- mongodb
- redis
- oceanbase
- oracle
- oceanbase-oracle
type: string
host:
type: string
Expand Down
3 changes: 1 addition & 2 deletions config/crd/bases/benchmark.apecloud.io_ycsbs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ spec:
- postgresql
- mongodb
- redis
- oceanbase
- oracle
- oceanbase-oracle
type: string
host:
type: string
Expand Down
3 changes: 1 addition & 2 deletions deploy/helm/crds/benchmark.apecloud.io_pgbenches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ spec:
- postgresql
- mongodb
- redis
- oceanbase
- oracle
- oceanbase-oracle
type: string
host:
type: string
Expand Down
3 changes: 1 addition & 2 deletions deploy/helm/crds/benchmark.apecloud.io_redisbenches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ spec:
- postgresql
- mongodb
- redis
- oceanbase
- oracle
- oceanbase-oracle
type: string
host:
type: string
Expand Down
3 changes: 1 addition & 2 deletions deploy/helm/crds/benchmark.apecloud.io_sysbenches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ spec:
- postgresql
- mongodb
- redis
- oceanbase
- oracle
- oceanbase-oracle
type: string
host:
type: string
Expand Down
3 changes: 1 addition & 2 deletions deploy/helm/crds/benchmark.apecloud.io_tpccs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ spec:
- postgresql
- mongodb
- redis
- oceanbase
- oracle
- oceanbase-oracle
type: string
host:
type: string
Expand Down
3 changes: 1 addition & 2 deletions deploy/helm/crds/benchmark.apecloud.io_tpcds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ spec:
- postgresql
- mongodb
- redis
- oceanbase
- oracle
- oceanbase-oracle
type: string
host:
type: string
Expand Down
3 changes: 1 addition & 2 deletions deploy/helm/crds/benchmark.apecloud.io_tpches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ spec:
- postgresql
- mongodb
- redis
- oceanbase
- oracle
- oceanbase-oracle
type: string
host:
type: string
Expand Down
3 changes: 1 addition & 2 deletions deploy/helm/crds/benchmark.apecloud.io_ycsbs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ spec:
- postgresql
- mongodb
- redis
- oceanbase
- oracle
- oceanbase-oracle
type: string
host:
type: string
Expand Down
8 changes: 4 additions & 4 deletions internal/controller/tpcc_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ func NewTpccWorkLoadParams(cr *v1alpha1.Tpcc) string {
return NewTpccMysqlParams(cr)
case constants.PostgreSqlDriver:
return NewTpccPostgresParams(cr)
case constants.OceanBaseDriver:
return NewOceanBaseParams(cr)
case constants.OceanBaseOracleTenantDriver:
return NewOceanBaseOracleTenantParams(cr)
default:
return ""
}
Expand All @@ -169,7 +169,7 @@ func NewTpccPostgresParams(cr *v1alpha1.Tpcc) string {
return result
}

func NewOceanBaseParams(cr *v1alpha1.Tpcc) string {
func NewOceanBaseOracleTenantParams(cr *v1alpha1.Tpcc) string {
result := fmt.Sprintf("--driver %s", "com.alipay.oceanbase.obproxy.mysql.jdbc.Driver")
result = fmt.Sprintf("%s --conn \"jdbc:oceanbase://%s:%d/%s?useUnicode=true&characterEncoding=utf-8\"", result, cr.Spec.Target.Host, cr.Spec.Target.Port, cr.Spec.Target.Database)
return result
Expand All @@ -195,7 +195,7 @@ func getTpccDriver(driver string) string {
return "mysql"
case constants.PostgreSqlDriver:
return "postgres"
case constants.OceanBaseDriver:
case constants.OceanBaseOracleTenantDriver:
// for oceanbase oracle tenant
return "oracle"
default:
Expand Down
10 changes: 5 additions & 5 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ const (
)

const (
MySqlDriver = "mysql"
PostgreSqlDriver = "postgresql"
MongoDbDriver = "mongodb"
RedisDriver = "redis"
OceanBaseDriver = "oceanbase"
MySqlDriver = "mysql"
PostgreSqlDriver = "postgresql"
MongoDbDriver = "mongodb"
RedisDriver = "redis"
OceanBaseOracleTenantDriver = "oceanbase-oracle"
)

const (
Expand Down

0 comments on commit 798c7aa

Please sign in to comment.