Retrieve only required fields from the underlying store #6650
Labels
c/network server
This is related to the Network Server
performance
Something is slow or takes too much CPU/Memory/...
Summary
References #6642
References TheThingsIndustries/protoc-gen-fieldmask#43
Currently the Network Server will retrieve all of the top level fields of an end device from the underlying end device store, instead of only the fields requested by the validation logic. This happens primarily in the
Set
RPC implementation.Current Situation
The
Set
RPC implementation will retrieve all of the top level fields of theEndDevice
message, instead of only the fields required by the validation.The reason for this is that the current implementation of the
Set
registry method uses theSetFields
method in order to filter the returned fields. TheSetFields
class of methods does not allow multipleoneof
sub fields to be present in the requested fields - it is an error to request more than one type ofoneof
subfields in a singleSetFields
call.SetFields
imposes this limitation because it cannot discern between get and set operations. While semantically it makes sense to ask for two differentoneof
fields while getting an object (with the meaning of 'return the non empty one'), it is indicative of an error if multiple subfields are provided while setting an object.Why do we need this? Who uses it, and when?
This functionality would be a performance improvement when the store implementation would change.
Proposed Implementation
If the underlying store implementation will no longer show the
oneof
limitation, and would benefit from only retrieving the requested fields from the store, it would be beneficial to request only the requested fields from the store.If the store implementation would still show this
oneof
limitation, theprotoc-gen-fieldmask
plugin could provide a method which returns the common ancestor given a set of disjointoneof
fields, in order to minimize the returned fields.Contributing
Code of Conduct
The text was updated successfully, but these errors were encountered: