-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support None to not load any data for the persistence loading policy … #320
Conversation
07b23d1
to
85a48f6
Compare
@longquanzheng The |
Codecov Report
@@ Coverage Diff @@
## main #320 +/- ##
==========================================
+ Coverage 71.62% 71.90% +0.28%
==========================================
Files 54 54
Lines 4423 4457 +34
==========================================
+ Hits 3168 3205 +37
+ Misses 1019 1017 -2
+ Partials 236 235 -1
... and 3 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
ahh right. Maybe you can fix/improve this in the same PR(or separate if you prefer): https://github.com/indeedeng/iwf/blob/main/service/api/service.go#L112 Because avoiding query is a very important optimization here. Query is very expensive. Otherwise none is useless for rpc. |
For testing, if we are able to optimize/improve it by avoid calling query workflow, I wonder if we can assert it in the test to make sure the query API is not being called. (we may need to think about some "hack" just for testing) |
Sounds like better making it in another PR since the new PR will include quite work:
|
} else if loadingType == iwfidl.NONE { | ||
return []iwfidl.KeyValue{} | ||
} else { | ||
panic("not supported loading type " + loadingType) | ||
} | ||
} | ||
|
||
func LoadSearchAttributes(loadingKeys []string, allSearchAttributes []iwfidl.SearchAttribute) []iwfidl.SearchAttribute { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As our/golang convention, the internal usage of a method/function should be kept as "private". In golang, the any var/method/func start with lower case is package private loadSearchAttributes
.
Also there is already another method LoadSearchAttributes
, you may want to rename it to internalLoadSearchAttributes
to be more clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe loadSearchAttributesByRequestedKeys
} | ||
dataAttributes = am.GetAllDataObjects() | ||
} else { | ||
dataAttributes = LoadDataAttributes(request.Keys, am.GetAllDataObjects()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a bit wastful to call am.GetAllDataObjects()
before LoadDataAttributes
. Because GetAllDataObjects
will allocate a new slice/array to hold all the data attributes. Maybe LoadDataAttributes
can just access to all the DAs directly
saPolicy := req.GetSearchAttributesLoadingPolicy() | ||
if saPolicy.GetPersistenceLoadingType() != iwfidl.ALL_WITHOUT_LOCKING { | ||
switch saPolicy.GetPersistenceLoadingType() { | ||
case iwfidl.PARTIAL_WITH_EXCLUSIVE_LOCK: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to return error for this case. this will be supported in #305
Close this one and to make a new one since it has been several weeks. |
Support attributes loading None in RPC with code refactor