THRIFT-5030: Seqid verification Alternative - Added TMessageValidatorProtocol#1952
Closed
ptsneves wants to merge 1 commit intoapache:masterfrom
Closed
THRIFT-5030: Seqid verification Alternative - Added TMessageValidatorProtocol#1952ptsneves wants to merge 1 commit intoapache:masterfrom
ptsneves wants to merge 1 commit intoapache:masterfrom
Conversation
Client: python, netstd TMessageValidatorProtocol is a protocol-independent concrete decorator that allows a Thrift client to communicate with a Server and validate that the messaged received is matching the sent seqid. If it does not match we keep reading the buffer or throw an exception. This Protocol Decorator provides the most advantage with a framed transport. By default Thrift processors only provide an incrementing seqid that always starts in 0, which can lead to collisions when 2 protocols are started at the same time over the same transport. To mitigate that this protocol also overrides the seqid normally generated by the processor, because it uses a random seq id to avoid shared channel seqid collisions.
acb12d5 to
aa6f8e3
Compare
Jens-G
requested changes
Nov 27, 2019
| @@ -0,0 +1,100 @@ | |||
| using System; | |||
| else if (ValidationMode == ValidationModeEnum.THROW_EXCEPTION) | ||
| throw new TApplicationException(TApplicationException.ExceptionType.MissingResult, "Received SeqID and sent one do not match."); | ||
| else | ||
| throw new InvalidProgramException("This is an unreachable situation"); |
| @@ -0,0 +1,60 @@ | |||
| class TMessageValidatorProtocolFactory(object): | |||
| using Thrift.Protocol; | ||
| using Thrift.Protocol.Entities; | ||
| using Thrift; | ||
| namespace DroHub.Helpers.Thrift |
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.
Client: python, netstd
TMessageValidatorProtocol is a protocol-independent concrete decorator
that allows a Thrift client to communicate with a Server and validate
that the messaged received is matching the sent seqid. If it does not
match we keep reading the buffer or throw an exception. This Protocol
Decorator provides the most advantage with a framed transport. By
default Thrift processors only provide an incrementing seqid that always
starts in 0, which can lead to collisions when 2 protocols are started
at the same time over the same transport. To mitigate that this
protocol also overrides the seqid normally generated by the processor,
because it uses a random seq id to avoid shared channel seqid
collisions.