Skip to content

Spouts check the scheme of stored URLs before emitting - #2123

Open
abhinav-phi wants to merge 1 commit into
apache:mainfrom
abhinav-phi:issue-2085-spout-scheme-check
Open

Spouts check the scheme of stored URLs before emitting#2123
abhinav-phi wants to merge 1 commit into
apache:mainfrom
abhinav-phi:issue-2085-spout-scheme-check

Conversation

@abhinav-phi

Copy link
Copy Markdown
Contributor

Fixes #2085.

Whatever ends up in the store is fetched: no scheme check and no filtering happens between the store and the fetcher, since URL filtering only runs on the discovery path (StatusEmitterBolt.filterOutlink and URLFilterBolt). A row whose URL uses a scheme the operator never intended to crawl was emitted as long as a protocol implementation was registered for it — combined with the file scheme being registered by default, a single bad row was a local file read rather than a wasted fetch.

AbstractQueryingSpout.nextTuple now checks the scheme of each buffered URL against the configured protocols list before emitting. Rows with other schemes are skipped at WARN with a skipped.scheme counter on the existing event counter, and the buffer keeps draining so one bad row does not block the ones behind it.

The full URL filter chain is deliberately not run here: that is hot path cost on every tuple and would silently drop rows an operator deliberately put in the store. A rejected row stays in the store and is skipped again on every query, hence the WARN log.

The frontier is the crawl instruction set: whatever ends up in the
store is fetched, with no scheme check and no filtering, since URL
filtering only runs on the discovery path. A row whose URL uses a
scheme the operator never intended to crawl was emitted as long as a
protocol implementation was registered for it.

AbstractQueryingSpout.nextTuple now checks the scheme of each buffered
URL against the configured protocols list before emitting, skips rows
with other schemes at WARN with a skipped.scheme counter, and keeps
draining the buffer so one bad row does not block the ones behind it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persistence spouts emit stored URLs without checking the scheme

1 participant