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

main,modes: add extra CQL clause option #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ var (

measureLatency bool
validateData bool

extraClause string
)

const (
Expand Down Expand Up @@ -251,6 +253,7 @@ func main() {

flag.BoolVar(&measureLatency, "measure-latency", true, "measure request latency")
flag.BoolVar(&validateData, "validate-data", false, "write meaningful data and validate while reading")
flag.StringVar(&extraClause, "extra-clause", "", "extra CQL clause to be appended to the end of used statements")

var startTimestamp int64
flag.Int64Var(&writeRate, "write-rate", 0, "rate of writes (relevant only for time series reads)")
Expand Down
7 changes: 4 additions & 3 deletions modes.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ func ValidateData(pk int64, ck int64, data []byte) error {
}

func DoWrites(session *gocql.Session, resultChannel chan Result, workload WorkloadGenerator, rateLimiter RateLimiter) {
query := session.Query("INSERT INTO " + keyspaceName + "." + tableName + " (pk, ck, v) VALUES (?, ?, ?)")
query := session.Query("INSERT INTO " + keyspaceName + "." + tableName + " (pk, ck, v) VALUES (?, ?, ?) " + extraClause)

RunTest(resultChannel, workload, rateLimiter, func(rb *ResultBuilder) (error, time.Duration) {
pk := workload.NextPartitionKey()
Expand Down Expand Up @@ -466,7 +466,7 @@ func DoBatchedWrites(session *gocql.Session, resultChannel chan Result, workload

func DoCounterUpdates(session *gocql.Session, resultChannel chan Result, workload WorkloadGenerator, rateLimiter RateLimiter) {
query := session.Query("UPDATE " + keyspaceName + "." + counterTableName +
" SET c1 = c1 + ?, c2 = c2 + ?, c3 = c3 + ?, c4 = c4 + ?, c5 = c5 + ? WHERE pk = ? AND ck = ?")
" " + extraClause + " SET c1 = c1 + ?, c2 = c2 + ?, c3 = c3 + ?, c4 = c4 + ?, c5 = c5 + ? WHERE pk = ? AND ck = ?")

RunTest(resultChannel, workload, rateLimiter, func(rb *ResultBuilder) (error, time.Duration) {
pk := workload.NextPartitionKey()
Expand Down Expand Up @@ -511,6 +511,7 @@ func DoReadsFromTable(table string, session *gocql.Session, resultChannel chan R
} else {
request = fmt.Sprintf("SELECT * FROM %s.%s WHERE pk = ? AND ck >= ? LIMIT %d", keyspaceName, table, rowsPerRequest)
}
request += " " + extraClause
query := session.Query(request)

RunTest(resultChannel, workload, rateLimiter, func(rb *ResultBuilder) (error, time.Duration) {
Expand Down Expand Up @@ -588,7 +589,7 @@ func DoReadsFromTable(table string, session *gocql.Session, resultChannel chan R
}

func DoScanTable(session *gocql.Session, resultChannel chan Result, workload WorkloadGenerator, rateLimiter RateLimiter) {
request := fmt.Sprintf("SELECT * FROM %s.%s WHERE token(pk) >= ? AND token(pk) <= ?", keyspaceName, tableName)
request := fmt.Sprintf("SELECT * FROM %s.%s WHERE token(pk) >= ? AND token(pk) <= ? %s", keyspaceName, tableName, extraClause)
query := session.Query(request)

RunTest(resultChannel, workload, rateLimiter, func(rb *ResultBuilder) (error, time.Duration) {
Expand Down