mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-11-28 13:44:03 +00:00
ci: fail a durable pinned crash cycle unless its pin row survives once
The pinned cell's one row is acknowledged before the writers start, so the oracle now fails a durable cycle whose pin table does not hold exactly that row after the restart, and any cycle that holds it twice. Signed-off-by: jeremyhi <fengjiachun@gmail.com>
This commit is contained in:
@@ -195,6 +195,7 @@ def main() -> int:
|
||||
c.add_argument("--mode", choices=("durable", "enqueued"), required=True)
|
||||
for name in ("writers", "rows", "before-ns", "after-ns", "window-max-ms"):
|
||||
c.add_argument(f"--{name}", type=int, required=True)
|
||||
c.add_argument("--pin-rows", type=int, help="rows of the pin table, whose one row was acknowledged first")
|
||||
args = parser.parse_args()
|
||||
if args.command == "write":
|
||||
return write(args)
|
||||
@@ -204,6 +205,8 @@ def main() -> int:
|
||||
args.window_max_ms)
|
||||
result |= verify(args.run_dir, {int(seq): int(count) for seq, count in rows}, args.rows,
|
||||
args.mode == "enqueued", args.cycle)
|
||||
if args.pin_rows is not None and (args.pin_rows > 1 or args.mode == "durable" and args.pin_rows != 1):
|
||||
result["verify_errors"].append(f"the pin table holds {args.pin_rows} rows, not 1")
|
||||
result["passed"] = not result["kill_errors"] and not result["verify_errors"]
|
||||
print(json.dumps(result))
|
||||
return 0 if result["passed"] else 1
|
||||
|
||||
@@ -171,7 +171,7 @@ sample_objects() {
|
||||
# server; it restarts on the same prefix and data home and the table is checked
|
||||
# against what was acknowledged. Nothing is cleaned between cycles.
|
||||
crash_cycles() {
|
||||
local writers rows cycles kill_min kill_max cycle cdir wpid spid= delay before after started restart_s query_s next=0 pin_count
|
||||
local writers rows cycles kill_min kill_max cycle cdir wpid spid= delay before after started restart_s query_s next=0 pin_count pin_args
|
||||
local load_start complete sql_url=${OSWAL_SQL_URL:-http://127.0.0.1:4000/v1/sql?db=public}
|
||||
writers=$(jq -r .concurrency <<< "$spec") rows=$(jq -r .batch_rows "$PLAN") cycles=$(jq -r .cycles <<< "$spec")
|
||||
kill_min=$(jq -r '.kill_after[0]' <<< "$spec") kill_max=$(jq -r '.kill_after[1]' <<< "$spec")
|
||||
@@ -205,14 +205,15 @@ crash_cycles() {
|
||||
done
|
||||
query_s=$(elapsed "$started")
|
||||
scrape_retry recovery_seconds_count || complete=false
|
||||
pin_count=null
|
||||
pin_count=null pin_args=()
|
||||
if jq -e .pin <<< "$spec" >/dev/null; then
|
||||
pin_count=$(sql "SELECT count(*) FROM pin" | jq -er '.output[0].records.rows[0][0]')
|
||||
pin_count=$(sql "SELECT count(*) FROM pin" | jq -er '.output[0].records.rows[0][0]') pin_args=(--pin-rows "$pin_count")
|
||||
fi
|
||||
local verdict=0
|
||||
python3 "$here/oswal-s3-bench-crash.py" check --run-dir "$dir" --cycle "$cycle" --found "$cdir/found.json" \
|
||||
--mode "$(jq -r .wal.ACK_MODE <<< "$spec")" --writers "$writers" --rows "$rows" \
|
||||
--before-ns "$before" --after-ns "$after" --window-max-ms 2000 > "$cdir/check.json" || verdict=$?
|
||||
--before-ns "$before" --after-ns "$after" --window-max-ms 2000 ${pin_args[@]+"${pin_args[@]}"} \
|
||||
> "$cdir/check.json" || verdict=$?
|
||||
jq -c --arg delay "$delay" --arg restart "$restart_s" --arg query "$query_s" --argjson pin "$pin_count" \
|
||||
--argjson load "$(awk -v a="$load_start" -v b="$before" 'BEGIN {printf "%.3f", (b - a) / 1e9}')" \
|
||||
--argjson complete "$complete" \
|
||||
|
||||
Reference in New Issue
Block a user