- 
                Notifications
    
You must be signed in to change notification settings  - Fork 183
 
[gpfdist] Use event_base with libevent 2.0+ to avoid thread-unsafe event_init #1225
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
Conversation
| 
           Good start. Do we plan to enable multi-threads for libevent 2.0+ in current PR?  | 
    
          
 No, simple multi threads mvp show performance downgrade.  | 
    
056bfc3    to
    b756915      
    Compare
  
    
          
 So do we still need the PR?  | 
    
          
 yes, using thread-safe APIs is a better choice. In case we found the right way.  | 
    
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.
LGTM
…n gpfdist The legacy event_init() function is not thread-safe and can cause issues when gpfdist is run in multi-threaded environments. This patch updates gpfdist to use libevent 2.0+'s thread-safe APIs, specifically `event_base` along with `event_assign()` and `evtimer_assign()`. A new global `gcb.event_base` is introduced and used when compiled with libevent ≥ 2.0.1. This avoids the need for the deprecated and non-thread-safe `event_set()` / `evtimer_set()` APIs, and prepares gpfdist for better thread safety.
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.
LGTM +1
The legacy event_init() function is not thread-safe and can cause issues when gpfdist is run in multi-threaded environments. This patch updates gpfdist to use libevent 2.0+'s thread-safe APIs, specifically
event_basealong withevent_assign()andevtimer_assign().A new global
gcb.event_baseis introduced and used when compiled with libevent ≥ 2.0.1. This avoids the need for the deprecated and non-thread-safeevent_set()/evtimer_set()APIs, and prepares gpfdist for better thread safety.This change maintains backward compatibility with older libevent versions via conditional compilation.
Fixes #ISSUE_Number
What does this PR do?
Type of Change
Breaking Changes
Test Plan
make installcheckmake -C src/test installcheck-cbdb-parallelImpact
Performance:
User-facing changes:
Dependencies:
Checklist
Additional Context
CI Skip Instructions