-
Notifications
You must be signed in to change notification settings - Fork 632
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
Fix some unitialized fields in client
struct
#1126
Conversation
This commit adds initialization code for the fields `io_last_reply_block` and `io_last_bufpos` of the `client` struct. While in the current code flow, these fields are only accessed after being written in the `trySendWriteToIOThreads`, I discovered that they were not being initialized while doing some changes to the code flow of IO threads. I believe it's good pratice to initialize all fields of a struct upon creation, and will avoid future bugs which are usually hard to debug. Signed-off-by: Ricardo Dias <ricardo.dias@percona.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## unstable #1126 +/- ##
============================================
+ Coverage 70.61% 70.62% +0.01%
============================================
Files 114 114
Lines 61711 61713 +2
============================================
+ Hits 43576 43585 +9
+ Misses 18135 18128 -7
|
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.
Yeah, I agree it's better to initialize everything. It's likely free from a performance perspective as well since these operations are fast.
This commit adds initialization code for the fields `io_last_reply_block` and `io_last_bufpos` of the `client` struct. While in the current code flow, these fields are only accessed after being written in the `trySendWriteToIOThreads`, I discovered that they were not being initialized while doing some changes to the code flow of IO threads. I believe it's good pratice to initialize all fields of a struct upon creation, and will avoid future bugs which are usually hard to debug. Signed-off-by: Ricardo Dias <ricardo.dias@percona.com> Signed-off-by: naglera <anagler123@gmail.com>
This commit adds initialization code for the fields `io_last_reply_block` and `io_last_bufpos` of the `client` struct. While in the current code flow, these fields are only accessed after being written in the `trySendWriteToIOThreads`, I discovered that they were not being initialized while doing some changes to the code flow of IO threads. I believe it's good pratice to initialize all fields of a struct upon creation, and will avoid future bugs which are usually hard to debug. Signed-off-by: Ricardo Dias <ricardo.dias@percona.com>
This commit adds initialization code for the fields `io_last_reply_block` and `io_last_bufpos` of the `client` struct. While in the current code flow, these fields are only accessed after being written in the `trySendWriteToIOThreads`, I discovered that they were not being initialized while doing some changes to the code flow of IO threads. I believe it's good pratice to initialize all fields of a struct upon creation, and will avoid future bugs which are usually hard to debug. Signed-off-by: Ricardo Dias <ricardo.dias@percona.com>
This commit adds initialization code for the fields
io_last_reply_block
andio_last_bufpos
of theclient
struct.While in the current code flow, these fields are only accessed after being written in the
trySendWriteToIOThreads
, I discovered that they were not being initialized while doing some changes to the code flow of IO threads.I believe it's good pratice to initialize all fields of a struct upon creation, and will avoid future bugs which are usually hard to debug.