Skip to content
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

Buffer fixes #223

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from
Open

Buffer fixes #223

wants to merge 8 commits into from

Conversation

frikilax
Copy link
Member

@frikilax frikilax commented May 17, 2021

✨ Buffer fixes and improvements

📃 Type of change

Please delete options that are not relevant.

Bug fix: non-breaking change which fixes an issue.

💡 Related Issue(s)

✒️ Description

Fixed

  • [BUFFER] Filter crashed when source wasn't a string
  • [BUFFER] Filter crashed sometimes with multiple outputs
  • [BUFFER] The sum filter did not work for "zero-length" cache
  • [BUFFER/UNAD] Wait for interval before launching first thread functions

Added

  • [BUFFER] Expire cache entries to prevent leftovers in Redis

🎯 Test Environments

Ubuntu (18.04)

  • Redis (4.0.9)

✔️ Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • (If other changes) I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

  • 🙋 I certify on my honor that all the information provided is true, and I've done all I can to deliver a high quality code

@frikilax frikilax self-assigned this May 17, 2021
@frikilax frikilax linked an issue Jun 8, 2021 that may be closed by this pull request
samples/fbuffer/Connectors/AConnector.cpp Outdated Show resolved Hide resolved

if(redis.Query(std::vector<std::string>{"EXPIRE", key, std::to_string(expiry)}, result, true) != REDIS_REPLY_INTEGER) {
DARWIN_LOG_ERROR("AConnector::REDISSetExpiry:: not the expected Redis response");
return -1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implicit cast, this should return false

_is_stop = true;
break;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the logic is mostly hte same, I don't understand the need for a change in this method

Copy link
Member Author

@frikilax frikilax Feb 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the change is in the position of the this->_cv.wait_for()
While we immediately started the task before, now it waits one iteration of _interval before launching it

DARWIN_LOG_INFO("SumConnector:: REDISPopLogs:: key '" + sum_name + "' does not exist (yet?)");
return false;
DARWIN_LOG_DEBUG("SumConnector:: REDISPopLogs:: key '" + sum_name + "' did not exist");
result = std::string("0");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This modification seems to be done to resolve an issue that I don't know nor can identify the issue, I can't review it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When Redis returns a NIL, it means that the key does not exist
For our use, the key might not exist yet, so this is not an invalid read (so we mustn't return false)

However, I can't remember why I casted the value to std::string("0") here, but I will improve the code

@@ -163,7 +162,7 @@ long long int SumConnector::REDISListLen(const std::string &sum_name) noexcept {
}
else {
DARWIN_LOG_ERROR("SumConnector::REDISListLen:: Error while querying key '" + sum_name + "'");
result = 0.0L;
return -1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This modification seems to be done to resolve an issue that I don't know nor can identify the issue, I can't review it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the previous return didn't specify an error in the process, now it does (and is checked in BufferThread.cpp:34)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[IDEA] buffer filter should set an expiration on redis lists
2 participants