• Leonid Baraz's avatar
    Fix order distortions. · 3926c70a
    Leonid Baraz authored
    Fixes a serious bug in the StorageQueue found with the stress test.
    When records are enqueued fast (e.g. in multiple threads) it can cause
    the following: the sequence ids will always be strictly monotonic, but
    last record digest may refer to a wrong record:
    (1) Record1 gets last digest of previous record
    (2) Record2 gets digest of Record1
    (3) Record2 gets seq id=1 and is written to the file
    (4) Record1 gets seq_id=2 and is written to the file.
    Upon uploading, server will get Record2[seq=1] uploaded first,
    Record1[seq=2] second, but last record digest from Record1 will not
    match digest of Record2 - it will match record before Record1.
    Add stress test too.
    
    Bug: b:177439641
    Change-Id: I5b7e425ea6aa0f30b96248dcaebb22562c085613
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2641569Reviewed-by: default avatarZach Trudo <zatrudo@google.com>
    Commit-Queue: Leonid Baraz <lbaraz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#846352}
    3926c70a
BUILD.gn 396 KB