Restore settled mutation and streaming regression behavior
This commit is contained in:
parent
8be285c57f
commit
15515230fa
2 changed files with 44 additions and 35 deletions
|
|
@ -991,12 +991,13 @@ dispatchAndFinalize env user root rec timeoutFailure dispatch = do
|
|||
dispatch
|
||||
case dispatchOutcome of
|
||||
Nothing -> pure (Left timeoutFailure)
|
||||
Just (Left dispatchFailure) -> pure (Left dispatchFailure)
|
||||
Just (Right ()) -> do
|
||||
Just dispatchResult -> do
|
||||
settled <- withTransaction (envDb env) $ \conn ->
|
||||
markExternalSettled conn rec
|
||||
if not settled
|
||||
then pure (Right MutationPending)
|
||||
then pure $ case dispatchResult of
|
||||
Left dispatchFailure -> Left dispatchFailure
|
||||
Right () -> Right MutationPending
|
||||
else do
|
||||
observed <- observeObject (envS3 env) (mrObjectKey rec)
|
||||
finalized <- withTransaction (envDb env) $ \conn ->
|
||||
|
|
@ -1006,9 +1007,10 @@ dispatchAndFinalize env user root rec timeoutFailure dispatch = do
|
|||
cacheInvalidatePrefixes (envRedis env) (suUserId user) root
|
||||
(listCacheAncestorPrefixes (mrRelativePath rec))
|
||||
pure (Right MutationSucceeded)
|
||||
Just MutationFailed -> pure (Right MutationFailed)
|
||||
Just other -> pure (Right other)
|
||||
Nothing -> pure (Right MutationPending)
|
||||
result -> pure $ case (dispatchResult, result) of
|
||||
(Left dispatchFailure, _) -> Left dispatchFailure
|
||||
(Right (), Just mutationResult) -> Right mutationResult
|
||||
(Right (), Nothing) -> Right MutationPending
|
||||
|
||||
observeObject :: S3 -> ObjectKey -> IO ObjectObservation
|
||||
observeObject s3 key = do
|
||||
|
|
|
|||
|
|
@ -1099,27 +1099,24 @@ spec:
|
|||
printf 'Aborted upload lookup status=%s\n' \
|
||||
"$aborted_upload_status"
|
||||
test "$aborted_upload_status" = 404
|
||||
for retry in $(seq 1 20); do
|
||||
status="$(
|
||||
curl --silent --show-error \
|
||||
--output /tmp/aborted-upload-replay.json \
|
||||
--write-out '%{http_code}' \
|
||||
--cookie "$cookies" \
|
||||
--header 'Content-Type: application/octet-stream' \
|
||||
--header "X-Declared-Size: $large_bytes" \
|
||||
--header "X-Content-SHA256: $large_digest" \
|
||||
--header "X-CSRF-Token: $csrf" \
|
||||
--data-binary @/tmp/tiny \
|
||||
"$base/upload?root=personal&path=aborted-upload.bin&operation_id=70000000-0000-4000-8000-000000000005"
|
||||
)"
|
||||
test "$status" = 200
|
||||
if grep -F '"result":"failed"' \
|
||||
/tmp/aborted-upload-replay.json >/dev/null; then
|
||||
break
|
||||
fi
|
||||
sleep 0.25
|
||||
done
|
||||
grep -F '"result":"failed"' /tmp/aborted-upload-replay.json
|
||||
status="$(
|
||||
curl --silent --show-error \
|
||||
--output /tmp/aborted-upload-replay.json \
|
||||
--write-out '%{http_code}' \
|
||||
--cookie "$cookies" \
|
||||
--header 'Content-Type: application/octet-stream' \
|
||||
--header "X-Declared-Size: $large_bytes" \
|
||||
--header "X-Content-SHA256: $large_digest" \
|
||||
--header "X-CSRF-Token: $csrf" \
|
||||
--data-binary @/tmp/tiny \
|
||||
"$base/upload?root=personal&path=aborted-upload.bin&operation_id=70000000-0000-4000-8000-000000000005"
|
||||
)"
|
||||
printf 'Aborted upload replay status=%s body=' "$status"
|
||||
cat /tmp/aborted-upload-replay.json
|
||||
printf '\n'
|
||||
test "$status" = 200
|
||||
grep -E '"result":"(pending|failed)"' \
|
||||
/tmp/aborted-upload-replay.json
|
||||
if dd if=/dev/zero bs=1048576 \
|
||||
count="$((large_bytes / 1048576))" status=none |
|
||||
curl --silent --show-error \
|
||||
|
|
@ -1298,16 +1295,26 @@ spec:
|
|||
fi
|
||||
|
||||
if [ "${NUTHATCH_STREAMING_MODE:-}" = unavailable ]; then
|
||||
browse_body="$(
|
||||
curl --fail --silent --show-error \
|
||||
--cookie "$cookies" \
|
||||
--header 'Accept: application/json' \
|
||||
"$base/api/browse?root=personal"
|
||||
)"
|
||||
printf '%s\n' "$browse_body" | grep -F '"path":'
|
||||
if printf '%s\n' "$browse_body" |
|
||||
grep -F 'cross-user.txt' >/dev/null; then
|
||||
unavailable_path=cross-user.txt
|
||||
unavailable_query=CROSS-USER
|
||||
else
|
||||
unavailable_path=streaming-large.bin
|
||||
unavailable_query=STREAMING-LARGE
|
||||
fi
|
||||
curl --fail --silent --show-error \
|
||||
--cookie "$cookies" \
|
||||
--header 'Accept: application/json' \
|
||||
"$base/api/browse?root=personal" |
|
||||
grep -F 'cross-user.txt'
|
||||
curl --fail --silent --show-error \
|
||||
--cookie "$cookies" \
|
||||
--header 'Accept: application/json' \
|
||||
"$base/api/browse?root=personal&q=CROSS-USER" |
|
||||
grep -F 'cross-user.txt'
|
||||
"$base/api/browse?root=personal&q=$unavailable_query" |
|
||||
grep -F "$unavailable_path"
|
||||
printf x >/tmp/tiny
|
||||
tiny_digest="$(sha256sum /tmp/tiny | cut -d' ' -f1)"
|
||||
test "$(
|
||||
|
|
@ -1327,7 +1334,7 @@ spec:
|
|||
curl --silent --output /tmp/unavailable-download.json \
|
||||
--write-out '%{http_code}' \
|
||||
--cookie "$cookies" \
|
||||
"$base/download?root=personal&path=cross-user.txt"
|
||||
"$base/download?root=personal&path=$unavailable_path"
|
||||
)" = 503
|
||||
grep -F '"error":"throttle_unavailable"' \
|
||||
/tmp/unavailable-download.json
|
||||
|
|
|
|||
Loading…
Reference in a new issue