<commit_before>#!/bin/sh

set -x

CAPI=capisim
CASSANDRA=cassandra

# setup
cp $CAPI/capiblock.jar $CASSANDRA/lib/
cp dist/*.jar $CASSANDRA/lib/
cp conf/* $CASSANDRA/conf/
if [ -f $CASSANDRA/lib/jna-4.0.0.jar ]; then mv $CASSANDRA/lib/jna-4.0.0.jar $CASSANDRA/lib/jna-4.0.0.jar.bak; fi
cp lib/jna*.jar $CASSANDRA/lib/

# kill if Cassandra daemon exists
ps aux | grep java | grep CassandraDaemon | awk '{print $2}' | xargs kill 2> /dev/null

# clear cassandra data
rm -rf $CASSANDRA/data/

# clear capisim file
rm /tmp/test.txt

# start Cassandra
rm -rf $CASSANDRA/logs
if [ `whoami` = "root" ]; then
  JVM_OPTS="-Dcapi.hash=org.apache.cassandra.cache.capi.YCSBKeyHashFunction" $CASSANDRA/bin/cassandra -R
else
  JVM_OPTS="-Dcapi.hash=org.apache.cassandra.cache.capi.YCSBKeyHashFunction" $CASSANDRA/bin/cassandra
fi

while true; do
  sleep 1
  HIT=`cat $CASSANDRA/logs/system.log | grep "Starting listening for CQL clients"`
  if [ "$HIT" = "" ]; then continue; fi
  break
done

$CASSANDRA/bin/cqlsh << EOF
create keyspace ycsb WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor': 1 };
USE ycsb;
create table usertable (
    y_id varchar primary key,
    field0 varchar,
    field1 varchar,
    field2 varchar,
    field3 varchar,
    field4 varchar,
    field5 varchar,
    field6 varchar,
    field7 varchar,
    field8 varchar,
    field9 varchar)
    with caching = { 'keys' : 'NONE', 'rows_per_partition' : 'ALL' };
exit
EOF

cd YCSB
bin/ycsb load cassandra2-cql -P workloads/workloadc -p operationcount=1000000000 -p recordcount=10000 -p fieldcount=10 -p fieldlength=100 -p requestdistribution=uniform -p hosts=localhost -threads 1 -s
bin/ycsb run cassandra2-cql -P workloads/workloadc -p operationcount=1000000000 -p recordcount=10000 -p fieldcount=10 -p fieldlength=100 -p requestdistribution=uniform -p hosts=localhost -threads 1 -s<commit_msg>set max execution time for test run<commit_after>#!/bin/sh

set -x

CAPI=capisim
CASSANDRA=cassandra

# setup
cp $CAPI/capiblock.jar $CASSANDRA/lib/
cp dist/*.jar $CASSANDRA/lib/
cp conf/* $CASSANDRA/conf/
if [ -f $CASSANDRA/lib/jna-4.0.0.jar ]; then mv $CASSANDRA/lib/jna-4.0.0.jar $CASSANDRA/lib/jna-4.0.0.jar.bak; fi
cp lib/jna*.jar $CASSANDRA/lib/

# kill if Cassandra daemon exists
ps aux | grep java | grep CassandraDaemon | awk '{print $2}' | xargs kill 2> /dev/null

# clear cassandra data
rm -rf $CASSANDRA/data/

# clear capisim file
rm /tmp/test.txt

# start Cassandra
rm -rf $CASSANDRA/logs
if [ `whoami` = "root" ]; then
  JVM_OPTS="-Dcapi.hash=org.apache.cassandra.cache.capi.YCSBKeyHashFunction" $CASSANDRA/bin/cassandra -R
else
  JVM_OPTS="-Dcapi.hash=org.apache.cassandra.cache.capi.YCSBKeyHashFunction" $CASSANDRA/bin/cassandra
fi

while true; do
  sleep 1
  HIT=`cat $CASSANDRA/logs/system.log | grep "Starting listening for CQL clients"`
  if [ "$HIT" = "" ]; then continue; fi
  break
done

$CASSANDRA/bin/cqlsh << EOF
create keyspace ycsb WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor': 1 };
USE ycsb;
create table usertable (
    y_id varchar primary key,
    field0 varchar,
    field1 varchar,
    field2 varchar,
    field3 varchar,
    field4 varchar,
    field5 varchar,
    field6 varchar,
    field7 varchar,
    field8 varchar,
    field9 varchar)
    with caching = { 'keys' : 'NONE', 'rows_per_partition' : 'ALL' };
exit
EOF

cd YCSB
bin/ycsb load cassandra2-cql -P workloads/workloadc -p operationcount=1000000000 -p recordcount=10000 -p fieldcount=10 -p fieldlength=100 -p requestdistribution=uniform -p hosts=localhost -threads 1 -s
bin/ycsb run cassandra2-cql -P workloads/workloadc -p maxexecutiontime=180 -p operationcount=1000000000 -p recordcount=10000 -p fieldcount=10 -p fieldlength=100 -p requestdistribution=uniform -p hosts=localhost -threads 1 -s
{'fraction_non_alphanumeric': 0.12050739957716702, 'fraction_numerical': 0.03620507399577167, 'mean_word_length': 3.9802631578947367, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4271154', 'n_tokens_mistral': 1581, 'n_tokens_neox': 1463, 'n_words': 369}