Skip to content

Commit

Permalink
Created new workload for table scans. Need to do additional work to m…
Browse files Browse the repository at this point in the history
…ake it error out nicely
  • Loading branch information
rustyrazorblade committed May 3, 2024
1 parent 272cee4 commit a4f1b2c
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class ProfileRunner(val context: StressContext,
else {
readRate = profile.getDefaultReadRate()
}

// check unsupported operations
}

val deleteRate: Double
Expand Down Expand Up @@ -93,6 +95,7 @@ class ProfileRunner(val context: StressContext,
// create a semaphore local to the thread to limit the query concurrency
val runner = profile.getRunner(context)


// we use MAX_VALUE since it's essentially infinite if we give a duration
val totalValues = if (duration > 0) Long.MAX_VALUE else iterations

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.rustyrazorblade.easycassstress.profiles

import com.datastax.driver.core.PreparedStatement
import com.datastax.driver.core.Session
import com.rustyrazorblade.easycassstress.PartitionKey
import com.rustyrazorblade.easycassstress.StressContext
import com.rustyrazorblade.easycassstress.WorkloadParameter

/**
* this is a bit of an oddball workout because it doesn't support writes.
*/

class TableScan : IStressProfile {
@WorkloadParameter("Table to perform full scan against. Does not support writes of any kind.")
var table = "system.local"

lateinit var select: PreparedStatement
override fun prepare(session: Session) {
select = session.prepare("SELECT * from $table")
}

override fun schema(): List<String> {
return listOf()
}
override fun getDefaultReadRate(): Double {
return 1.0
}
override fun getRunner(context: StressContext): IStressRunner {
return object : IStressRunner {
override fun getNextMutation(partitionKey: PartitionKey): Operation {
// we need the ability to say a workload doesn't support mutations
TODO("Not yet implemented")
}

override fun getNextSelect(partitionKey: PartitionKey): Operation {
return Operation.SelectStatement(select.bind())
}

override fun getNextDelete(partitionKey: PartitionKey): Operation {
// we need the ability to say a workload doesn't support deletes
TODO("Not yet implemented")
}

}
}

}

0 comments on commit a4f1b2c

Please sign in to comment.