Compare commits
No commits in common. "a8a2ab1efb0efe03899c3763764987db912fbf46" and "cb91cc1569be728b240d586770d5c2f2cb549a88" have entirely different histories.
a8a2ab1efb
...
cb91cc1569
|
|
@ -347,11 +347,6 @@ add_test(NAME amduatd_graph_index_append_stress
|
||||||
)
|
)
|
||||||
set_tests_properties(amduatd_graph_index_append_stress PROPERTIES SKIP_RETURN_CODE 77)
|
set_tests_properties(amduatd_graph_index_append_stress PROPERTIES SKIP_RETURN_CODE 77)
|
||||||
|
|
||||||
add_test(NAME amduatd_index_two_nodes
|
|
||||||
COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/scripts/test_index_two_nodes.sh
|
|
||||||
)
|
|
||||||
set_tests_properties(amduatd_index_two_nodes PROPERTIES SKIP_RETURN_CODE 77)
|
|
||||||
|
|
||||||
add_executable(amduatd_test_space_doctor
|
add_executable(amduatd_test_space_doctor
|
||||||
tests/test_amduatd_space_doctor.c
|
tests/test_amduatd_space_doctor.c
|
||||||
src/amduatd_space_doctor.c
|
src/amduatd_space_doctor.c
|
||||||
|
|
|
||||||
|
|
@ -29,29 +29,8 @@ if [[ "${USE_HTTP_HELPER}" -eq 1 && ! -x "${HTTP_HELPER}" ]]; then
|
||||||
exit 77
|
exit 77
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AMDUATD_BIN="${AMDUATD_BIN:-}"
|
AMDUATD_BIN="${ROOT_DIR}/build/amduatd"
|
||||||
if [[ -z "${AMDUATD_BIN}" ]]; then
|
ASL_BIN="${ROOT_DIR}/vendor/amduat/build/amduat-asl"
|
||||||
for cand in \
|
|
||||||
"${ROOT_DIR}/build/amduatd" \
|
|
||||||
"${ROOT_DIR}/build-asan/amduatd"; do
|
|
||||||
if [[ -x "${cand}" ]]; then
|
|
||||||
AMDUATD_BIN="${cand}"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
ASL_BIN="${ASL_BIN:-}"
|
|
||||||
if [[ -z "${ASL_BIN}" ]]; then
|
|
||||||
for cand in \
|
|
||||||
"${ROOT_DIR}/build/vendor/amduat/amduat-asl" \
|
|
||||||
"${ROOT_DIR}/vendor/amduat/build/amduat-asl"; do
|
|
||||||
if [[ -x "${cand}" ]]; then
|
|
||||||
ASL_BIN="${cand}"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -x "${AMDUATD_BIN}" || ! -x "${ASL_BIN}" ]]; then
|
if [[ ! -x "${AMDUATD_BIN}" || ! -x "${ASL_BIN}" ]]; then
|
||||||
echo "missing binaries; build amduatd and amduat-asl first" >&2
|
echo "missing binaries; build amduatd and amduat-asl first" >&2
|
||||||
|
|
|
||||||
|
|
@ -29,29 +29,8 @@ if [[ "${USE_HTTP_HELPER}" -eq 1 && ! -x "${HTTP_HELPER}" ]]; then
|
||||||
exit 77
|
exit 77
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AMDUATD_BIN="${AMDUATD_BIN:-}"
|
AMDUATD_BIN="${ROOT_DIR}/build/amduatd"
|
||||||
if [[ -z "${AMDUATD_BIN}" ]]; then
|
ASL_BIN="${ROOT_DIR}/vendor/amduat/build/amduat-asl"
|
||||||
for cand in \
|
|
||||||
"${ROOT_DIR}/build/amduatd" \
|
|
||||||
"${ROOT_DIR}/build-asan/amduatd"; do
|
|
||||||
if [[ -x "${cand}" ]]; then
|
|
||||||
AMDUATD_BIN="${cand}"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
ASL_BIN="${ASL_BIN:-}"
|
|
||||||
if [[ -z "${ASL_BIN}" ]]; then
|
|
||||||
for cand in \
|
|
||||||
"${ROOT_DIR}/build/vendor/amduat/amduat-asl" \
|
|
||||||
"${ROOT_DIR}/vendor/amduat/build/amduat-asl"; do
|
|
||||||
if [[ -x "${cand}" ]]; then
|
|
||||||
ASL_BIN="${cand}"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -x "${AMDUATD_BIN}" || ! -x "${ASL_BIN}" ]]; then
|
if [[ ! -x "${AMDUATD_BIN}" || ! -x "${ASL_BIN}" ]]; then
|
||||||
echo "missing binaries; build amduatd and amduat-asl first" >&2
|
echo "missing binaries; build amduatd and amduat-asl first" >&2
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,7 @@ source "${ROOT_DIR}/scripts/graph_client_helpers.sh"
|
||||||
graph_helpers_init "${ROOT_DIR}"
|
graph_helpers_init "${ROOT_DIR}"
|
||||||
|
|
||||||
AMDUATD_BIN="${ROOT_DIR}/build/amduatd"
|
AMDUATD_BIN="${ROOT_DIR}/build/amduatd"
|
||||||
ASL_BIN="${ROOT_DIR}/build/vendor/amduat/amduat-asl"
|
|
||||||
if [[ ! -x "${ASL_BIN}" ]]; then
|
|
||||||
ASL_BIN="${ROOT_DIR}/vendor/amduat/build/amduat-asl"
|
ASL_BIN="${ROOT_DIR}/vendor/amduat/build/amduat-asl"
|
||||||
fi
|
|
||||||
if [[ ! -x "${AMDUATD_BIN}" || ! -x "${ASL_BIN}" ]]; then
|
if [[ ! -x "${AMDUATD_BIN}" || ! -x "${ASL_BIN}" ]]; then
|
||||||
echo "missing binaries; build amduatd and amduat-asl first" >&2
|
echo "missing binaries; build amduatd and amduat-asl first" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,7 @@ if [[ "${USE_HTTP_HELPER}" -eq 1 && ! -x "${HTTP_HELPER}" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AMDUATD_BIN="${ROOT_DIR}/build/amduatd"
|
AMDUATD_BIN="${ROOT_DIR}/build/amduatd"
|
||||||
ASL_BIN="${ROOT_DIR}/build/vendor/amduat/amduat-asl"
|
|
||||||
if [[ ! -x "${ASL_BIN}" ]]; then
|
|
||||||
ASL_BIN="${ROOT_DIR}/vendor/amduat/build/amduat-asl"
|
ASL_BIN="${ROOT_DIR}/vendor/amduat/build/amduat-asl"
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -x "${AMDUATD_BIN}" || ! -x "${ASL_BIN}" ]]; then
|
if [[ ! -x "${AMDUATD_BIN}" || ! -x "${ASL_BIN}" ]]; then
|
||||||
echo "missing binaries; build amduatd and amduat-asl first" >&2
|
echo "missing binaries; build amduatd and amduat-asl first" >&2
|
||||||
|
|
|
||||||
|
|
@ -1,112 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
||||||
TMPDIR="${TMPDIR:-/tmp}"
|
|
||||||
mkdir -p "${TMPDIR}"
|
|
||||||
|
|
||||||
AMDUATD_BIN="${ROOT_DIR}/build/amduatd"
|
|
||||||
ASL_BIN="${ROOT_DIR}/build/vendor/amduat/amduat-asl"
|
|
||||||
HTTP_HELPER="${ROOT_DIR}/build/amduatd_http_unix"
|
|
||||||
USE_HTTP_HELPER=0
|
|
||||||
|
|
||||||
if [[ ! -x "${AMDUATD_BIN}" || ! -x "${ASL_BIN}" ]]; then
|
|
||||||
echo "missing binaries; build amduatd and amduat-asl first" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if command -v curl >/dev/null 2>&1 && curl --help 2>/dev/null | grep -q -- '--unix-socket'; then
|
|
||||||
USE_HTTP_HELPER=0
|
|
||||||
else
|
|
||||||
USE_HTTP_HELPER=1
|
|
||||||
fi
|
|
||||||
if [[ "${USE_HTTP_HELPER}" -eq 1 && ! -x "${HTTP_HELPER}" ]]; then
|
|
||||||
echo "skip: curl lacks --unix-socket and helper missing" >&2
|
|
||||||
exit 77
|
|
||||||
fi
|
|
||||||
|
|
||||||
tmp_root="$(mktemp -d -p "${TMPDIR}" amduatd-index-two-nodes-XXXXXX)"
|
|
||||||
root="${tmp_root}/root"
|
|
||||||
sock="${tmp_root}/amduatd.sock"
|
|
||||||
space_id="app1"
|
|
||||||
log_file="${tmp_root}/amduatd.log"
|
|
||||||
|
|
||||||
cleanup() {
|
|
||||||
if [[ -n "${pid:-}" ]]; then
|
|
||||||
kill "${pid}" >/dev/null 2>&1 || true
|
|
||||||
wait "${pid}" >/dev/null 2>&1 || true
|
|
||||||
fi
|
|
||||||
rm -rf "${tmp_root}"
|
|
||||||
}
|
|
||||||
trap cleanup EXIT
|
|
||||||
|
|
||||||
wait_ready() {
|
|
||||||
local i
|
|
||||||
for i in $(seq 1 100); do
|
|
||||||
if ! kill -0 "${pid}" >/dev/null 2>&1; then
|
|
||||||
[[ -f "${log_file}" ]] && cat "${log_file}" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
if [[ ! -S "${sock}" ]]; then
|
|
||||||
sleep 0.1
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
if [[ "${USE_HTTP_HELPER}" -eq 1 ]]; then
|
|
||||||
if "${HTTP_HELPER}" --sock "${sock}" --method GET --path "/v2/readyz" >/dev/null 2>&1; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
elif curl --silent --show-error --fail --unix-socket "${sock}" \
|
|
||||||
"http://localhost/v2/readyz" >/dev/null 2>&1; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
sleep 0.1
|
|
||||||
done
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
post_node() {
|
|
||||||
local name="$1"
|
|
||||||
local payload="{\"name\":\"${name}\"}"
|
|
||||||
if [[ "${USE_HTTP_HELPER}" -eq 1 ]]; then
|
|
||||||
"${HTTP_HELPER}" --sock "${sock}" --method POST --path "/v2/graph/nodes" \
|
|
||||||
--header "Content-Type: application/json" \
|
|
||||||
--header "X-Amduat-Space: ${space_id}" \
|
|
||||||
--data "${payload}"
|
|
||||||
else
|
|
||||||
curl --silent --show-error --fail \
|
|
||||||
--unix-socket "${sock}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-H "X-Amduat-Space: ${space_id}" \
|
|
||||||
-X POST --data-binary "${payload}" \
|
|
||||||
"http://localhost/v2/graph/nodes"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
mkdir -p "${root}"
|
|
||||||
"${ASL_BIN}" index init --root "${root}" --force >/dev/null
|
|
||||||
|
|
||||||
"${AMDUATD_BIN}" --root "${root}" --sock "${sock}" --store-backend index --space "${space_id}" \
|
|
||||||
>"${log_file}" 2>&1 &
|
|
||||||
pid=$!
|
|
||||||
|
|
||||||
if ! wait_ready; then
|
|
||||||
echo "daemon not ready" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
resp1="$(post_node doca1)"
|
|
||||||
resp2="$(post_node topica1)"
|
|
||||||
|
|
||||||
echo "${resp1}" | grep -q '"name":"doca1"' || {
|
|
||||||
echo "first node write failed: ${resp1}" >&2
|
|
||||||
[[ -f "${log_file}" ]] && cat "${log_file}" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "${resp2}" | grep -q '"name":"topica1"' || {
|
|
||||||
echo "second node write failed: ${resp2}" >&2
|
|
||||||
[[ -f "${log_file}" ]] && cat "${log_file}" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "ok: two consecutive index-backed node writes succeeded"
|
|
||||||
2
vendor/amduat
vendored
2
vendor/amduat
vendored
|
|
@ -1 +1 @@
|
||||||
Subproject commit 03d970c576c17d197900840e1e0e365b03db1058
|
Subproject commit 9a2903072bd10b2bc09dd082681cc7c026bf9350
|
||||||
Loading…
Reference in a new issue