Spouts check the scheme of stored URLs before emitting - #2123
Open
abhinav-phi wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.filterOutlinkandURLFilterBolt). 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.nextTuplenow checks the scheme of each buffered URL against the configuredprotocolslist before emitting. Rows with other schemes are skipped at WARN with askipped.schemecounter 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.