[Client] Read large dictionaries#2782
Conversation
…nd the relevant implementations. Added two unit tests, as well.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2782 +/- ##
==========================================
+ Coverage 54.73% 54.83% +0.10%
==========================================
Files 349 349
Lines 65975 66040 +65
Branches 13534 13546 +12
==========================================
+ Hits 36114 36216 +102
+ Misses 25939 25900 -39
- Partials 3922 3924 +2 ☔ View full report in Codecov by Sentry. |
| } | ||
| catch | ||
| { | ||
| ExceptionDispatchInfo.Capture(ex).Throw(); |
There was a problem hiding this comment.
what is this dispatchInfo for?
There was a problem hiding this comment.
The ReadByteStringInChunks method is called from within a catch block. If it also fails with an exception the original exception is rethrown together with it's call stack information (which, to my knowledge, would be lost if I just throw it).
There was a problem hiding this comment.
Imho this is not needed when immediately rethrowing like in this case
There was a problem hiding this comment.
I'm not rethrowing immediately. I'm rethrowing after executing ReadByteStringInChunks, which in turn can also throw an exception.
There was a problem hiding this comment.
Is the second throw; then ever executed?
There was a problem hiding this comment.
Now confused. Does this become an aggregatedException?
|
|
||
| int count = (int)ServerMaxByteStringLength; ; | ||
|
|
||
| int my_MaxByteStringLength = m_configuration.TransportQuotas.MaxByteStringLength; |
There was a problem hiding this comment.
nit: quite an uncommen prefix
mregen
left a comment
There was a problem hiding this comment.
lgtm, since the new code is only used when the dictionary is too big, low risk.
Proposed changes
A new method is implemented which reads byte strings in chunks and therefore allows to read byte strings which exceed the encoding limits of the server. This is used in the method which reads v103 data dictionaries.
Related Issues
Types of changes
What types of changes does your code introduce?
Put an
xin the boxes that apply. You can also fill these out after creating the PR.Checklist
Put an
xin the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
I have extended the ISession interface by a method
ReadByteStringInChunks. Extending the interface may be considered a breaking change.The new method takes a node id as input (which must point to a valid byte string typed variable) and is supposed to return the byte string value from that node id, even if it is too large for the server to encode it. It is implemented in
SessionandTraceableSessionand used in theDataDictionaryclass, when the Read call to read the byte string which contains the dictionary fails with a BadEncodingLimitsExceeded` Service Result Exception.(The method is currently intended to only fix the scenario in the bug mentioned. But as it is also exposed in the interface it could be used to read any byte string. The logic in that method is, in principal, also valid when reading other byte strings than data dictionaries or strings which are too large, or arrays which are too large).