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

IP Address Validation and Key Expiration Optimization #1622 #1623 #1624

Closed
wants to merge 0 commits into from

Conversation

stav-bentov
Copy link
Contributor

IP Address Validation in Node Address Update:

  • Ensures that the node address is updated only when a valid IP address is obtained.-
  • This prevents erroneous updates with invalid or placeholder values (e.g., an empty string or "?").

Optimize Key Expiration Check with Branch Prediction Hint:

  • Introduces a condition to leverage branch prediction for improved performance.
  • The added check reduces unnecessary evaluations when the database size (dbSize(db)) is 0.

@@ -2456,6 +2456,10 @@ int nodeUpdateAddressIfNeeded(clusterNode *node, clusterLink *link, clusterMsg *
if (node->tcp_port == tcp_port && node->cport == cport && node->tls_port == tls_port && strcmp(ip, node->ip) == 0)
return 0;

/* We should not update the node address if we were not able to get a valid
* IP address. */
if (ip[0] == '\0' || strcmp(ip, "?") == 0) return 0;
Copy link
Member

Choose a reason for hiding this comment

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

What situation would cause this? Have you encountered it in a real life?

Copy link

codecov bot commented Jan 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.02%. Comparing base (9071a5c) to head (5be66f5).
Report is 1 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1624      +/-   ##
============================================
+ Coverage     70.85%   71.02%   +0.16%     
============================================
  Files           121      121              
  Lines         65169    65171       +2     
============================================
+ Hits          46176    46286     +110     
+ Misses        18993    18885     -108     
Files with missing lines Coverage Δ
src/cluster_legacy.c 87.20% <100.00%> (+<0.01%) ⬆️
src/db.c 89.73% <100.00%> (+0.16%) ⬆️

... and 13 files with indirect coverage changes

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.

2 participants