-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created new workload for table scans. Need to do additional work to m…
…ake it error out nicely
- Loading branch information
1 parent
272cee4
commit a4f1b2c
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/kotlin/com/rustyrazorblade/easycassstress/profiles/TableScan.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
} | ||
|
||
} | ||
} | ||
|
||
} |