Merge 10.1 into 10.2
This commit is contained in:
commit
dba7e1e8e1
@ -406,8 +406,8 @@ static int register_service()
|
||||
|
||||
static void clean_directory(const char *dir)
|
||||
{
|
||||
char dir2[MAX_PATH+2];
|
||||
*(strmake_buf(dir2, dir)+1)= 0;
|
||||
char dir2[MAX_PATH + 4]= {};
|
||||
snprintf(dir2, MAX_PATH+2, "%s\\*", dir);
|
||||
|
||||
SHFILEOPSTRUCT fileop;
|
||||
fileop.hwnd= NULL; /* no status display */
|
||||
@ -558,7 +558,7 @@ static int create_db_instance()
|
||||
DWORD cwd_len= MAX_PATH;
|
||||
char cmdline[3*MAX_PATH];
|
||||
FILE *in;
|
||||
bool cleanup_datadir= true;
|
||||
bool created_datadir= false;
|
||||
DWORD last_error;
|
||||
|
||||
verbose("Running bootstrap");
|
||||
@ -567,7 +567,11 @@ static int create_db_instance()
|
||||
|
||||
/* Create datadir and datadir/mysql, if they do not already exist. */
|
||||
|
||||
if (!CreateDirectory(opt_datadir, NULL) && (GetLastError() != ERROR_ALREADY_EXISTS))
|
||||
if (CreateDirectory(opt_datadir, NULL))
|
||||
{
|
||||
created_datadir= true;
|
||||
}
|
||||
else if (GetLastError() != ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
last_error = GetLastError();
|
||||
switch(last_error)
|
||||
@ -604,9 +608,11 @@ static int create_db_instance()
|
||||
}
|
||||
}
|
||||
|
||||
if (PathIsDirectoryEmpty(opt_datadir))
|
||||
if (!PathIsDirectoryEmpty(opt_datadir))
|
||||
{
|
||||
cleanup_datadir= false;
|
||||
fprintf(stderr,"ERROR : Data directory %s is not empty."
|
||||
" Only new or empty existing directories are accepted for --datadir\n",opt_datadir);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!CreateDirectory("mysql",NULL))
|
||||
@ -735,10 +741,12 @@ static int create_db_instance()
|
||||
}
|
||||
|
||||
end:
|
||||
if (ret && cleanup_datadir)
|
||||
if (ret)
|
||||
{
|
||||
SetCurrentDirectory(cwd);
|
||||
clean_directory(opt_datadir);
|
||||
if (created_datadir)
|
||||
RemoveDirectory(opt_datadir);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -3610,7 +3610,11 @@ public:
|
||||
bool is_bulk_op() const { return MY_TEST(bulk_param); }
|
||||
|
||||
/// Returns Diagnostics-area for the current statement.
|
||||
Diagnostics_area *get_stmt_da() const
|
||||
Diagnostics_area *get_stmt_da()
|
||||
{ return m_stmt_da; }
|
||||
|
||||
/// Returns Diagnostics-area for the current statement.
|
||||
const Diagnostics_area *get_stmt_da() const
|
||||
{ return m_stmt_da; }
|
||||
|
||||
/// Sets Diagnostics-area for the current statement.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2017, MariaDB
|
||||
Copyright (c) 2009, 2020, MariaDB
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -5088,16 +5088,16 @@ bool store_schema_shemata(THD* thd, TABLE *table, LEX_STRING *db_name,
|
||||
*/
|
||||
static bool verify_database_directory_exists(const LEX_STRING &dbname)
|
||||
{
|
||||
DBUG_ENTER("verity_database_exists");
|
||||
DBUG_ENTER("verify_database_directory_exists");
|
||||
char path[FN_REFLEN + 16];
|
||||
uint path_len;
|
||||
MY_STAT stat_info;
|
||||
if (!dbname.str[0])
|
||||
DBUG_RETURN(true); // Empty database name: does not exits.
|
||||
DBUG_RETURN(true); // Empty database name: does not exist.
|
||||
path_len= build_table_filename(path, sizeof(path) - 1, dbname.str, "", "", 0);
|
||||
path[path_len - 1]= 0;
|
||||
if (!mysql_file_stat(key_file_misc, path, &stat_info, MYF(0)))
|
||||
DBUG_RETURN(true); // The database directory was not found: does not exists.
|
||||
DBUG_RETURN(true); // The database directory was not found: does not exist.
|
||||
DBUG_RETURN(false); // The database directory was found.
|
||||
}
|
||||
|
||||
|
@ -150,10 +150,7 @@ int get_mysql_service_properties(const wchar_t *bin_path,
|
||||
There are rare cases where service config does not have
|
||||
--defaults-filein the binary parth . There services were registered with
|
||||
plain mysqld --install, the data directory is next to "bin" in this case.
|
||||
Service name (second parameter) must be MySQL.
|
||||
*/
|
||||
if(wcscmp(args[1], L"MySQL") != 0)
|
||||
goto end;
|
||||
have_inifile= FALSE;
|
||||
}
|
||||
else if(numargs == 3)
|
||||
@ -211,7 +208,7 @@ int get_mysql_service_properties(const wchar_t *bin_path,
|
||||
}
|
||||
}
|
||||
|
||||
if(!have_inifile)
|
||||
if(!have_inifile || props->datadir[0] == 0)
|
||||
{
|
||||
/*
|
||||
Hard, although a rare case, we're guessing datadir and defaults-file.
|
||||
@ -235,22 +232,25 @@ int get_mysql_service_properties(const wchar_t *bin_path,
|
||||
*p= 0;
|
||||
}
|
||||
|
||||
/* Look for my.ini, my.cnf in the install root */
|
||||
sprintf_s(props->inifile, MAX_PATH, "%s\\my.ini", install_root);
|
||||
if (GetFileAttributes(props->inifile) == INVALID_FILE_ATTRIBUTES)
|
||||
if (!have_inifile)
|
||||
{
|
||||
sprintf_s(props->inifile, MAX_PATH, "%s\\my.cnf", install_root);
|
||||
}
|
||||
if (GetFileAttributes(props->inifile) != INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
/* Ini file found, get datadir from there */
|
||||
GetPrivateProfileString("mysqld", "datadir", NULL, props->datadir,
|
||||
MAX_PATH, props->inifile);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No ini file */
|
||||
props->inifile[0]= 0;
|
||||
/* Look for my.ini, my.cnf in the install root */
|
||||
sprintf_s(props->inifile, MAX_PATH, "%s\\my.ini", install_root);
|
||||
if (GetFileAttributes(props->inifile) == INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
sprintf_s(props->inifile, MAX_PATH, "%s\\my.cnf", install_root);
|
||||
}
|
||||
if (GetFileAttributes(props->inifile) != INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
/* Ini file found, get datadir from there */
|
||||
GetPrivateProfileString("mysqld", "datadir", NULL, props->datadir,
|
||||
MAX_PATH, props->inifile);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No ini file */
|
||||
props->inifile[0]= 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Try datadir in install directory.*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user