Skip to content

table name is confused if both flags and property file set it #245

@sillydong

Description

@sillydong

Code

From function initialGlobal, we can see that global tableName variable is get from property file with field name table if it is empty
image
but in initClientCommand, there is a flag setting the global tableName variable, so when we set it in cmd flags, it will always has value when it goes into intialGlobal and check its length
image
and in all db implementations, they are using tableName from property file, take mysql as an example
image

Debug

./go-ycsb load mysql -P "my.properties,workloads/workloada" --table ddd --target 100 --threads 5

in workloads/workloada

table=ccc

global variable in main.go
image
variable in db implementation mysql
image

we can see they are different

More

By digging deeper, I found that the DB field defined in prop.go is not used anywhere. The db implementations are using dbName from global variable and is set by command flag, in the mean time, we can see that the real tableName takes effect is from property file, the different ways we set these two associated variables make user confuse.

Suggestion

We should make it clean and unique, either we set these two variables by cmd flags, or by property file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions