Re: [Maria-developers] c0b1148: MDEV-9659 : AWS KMS encryption plugin
Hi, Wlad! Just a couple of comments: On Mar 11, wlad@mariadb.com wrote:
+ # Relax AWS C++ SDK unreasonably high requirements for CMake version. Use replace utility (from MariaDB build) + # to patch their CMakeLists.txt
Nice solution. But you might need to add a dependency, to ensure that this external project target is built after replace. Unless cmake can, somehow, derive it automatically (you can test it by building just this specific target in a clean tree).
+ MY_DIR *dirp = my_dir(".", MYF(0)); + if (!dirp) + { + sql_print_error("Can't scan current directory"); + DBUG_RETURN(-1); + } + for (unsigned int i=0; i < dirp->number_of_files; i++) + { + + KEY_INFO info; + if (extract_id_and_version(dirp->dir_entry[i].name, &info.key_id, &info.key_version) == 0) + { + key_info_cache[KEY_ID_AND_VERSION(info.key_id, info.key_version)]= info; + latest_version_cache[info.key_id]= max(info.key_version, latest_version_cache[info.key_id]); + } + } + DBUG_RETURN(0);
my_dir() uses malloc(), don't forget my_dirend() to free the memory. Regards, Sergei
On 3/12/2016 11:35 AM, Sergei Golubchik wrote:
Hi, Wlad!
Just a couple of comments:
On Mar 11, wlad@mariadb.com wrote:
+ # Relax AWS C++ SDK unreasonably high requirements for CMake version. Use replace utility (from MariaDB build) + # to patch their CMakeLists.txt Nice solution. But you might need to add a dependency, to ensure that this external project target is built after replace. Unless cmake can, somehow, derive it automatically (you can test it by building just this specific target in a clean tree). CMake is smart here, does that stuff by itself ADD_CUSTOM_COMMAND documents it, here https://cmake.org/cmake/help/v3.0/command/add_custom_command.html "If COMMAND specifies an executable target (created by ADD_EXECUTABLE) it will automatically be replaced by the location of the executable created at build time. Additionally a target-level dependency will be added so that the executable target will be built before any target using this custom command. "
+ MY_DIR *dirp = my_dir(".", MYF(0)); + if (!dirp) + { + sql_print_error("Can't scan current directory"); + DBUG_RETURN(-1); + } + for (unsigned int i=0; i < dirp->number_of_files; i++) + { + + KEY_INFO info; + if (extract_id_and_version(dirp->dir_entry[i].name, &info.key_id, &info.key_version) == 0) + { + key_info_cache[KEY_ID_AND_VERSION(info.key_id, info.key_version)]= info; + latest_version_cache[info.key_id]= max(info.key_version, latest_version_cache[info.key_id]); + } + } + DBUG_RETURN(0); my_dir() uses malloc(), don't forget my_dirend() to free the memory. Thanks for noticing! Regards, Sergei
participants (2)
-
Sergei Golubchik
-
Vladislav Vaintroub