-
-
Notifications
You must be signed in to change notification settings - Fork 2k
MDEV-35740 - Make IO_SIZE compile-time configurable, convert comment to compile-time check, fix grammar #3726
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
base: main
Are you sure you want to change the base?
Conversation
|
This #define is duplicated in the submodule How are changes in Is there an existing process? Should I open a parallel PR for that? |
|
|
e0a9a93 to
16967b9
Compare
If the server is to make IO_SIZE configurable, we need to avoid either redefining it, or defining it to be different. See: MariaDB/server#3726 Signed-off-by: Eric Herman <[email protected]>
I've created a draft PR: mariadb-corporation/mariadb-connector-c#265 I think I will create an MDEV for this work, as it crosses repository boundaries. |
494fc45 to
780b924
Compare
If the server is to make IO_SIZE configurable, we need to avoid either redefining it, or defining it to be different. See: MariaDB/server#3726 Signed-off-by: Eric Herman <[email protected]>
780b924 to
9879b3d
Compare
The server's definition of IO_SIZE is re-used here in the client for network buffer alignment, however IO_SIZE is used in the server for many different things and the client's buffer alignment is not related to many of those uses. If the server is to make IO_SIZE configurable, we need to avoid either redefining it, or defining it to be different. By creating a specific define for this, we avoid redfine and clarify the code. See: MariaDB/server#3726 Signed-off-by: Eric Herman <[email protected]>
The server's definition of IO_SIZE is re-used here in the client for network buffer alignment, however IO_SIZE is used in the server for many different things and the client's buffer alignment is not related to many of those uses. If the server is to make IO_SIZE configurable, we need to avoid either redefining it, or defining it to be different. By creating a specific define for this, we avoid redfine and clarify the code. See: MariaDB/server#3726 Signed-off-by: Eric Herman <[email protected]>
The server's definition of IO_SIZE is re-used here in the client for network buffer alignment, however IO_SIZE is used in the server for many different things and the client's buffer alignment is not related to many of those uses. If the server is to make IO_SIZE configurable, we need to avoid either redefining it, or defining it to be different. By creating a specific define for this, we avoid redfine and clarify the code. See: MariaDB/server#3726 Signed-off-by: Eric Herman <[email protected]>
The server's definition of IO_SIZE is re-used here in the client for network buffer alignment, however IO_SIZE is used in the server for many different things and the client's buffer alignment is not related to many of those uses. If the server is to make IO_SIZE configurable, we need to avoid either redefining it, or defining it to be different. By creating a specific define for this, we avoid redfine and clarify the code. See: MariaDB/server#3726 Signed-off-by: Eric Herman <[email protected]>
|
@ericherman Is this PR still a draft? How would you like to proceed with this code change given the input you've received thus far? My thoughts on the code change: |
The server's definition of IO_SIZE is re-used here in the client for network buffer alignment, however IO_SIZE is used in the server for many different things and the client's buffer alignment is not related to many of those uses. If the server is to make IO_SIZE configurable, we need to avoid either redefining it, or defining it to be different. By creating a specific define for this, we avoid redfine and clarify the code. See: MariaDB/server#3726 Signed-off-by: Eric Herman <[email protected]>
|
This is still draft because mariadb-corporation/mariadb-connector-c#267 should be merged first. |
26bdd78 to
c20c46e
Compare
The server's definition of IO_SIZE is re-used here in the client for network buffer alignment, however IO_SIZE is used in the server for many different things and the client's buffer alignment is not related to many of those uses. If the server is to make IO_SIZE configurable, we need to avoid either redefining it, or defining it to be different. By creating a specific define for this, we avoid redfine and clarify the code. See: MariaDB/server#3726 Signed-off-by: Eric Herman <[email protected]>
|
@ericherman now that mariadb-corporation/mariadb-connector-c#267 got merged, should we proceed? |
c20c46e to
9d8fa62
Compare
|
rebased and ready for review |
gkodinov
left a comment
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.
Sorry for the delayed review, Eric! I hope you're still willing to see this through.
This is my preliminary review of the change. Once we clear this out I'll solicit a final reviewer.
CMakeLists.txt
Outdated
|
|
||
| SET(IO_SIZE "" CACHE STRING "Specify the I/O buffer size") | ||
| IF(IO_SIZE) | ||
| ADD_DEFINITIONS(-DIO_SIZE=${IO_SIZE}) |
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.
I'd avoid adding a global definition to the command line. I'd add a
#cmakedefine IO_SIZE @IO_SIZE@
to config.h.cmake. It's arelady included by my_global.h.
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.
I'm not sure I understand why you would avoid this. While perhaps unlikely to be used by people other than those doing performance comparisons, a command-line option makes it easy to build with other values than the default, yes?
CMakeLists.txt
Outdated
| SET (SKIP_COMPONENTS "N-O-N-E") | ||
| ENDIF() | ||
|
|
||
| SET(IO_SIZE "" CACHE STRING "Specify the I/O buffer size") |
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.
I'd put the default here and move this to configure.cmake.
include/my_global.h
Outdated
| This influences the speed of the isam btree library. E.g.: too big too slow. | ||
| 4096 is a common block size on SSDs. | ||
| */ | ||
| #ifndef IO_SIZE |
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.
I'd remove the while @ifndef block and make sure the variable is always defined by cmake.
include/my_global.h
Outdated
| #ifndef IO_SIZE | ||
| #define IO_SIZE 4096U | ||
| #endif | ||
| #if (IO_SIZE < 512) || (IO_SIZE & (IO_SIZE-1)) |
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.
I'd move this check into configure.cmake. Here's it's too late to check and kind of a gotcha.
|
Thank you for taking a look at this. I am not likely to have a nice chance to look at this in the next week. |
1f1e68f to
b9536fa
Compare
By converting the text describing the constraints of the constant to a compile-time check, this enables us to make IO_SIZE configurable. It should be noted that this #define is duplicated in the submodule libmariadb in the include/ma_global.h file. Signed-off-by: Eric Herman <[email protected]>
03d3d00 to
5a19920
Compare
Making mariadb's IO_SIZE compile-time configurable enables more straight-forward investigation of the performance implications of having an IO_SIZE which is different than the memory page size. The default IO_SIZE of 4096 as defined in include/my_global.h matches the memory page size of most systems. Larger page sizes are widely supported, called "huge pages" in Linux, "superpages" in FreeBSD, and "large pages" in MS Windows. On POSIX systems, obtaining the page size can be done via: page_size= sysconf(_SC_PAGESIZE); On Windows: SYSTEM_INFO si; GetSystemInfo(&si); page_size= si.dwPageSize; In https://jira.mariadb.org/browse/MDEV-35740 Marko highlights that there are vastly different uses of IO_SIZE. This "one size fits all" nature of IO_SIZE is not ideal, future work could split this into separate constants based upon usage. See also: mariadb-corporation/mariadb-connector-c#267 Signed-off-by: Eric Herman <[email protected]>
5a19920 to
101f8f9
Compare
|
The latest push moves the check to CMake |
There is no JIRA for this simple refactoring.
Description
Making mariadb's IO_SIZE compile-time configurable enables more straight-forward investigation of the performance implications of having an IO_SIZE which is different than the memory page size.
By converting the text describing the constraints of the constant to a compile-time check, this enables us to make IO_SIZE configurable.
It should be noted that this #define is duplicated in the submodule libmariadb in the include/ma_global.h file.
Release Notes
Release notes might include the ability to define IO_SIZE to be a value other than 4096.
How can this PR be tested?
First, ensure that libmariadb is patched to
#ifndefguard the#define IO_SIZE( see: mariadb-corporation/mariadb-connector-c#265 ).Next, add different values via
cmakelike-DIO_SIZE=8192to see a larger value, or like-DIO_SIZE=4000to see it fail with a compile-time error.As this is a compile-time option this does not lend itself to automated testing.
Basing the PR against the correct MariaDB version
mainbranch.PR quality check