forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check consistency of sizes of collections in StreamOutput
Today, we serialize collections prefixed by their lengths. If the serialized length is inconsistent with the number of objects in the collection then the serialization succeeds but any subsequent deserialization will (almost certainly) fail, reporting something unexpected at some later point in the stream. This can happen, for instance, because of a concurrent modification (e.g. elastic#28718) to the collection in between getting its length and iterating through its objects. This is a royal pain to debug, because the failure is reported a long way from where it actually occurs. See also e.g. elastic#25323. This change adds checks to StreamOutput to verify that it wrote as many objects as it said it would, in order to catch any similar problems in future closer to their sources.
- Loading branch information
1 parent
86e5e38
commit 2abace5
Showing
2 changed files
with
201 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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