Skip to content

Commit d496ac7

Browse files
more robust error handling
1 parent 2ee29a7 commit d496ac7

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@ The environment executing this test must have the associated cloud vendor CLI se
6565

6666
You can also test the [cache](https://code.kx.com/insights/1.4/core/objstor/kxreaper.html) impact of the object storage library. The recommended way is to
6767
* provide an object storage path in `partitions`
68-
* run a full test to populate data: `./mthread.sh $(nproc) full keep`. Take note of the data location postfix (`0509D1529` in our case)
68+
* `DATE=$(date +%m%d_%H%M%S)`
69+
* run a full test to populate data: `./mthread.sh $(nproc) full keep $DATE`.
6970
* assign an empty directory on a fast local disk to the environment variable `KX_OBJSTR_CACHE_PATH` in file `./config/env`
70-
* run the test to populate cache: `./mthread.sh $(nproc) readonly keep 0509D1529`
71-
* run the test again to use cache: `./mthread.sh $(nproc) readonly delete 0509D1529`
71+
* run the test to populate cache: `./mthread.sh $(nproc) readonly keep $DATE`
72+
* run the test again to use cache: `./mthread.sh $(nproc) readonly delete $DATE`
7273
* delete cache files in object storage cache: `source ./config/env; rm -rf ${KX_OBJSTR_CACHE_PATH}/objects`
7374

7475
The random read kdb+ script is deterministic, i.e. it reads the same blocks in consecutive runs. The script uses [roll](https://code.kx.com/q/ref/deal/#roll-and-deal) for selecting random blocks which uses a fixed seed.

mthread.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,21 @@ declare -a array
5959
array=($(cat $PARFILE))
6060
readonly NUMSEGS=${#array[@]}
6161

62+
if [ $SCOPE = "readonly" ]; then
63+
if ! [ "$#" -eq "4" ]; then
64+
echo "Passing a date (4th) parameter is mandatory in readonly mode to locate previously generated data files"
65+
exit 5
66+
fi
67+
j=0
68+
for i in $(seq $NUMPROCESSES); do
69+
if ! [ -d ${array[$j]}/${HOST}.${i}/${DATE} ]; then
70+
echo "Data directory ${array[$j]}/${HOST}.${i}/${DATE} does not exits. Mode readonly assumes that data has been generated previously."
71+
exit 6
72+
fi
73+
j=$(( ($j + 1) % $NUMSEGS ))
74+
done
75+
fi
76+
6277
readonly RESDIR="${RESULTDIR}/${DATE}"
6378
mkdir -p ${RESDIR}
6479
echo "Results will be persisted in ${RESDIR}"
@@ -163,7 +178,7 @@ trap cleanup EXIT
163178
j=0
164179
for i in $(seq $NUMPROCESSES); do
165180
if notObjStore ${array[$j]}; then
166-
if [ -d ${array[$j]}/${HOST}.${i} ]; then
181+
if [ $SCOPE = "full" ] && [ -d ${array[$j]}/${HOST}.${i} ]; then
167182
echo "${array[$j]}/${HOST}.${i} directory already exists. Please remove it and rerun."
168183
exit 7
169184
fi

src/controller.q

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ getKBRead: $[.z.o ~ `m64; getKBReadMac; getKBReadLinux]
3131

3232
finish: {[x:`j]
3333
.qlog.info "Sending exit message to workers";
34-
@[; "exit 0"; ::] each Workers;
34+
@[; "exit ", string x; ::] each Workers;
3535
exit x
3636
}
3737

version.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pub: 3.4.0
2-
dev: 3.4.0
1+
pub: 3.4.1
2+
dev: 3.4.1

0 commit comments

Comments
 (0)