Skip to content

Instantly share code, notes, and snippets.

@bdeggleston
Created February 2, 2016 23:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bdeggleston/324f4f0df1b7273d8fd5 to your computer and use it in GitHub Desktop.
Save bdeggleston/324f4f0df1b7273d8fd5 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# start C* before hand
echo "creating table"
echo "CREATE KEYSPACE IF NOT EXISTS ks WITH replication = {'class':'SimpleStrategy', 'replication_factor': 1 } ;" | bin/cqlsh
echo "CREATE TABLE IF NOT EXISTS ks.tbl (k int PRIMARY KEY , v timestamp) WITH COMPACTION = {'class':'DateTieredCompactionStrategy'};" | bin/cqlsh
echo "inserting data"
echo "INSERT INTO ks.tbl (k, v) VALUES (1, dateof(fc9f4b19-c09c-11e5-b433-fa163e77a2b6));" | bin/cqlsh
bin/nodetool flush ks tbl
echo "INSERT INTO ks.tbl (k, v) VALUES (2, dateof(fca767a8-c09c-11e5-a623-fa163e77a2b6));" | bin/cqlsh
bin/nodetool flush ks tbl
echo "INSERT INTO ks.tbl (k, v) VALUES (3, dateof(fca7dcba-c09c-11e5-9813-fa163e77a2b6));" | bin/cqlsh
bin/nodetool flush ks tbl
tree data/data/ks
echo "Kill C*, then press enter"
read
TABLE_DIR=`ls data/data/ks`
echo "TABLE_DIR: -$TABLE_DIR-"
# kill C*
# verify sstables are not repaired
tools/bin/sstablemetadata data/data/ks/$TABLE_DIR/ma-1-big-Data.db | head -n 13
tools/bin/sstablemetadata data/data/ks/$TABLE_DIR/ma-2-big-Data.db | head -n 13
tools/bin/sstablemetadata data/data/ks/$TABLE_DIR/ma-3-big-Data.db | head -n 13
# set first table repaired and verify
tools/bin/sstablerepairedset --really-set --is-repaired data/data/ks/$TABLE_DIR/ma-1-big-Data.db
tools/bin/sstablemetadata data/data/ks/$TABLE_DIR/ma-1-big-Data.db | head -n 13
# start C* again
echo "Start C*, then press enter"
read
# compact this table
bin/nodetool compact
tree data/data/ks
tools/bin/sstablemetadata data/data/ks/$TABLE_DIR/ma-4-big-Data.db | head -n 13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment