Fix QueueServer crash on etag corruption, a=chris

Chris Pollett [2021-09-18 02:Sep:th]
Fix QueueServer crash on etag corruption, a=chris
Filename
src/executables/QueueServer.php
src/library/IndexDocumentBundle.php
diff --git a/src/executables/QueueServer.php b/src/executables/QueueServer.php
index 25dc5beae..1ce78c81b 100755
--- a/src/executables/QueueServer.php
+++ b/src/executables/QueueServer.php
@@ -1990,6 +1990,10 @@ class QueueServer implements CrawlConstants
             unserialize(gzuncompress(L\webdecode(file_get_contents($file))));
         L\crawlLog("Scheduler Done uncompressing etag data.".
             " Starting to add to linear hash table");
+        if (empty($etag_expires_data)) {
+            unlink($file);
+            return;
+        }
         $num_entries = count($etag_expires_data);
         $i = 0;
         foreach ($etag_expires_data as $data) {
diff --git a/src/library/IndexDocumentBundle.php b/src/library/IndexDocumentBundle.php
index 92105d3ae..bfd0bd668 100644
--- a/src/library/IndexDocumentBundle.php
+++ b/src/library/IndexDocumentBundle.php
@@ -921,7 +921,16 @@ class IndexDocumentBundle implements CrawlConstants
         return $result;
     }
     /**
+     * Within postings DOC_INDEX and POSITION_OFFSETS to position lists are
+     * stored as delta lists (difference over previous values), this method
+     * undoes the delta list to restore the actual DOC_INDEX and
+     * POSITION_OFFSETS values. It also computes the of the frequencies of items
+     * within the list of postings.
      *
+     * @param array& $postings a reference to an array of posting lists for a
+     *  term (this will be changed by this method)
+     * @return int sum of the frequencies of term occurrences as given by the
+     *  above postings
      */
     public function deDeltaPostingsSumFrequencies(&$postings)
     {
ViewGit