Repository navigation
feat(search): retry extractions tika could not answer during a walk - #4123
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 100 |
🟢 Coverage 87.79% diff coverage · +0.10% coverage variation
Metric Results Coverage variation ✅ +0.10% coverage variation (-1.00%) Diff coverage ✅ 87.79% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (9ebb6a7) 95214 29578 31.06% Head commit (b6a3e39) 95309 (+95) 29707 (+129) 31.17% (+0.10%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#4123) 131 115 87.79% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
butonic
left a comment
There was a problem hiding this comment.
isUnreachable treats every error that is not ErrUnparsable as transient, but cs3.Retrieve also returns plain errors for a download that fails for good (InitiateFileDownload answering not found, permission denied, a missing blob ...). Since cf5a087 those files are indexed with Count: 0 and never capped, so each of them now costs 5s of retries on every walk, and five of them in a row make the walk report tika as down although it is fine. Could we only count connection errors, timeouts and 5xx from tika as unreachable?
Related, already the case before but now up to 6 attempts per file: tika uses http.DefaultClient, the cs3 retriever has no timeout either and builds the download request without the ctx. A tika that hangs instead of refusing connections blocks the walk. A context.WithTimeout per attempt would at least cover the tika call.
And since this touches the README paragraph anyway: the retry delays are a lower bound, they are only checked when a walk of the space runs. Could it say "tried again on the first reindex of its space after one hour / one day"?
butonic
left a comment
There was a problem hiding this comment.
The timeout counts as unreachable, so a file whose OCR always takes longer than 5m gets 1 + 5 attempts of 5m each on every walk, and since unreachable failures are never capped that repeats forever. Five of them in a row hold the walk for ~2.5h before it assumes tika is down. And if tika keeps parsing after we hang up, the retries stack more work on an already slow tika. IMO a timeout on a request tika accepted says more about the file than about tika: could it count as a failure of the file (backoff and cap), and only failed connections and 5xx count as unreachable? If tika really hangs, every file gets one counted failure and an hour of backoff, still a lot cheaper.
Minor: a 429 from the download is not a 5xx, so it counts as a failure of the file although it is clearly transient.
butonic
left a comment
There was a problem hiding this comment.
Both fixed 👍 One edge left, not a blocker IMO: a tika that accepts connections but never answers now costs the full timeout per file and never trips the streak, so a big space takes ages to walk. Down mode has the same problem since it still does a full extraction per file to notice tika is back. Checking tika with a cheap GET /version and a short timeout while it is considered down would fix both, fine as a follow up.
Description
During a space reindex, an extraction that could not reach Tika or the file is retried up to five times, one second apart. Files Tika cannot parse are not retried here.
After five files in a row are still out of reach, the reindex does not abort. It indexes the remaining files by name, resumes retries once an extraction succeeds, and returns an error with the number of files indexed by name only.
Motivation and Context
A Tika restart during a reindex left the files walked in that window without content.
How Has This Been Tested?
Types of changes
Checklist: