-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcrash-things.sh
More file actions
executable file
·67 lines (53 loc) · 1.36 KB
/
crash-things.sh
File metadata and controls
executable file
·67 lines (53 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
set -e
QDRANT_DIR=${1:-./qdrant/}
QDRANT_EXEC=${2:-target/debug/qdrant}
CRASH_PROBABILITY=${3:-0.3}
RUN_TIME=${4:-300}
POINTS_COUNT=${5:-5000}
QDRANT_BACKUP_DIR=${6:?backup directory is required}
CRASHER_LOG=crasher.log
QDRANT_LOG=../qdrant.log
CRASHER_CMD=(
cargo run --release
--
--working-dir "$QDRANT_DIR"
--storage-backup $QDRANT_BACKUP_DIR
--exec-path "$QDRANT_EXEC"
--crash-probability "$CRASH_PROBABILITY"
--points-count "$POINTS_COUNT"
--async-io
)
echo "${CRASHER_CMD[*]}"
QDRANT__LOGGER__ON_DISK__ENABLED=true \
QDRANT__LOGGER__ON_DISK__LOG_FILE=$QDRANT_LOG \
QDRANT__SERVICE__HARDWARE_REPORTING=true \
QDRANT__STORAGE__COLLECTION_STRICT_MODE=true \
QDRANT__FEATURE_FLAGS__ALL=true \
QDRANT__LOG_LEVEL="TRACE,raft::raft=info,actix_http=info,tonic=info,want=info,mio=info" \
"${CRASHER_CMD[@]}" &>"$CRASHER_LOG" &
pid=$!
echo "The PID is $pid"
function cleanup() {
if ps -p $pid >/dev/null
then
kill -KILL $pid
fi
}
trap cleanup EXIT
trap 'exit $?' ERR
trap exit INT
started=$(date +%s)
while ps -p $pid >/dev/null && (( $(date +%s) - started < RUN_TIME ))
do
sleep 10
done
if ps -p $pid >/dev/null
then
echo "The process is still running. Stopping the process..."
kill $pid
echo "OK"
else
echo "The process has unexpectedly terminated on its own. Check the logs."
exit 1
fi