Conversation
|
Test FAILed. |
|
jenkins test this please |
dcrankshaw
left a comment
There was a problem hiding this comment.
This looks pretty good. It doesn't look like you ever evict things from the cache. Is that intentional?
| std::string redis_key = generate_redis_key(key); | ||
| const std::vector<std::string> cmd_vec{"GET", redis_key}; | ||
| auto result = | ||
| redis::send_cmd_with_reply<std::string>(redis_connection_, cmd_vec); |
There was a problem hiding this comment.
If you fetch the value from Redis, you should cache it here as well.
| auto entry_search = cache_.find(key); | ||
| bool new_entry = (entry_search == cache_.end()); | ||
| if (!new_entry) { | ||
| std::lock_guard<std::mutex> lock(entry_search->second->entry_mtx_); |
There was a problem hiding this comment.
What's the point of this lock? It will be released once it goes out of scope, so it won't be held after the if-statement.
| // This method is being invoked as part of the 'add application' | ||
| // procedure in the query frontend. Because any subsequent feedback | ||
| // updates to the StateDB depend on the completion of 'add application', | ||
| // it's safe to add a new cache entry immediately |
There was a problem hiding this comment.
Hmm will this always be true? This seems like a complicated behavior to rely on for safety. What if another code path ends up putting things in the StateDB? Will that break this code?
There was a problem hiding this comment.
Ahh I understand your comment now. Can you clarify in the comment that if we are creating a new entry, it means that the method is being invoked as part of adding an application?
But my previous question still remains, this seems like tricky behavior to rely on for safety.
|
Test PASSed. |
|
@dcrankshaw A couple questions regarding performance vs consistency tradeoffs:
|
|
@dcrankshaw I redesigned the
This design no longer makes any assumptions about the origin of the first |
|
Test FAILed. |
|
Test FAILed. |
|
jenkins test this please |
|
Test FAILed. |
dcrankshaw
left a comment
There was a problem hiding this comment.
LGTM. Will merge once tests pass.
|
Test FAILed. |
|
Test FAILed. |
|
Test PASSed. |
Fixes #329