mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-31 02:46:29 +01:00 
			
		
		
		
	 9cb75f333f
			
		
	
	
	9cb75f333f
	
	
	
		
			
			Also fixes MDEV-32025 Crashes in MDL_key::mdl_key_init with lower-case-table-names=2
Change overview:
- In changes made in MDEV-31948, MDEV-31982 the code path
  which originaly worked only in case of lower-case-table-names==1
  also started to work in case of lower-case-table-names==2 in a mistake.
  Restoring the original check_db_name() compatible behavior
  (but without re-using check_db_name() itself).
- MDEV-31978 erroneously added a wrong DBUG_ASSERT. Removing.
Details:
- In mysql_change_db() the database name should be lower-cased only
  in case of lower_case_table_names==1. It should not be lower-cased
  for lower_case_table_names==2. The problem was caused by MDEV-31948.
  The new code version restored the pre-MDEV-31948 behavior, which
  used check_db_name() behavior.
- Passing lower_case_table_names==1 instead of just lower_case_table_names
  to the "casedn" parameter to DBNameBuffer constructor in sql_parse.cc
  The database name should not be lower-cased for lower_case_table_names==2.
  This restores pre-MDEV-31982 behavioir which used check_db_name() here.
- Adding a new data type Lex_ident_db_normalized, it stores database
  names which are both checked and normalized to lower case
  in case lower_case_table_names==1 and lower_case_table_names==2.
- Changing the data type for the "db" parameter to Lex_ident_db_normalized in
  lock_schema_name(), lock_db_routines(), find_db_tables_and_rm_known_files().
  This is to avoid incorrectly passing a non-normalized name in the future.
- Restoring the database name normalization in mysql_create_db_internal()
  and mysql_rm_db_internal() before calling lock_schema_name().
  The problem was caused MDEV-31982.
- Adding database name normalization in mysql_alter_db_internal()
  and mysql_upgrade_db(). This fixes MDEV-32026.
- Removing a wrong assert in Create_sp_func::create_with_db() was incorrect:
    DBUG_ASSERT(Lex_ident_fs(*db).ok_for_lower_case_names());
  The database name comes to here checked, but not normalized
  to lower case with lower-case-table-names=2.
  The assert was erroneously added by MDEV-31978.
- Recording lowercase_tables2.results and lowercase_tables4.results
  according to
    MDEV-29446 Change SHOW CREATE TABLE to display default collations
  These tests are skipped on buildbot on all platforms, so this change
  was forgotten in the patch for MDEV-29446.
		
	
			
		
			
				
	
	
		
			54 lines
		
	
	
	
		
			2.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
	
		
			2.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
 | |
| 
 | |
|    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
 | |
|    the Free Software Foundation; version 2 of the License.
 | |
| 
 | |
|    This program is distributed in the hope that it will be useful,
 | |
|    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | |
|    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | |
|    GNU General Public License for more details.
 | |
| 
 | |
|    You should have received a copy of the GNU General Public License
 | |
|    along with this program; if not, write to the Free Software
 | |
|    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335  USA */
 | |
| 
 | |
| #ifndef LOCK_INCLUDED
 | |
| #define LOCK_INCLUDED
 | |
| 
 | |
| #include "thr_lock.h"                           /* thr_lock_type */
 | |
| #include "mdl.h"
 | |
| 
 | |
| // Forward declarations
 | |
| struct TABLE;
 | |
| struct TABLE_LIST;
 | |
| class THD;
 | |
| typedef struct st_mysql_lock MYSQL_LOCK;
 | |
| 
 | |
| 
 | |
| MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **table, uint count, uint flags);
 | |
| bool mysql_lock_tables(THD *thd, MYSQL_LOCK *sql_lock, uint flags);
 | |
| int mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock, bool free_lock);
 | |
| int mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock);
 | |
| int mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock);
 | |
| int mysql_unlock_some_tables(THD *thd, TABLE **table,uint count, uint flag);
 | |
| int mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table);
 | |
| bool mysql_lock_abort_for_thread(THD *thd, TABLE *table);
 | |
| MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a, MYSQL_LOCK *b, THD *thd= NULL);
 | |
| /* Lock based on name */
 | |
| bool lock_schema_name(THD *thd, const Lex_ident_db_normalized &db);
 | |
| /* Lock based on stored routine name */
 | |
| bool lock_object_name(THD *thd, MDL_key::enum_mdl_namespace mdl_type,
 | |
|                       const LEX_CSTRING &db, const LEX_CSTRING &name);
 | |
| 
 | |
| /* flags for get_lock_data */
 | |
| #define GET_LOCK_UNLOCK         0
 | |
| #define GET_LOCK_STORE_LOCKS    1
 | |
| #define GET_LOCK_ACTION_MASK    1
 | |
| #define GET_LOCK_ON_THD         (1 << 1)
 | |
| #define GET_LOCK_SKIP_SEQUENCES (1 << 2)
 | |
| 
 | |
| MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, uint flags);
 | |
| void reset_lock_data(MYSQL_LOCK *sql_lock, bool unlock);
 | |
| 
 | |
| #endif /* LOCK_INCLUDED */
 |