diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2017-12-08 16:41:51 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2017-12-11 12:31:58 +0300 |
commit | ddc1d6904a8852d6584a8fb7721de78d56bd454e (patch) | |
tree | 80173e7affa485206b3a2138e70772e15e00e6a7 /sql/sql_show.cc | |
parent | b8a0373ed2e4339d74aa7628f55dedf2303e57c6 (diff) | |
download | mariadb-git-ddc1d6904a8852d6584a8fb7721de78d56bd454e.tar.gz |
MDEV-14123: .rocksdb folder may break workflow which re-create data directory
Part2: make MyRocks add its directory into @@ignore_db_dirs when starting.
This is necessary because apparently not everybody are using plugin's my.cnf
So load ha_rocksdb.{so,dll} manually and then hit MDEV-12451, MDEV-14461
etc.
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r-- | sql/sql_show.cc | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc index de9d7d77dc8..f63d4a2d4f4 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -787,6 +787,57 @@ static void dispose_db_dir(void *ptr) } +/* + Append an element into @@ignore_db_dirs + + This is a function to be called after regular option processing has been + finalized. +*/ + +void ignore_db_dirs_append(const char *dirname_arg) +{ + char *new_entry_buf; + LEX_STRING *new_entry; + size_t len= strlen(dirname_arg); + + if (!my_multi_malloc(0, + &new_entry, sizeof(LEX_STRING), + &new_entry_buf, len + 1, + NullS)) + return; + + memcpy(new_entry_buf, dirname_arg, len+1); + new_entry->str = new_entry_buf; + new_entry->length= len; + + if (my_hash_insert(&ignore_db_dirs_hash, (uchar *)new_entry)) + { + // Either the name is already there or out-of-memory. + my_free(new_entry); + return; + } + + // Append the name to the option string. + size_t curlen= strlen(opt_ignore_db_dirs); + // Add one for comma and one for \0. + size_t newlen= curlen + len + 1 + 1; + char *new_db_dirs; + if (!(new_db_dirs= (char*)my_malloc(newlen ,MYF(0)))) + { + // This is not a critical condition + return; + } + + memcpy(new_db_dirs, opt_ignore_db_dirs, curlen); + if (curlen != 0) + new_db_dirs[curlen]=','; + memcpy(new_db_dirs + (curlen + ((curlen!=0)?1:0)), dirname_arg, len+1); + + if (opt_ignore_db_dirs) + my_free(opt_ignore_db_dirs); + opt_ignore_db_dirs= new_db_dirs; +} + bool ignore_db_dirs_process_additions() { |