You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dedupe: add --dedupeConcurrent to be able to dedupe concurrent crawls (#1065)
- crawl cancelation with dedupeConcurrent: track of canceled concurrent
- crawls in 'canceledcrawls' key, to be treated as removed crawls and purged
- docs: update docs for --dedupeConcurrent trade-offs and update cli page
- dedupe: account for page urls that redirect by checking for finalPageUrl
- fixes#1064
---------
Co-authored-by: Tessa Walsh <tessa@bitarchivist.net>
Copy file name to clipboardExpand all lines: docs/docs/develop/dedupe.md
+10-1Lines changed: 10 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,11 +60,20 @@ Once a crawl is finished, the merged index keys are updated as follows:
60
60
61
61
-`allhashes`: `{[hash]: [crawlid]}` - The main merged index. For each hash in `h:${crawlid}`, an entry is added mapping `hash` to the `crawlid`, indicating the hash is found in this crawl. The full data from `h:${crawlid}` is not copied to save space.
62
62
63
-
-`allcounts`: A sum of all the `h:${crawlid}:counts` for all crawlids in `allcrawls`. The `allcounts` fields are incremented by each new `h:${crawlid}:counts`
63
+
-`allcounts`: A sum of all the `h:${crawlid}:counts` for all crawl ids in `allcrawls`. The `allcounts` fields are incremented by each new `h:${crawlid}:counts`.
64
+
65
+
-`canceledcrawls`: Use with concurrent crawls only to store crawl ids of crawls that were cancelled or have failed
66
+
while being deduped. If this key exists, indicates there may be data missing, if it has not been re-crawled.
64
67
65
68
Committing the crawl may take a long time, depending on the size of the crawl. For this reason, the indexer entrypoint
66
69
includes a dedicated command to commit a single crawl, `indexer --commitCrawlId <crawlid>`.
67
70
71
+
### Concurrent Crawl Support
72
+
73
+
If running with `--dedupeConcurrent`, each new hash is automatically committed to `allhashes` and `allcounts` is updated
74
+
for every new hash. If a concurrent crawl is canceled, it is additionally tracked in `canceledcrawls` to indicate that it
75
+
needs to be included in the removed crawl count.
76
+
68
77
#### Dedupe Lookup
69
78
70
79
To write a revisit record, two Redis lookups are needed:
Copy file name to clipboardExpand all lines: docs/docs/user-guide/dedupe.md
+22-3Lines changed: 22 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,11 +26,18 @@ been archived, it will not be saved again, instead a [`revisit` record will be c
26
26
27
27
While the index needs to be Redis-compatible, any Redis-compatible database can be used as well without additional changes. [Apache Kvrocks](https://kvrocks.apache.org/) is a good choice for the dedupe index database as it persists the data on disk, instead of keeping it all in memory like Redis.
28
28
29
-
When multiple crawls are running at the same time, the resources from one crawl are not yet available to the other crawls.
30
-
This is to account for crawls that may be cancelled or fail.
29
+
30
+
### Crawl Cancellation and Concurrent Crawl support
31
+
32
+
By default, when multiple crawls are running at the same time, the resources from one crawl are not yet available to the other crawls.
33
+
This is to account for crawls that may be cancelled or fail. If the crawl is cancelled/failed, the data is not entered into the shared dedupe index.
31
34
32
35
Once a crawl is complete, its data is fully 'committed' to the index and available to be deduplicated against by future crawls. This happens automatically when running the crawler via command line but can also be triggered [via a special indexer command](#committing-finished-crawls-to-the-index).
33
36
37
+
Sometimes it is necessary to deduplicate multiple concurrently running crawls. The `--dedupeConcurrent` flag can be used to ensure
38
+
the dedupe index is updated immediately while the crawl is running. As a trade-off, there may be data loss if the crawl is cancelled or fails, as other crawls may deduplicate against records from a crawl whose data is discarded and not stored.
39
+
For this reason, concurrent deduplication is not the default behavior, but may be enabled if concurrent crawls will not be canceled and will be retried on failure.
40
+
34
41
### Example: Running crawls with deduplication
35
42
36
43
Here's a quick example of running crawls with dedupe against the same index:
Copy file name to clipboardExpand all lines: src/util/argParser.ts
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -476,6 +476,13 @@ class ArgParser {
476
476
default: -1,
477
477
},
478
478
479
+
dedupeConcurrent: {
480
+
describe:
481
+
"If set, immediately add deduped URLs to the main dedupe index instead of to uncommittedcrawls. This allows dedupe of concurrently running crawls, but makes cancelling or failed crawls potentially lossy",
482
+
type: "boolean",
483
+
default: false,
484
+
},
485
+
479
486
saveState: {
480
487
describe:
481
488
"If the crawl state should be serialized to the crawls/ directory. Defaults to 'partial', only saved when crawl is interrupted",
0 commit comments