Commit 22f2b39c authored by Eugene Kosov's avatar Eugene Kosov Committed by Sergey Vojtovich

fix data races in rwlock

parent ca9ed393
...@@ -395,6 +395,6 @@ NAME CREATE_FILE CREATE_LINE OS_WAITS ...@@ -395,6 +395,6 @@ NAME CREATE_FILE CREATE_LINE OS_WAITS
Warnings: Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_mutexes but the InnoDB storage engine is not installed Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_mutexes but the InnoDB storage engine is not installed
select * from information_schema.innodb_sys_semaphore_waits; select * from information_schema.innodb_sys_semaphore_waits;
THREAD_ID OBJECT_NAME FILE LINE WAIT_TIME WAIT_OBJECT WAIT_TYPE HOLDER_THREAD_ID HOLDER_FILE HOLDER_LINE CREATED_FILE CREATED_LINE WRITER_THREAD RESERVATION_MODE READERS WAITERS_FLAG LOCK_WORD LAST_READER_FILE LAST_READER_LINE LAST_WRITER_FILE LAST_WRITER_LINE OS_WAIT_COUNT THREAD_ID OBJECT_NAME FILE LINE WAIT_TIME WAIT_OBJECT WAIT_TYPE HOLDER_THREAD_ID HOLDER_FILE HOLDER_LINE CREATED_FILE CREATED_LINE WRITER_THREAD RESERVATION_MODE READERS WAITERS_FLAG LOCK_WORD LAST_WRITER_FILE LAST_WRITER_LINE OS_WAIT_COUNT
Warnings: Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_sys_semaphore_waits but the InnoDB storage engine is not installed Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_sys_semaphore_waits but the InnoDB storage engine is not installed
...@@ -9462,25 +9462,7 @@ static ST_FIELD_INFO innodb_sys_semaphore_waits_fields_info[] = ...@@ -9462,25 +9462,7 @@ static ST_FIELD_INFO innodb_sys_semaphore_waits_fields_info[] =
STRUCT_FLD(old_name, ""), STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
// SYS_SEMAPHORE_WAITS_LAST_READER_FILE 17 // SYS_SEMAPHORE_WAITS_LAST_WRITER_FILE 17
{STRUCT_FLD(field_name, "LAST_READER_FILE"),
STRUCT_FLD(field_length, OS_FILE_MAX_PATH),
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
// SYS_SEMAPHORE_WAITS_LAST_READER_LINE 18
{STRUCT_FLD(field_name, "LAST_READER_LINE"),
STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
STRUCT_FLD(value, 0),
STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
// SYS_SEMAPHORE_WAITS_LAST_WRITER_FILE 19
{STRUCT_FLD(field_name, "LAST_WRITER_FILE"), {STRUCT_FLD(field_name, "LAST_WRITER_FILE"),
STRUCT_FLD(field_length, OS_FILE_MAX_PATH), STRUCT_FLD(field_length, OS_FILE_MAX_PATH),
STRUCT_FLD(field_type, MYSQL_TYPE_STRING), STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
...@@ -9489,7 +9471,7 @@ static ST_FIELD_INFO innodb_sys_semaphore_waits_fields_info[] = ...@@ -9489,7 +9471,7 @@ static ST_FIELD_INFO innodb_sys_semaphore_waits_fields_info[] =
STRUCT_FLD(old_name, ""), STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
// SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE 20 // SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE 18
{STRUCT_FLD(field_name, "LAST_WRITER_LINE"), {STRUCT_FLD(field_name, "LAST_WRITER_LINE"),
STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONG), STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
...@@ -9498,7 +9480,7 @@ static ST_FIELD_INFO innodb_sys_semaphore_waits_fields_info[] = ...@@ -9498,7 +9480,7 @@ static ST_FIELD_INFO innodb_sys_semaphore_waits_fields_info[] =
STRUCT_FLD(old_name, ""), STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
// SYS_SEMAPHORE_WAITS_OS_WAIT_COUNT 21 // SYS_SEMAPHORE_WAITS_OS_WAIT_COUNT 19
{STRUCT_FLD(field_name, "OS_WAIT_COUNT"), {STRUCT_FLD(field_name, "OS_WAIT_COUNT"),
STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
STRUCT_FLD(field_type, MYSQL_TYPE_LONG), STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
......
...@@ -127,11 +127,9 @@ HPUX aCC: HP ANSI C++ B3910B A.03.65) can't handle it. */ ...@@ -127,11 +127,9 @@ HPUX aCC: HP ANSI C++ B3910B A.03.65) can't handle it. */
#define SYS_SEMAPHORE_WAITS_READERS 14 #define SYS_SEMAPHORE_WAITS_READERS 14
#define SYS_SEMAPHORE_WAITS_WAITERS_FLAG 15 #define SYS_SEMAPHORE_WAITS_WAITERS_FLAG 15
#define SYS_SEMAPHORE_WAITS_LOCK_WORD 16 #define SYS_SEMAPHORE_WAITS_LOCK_WORD 16
#define SYS_SEMAPHORE_WAITS_LAST_READER_FILE 17 #define SYS_SEMAPHORE_WAITS_LAST_WRITER_FILE 17
#define SYS_SEMAPHORE_WAITS_LAST_READER_LINE 18 #define SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE 18
#define SYS_SEMAPHORE_WAITS_LAST_WRITER_FILE 19 #define SYS_SEMAPHORE_WAITS_OS_WAIT_COUNT 19
#define SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE 20
#define SYS_SEMAPHORE_WAITS_OS_WAIT_COUNT 21
/*******************************************************************//** /*******************************************************************//**
Auxiliary function to store ulint value in MYSQL_TYPE_LONGLONG field. Auxiliary function to store ulint value in MYSQL_TYPE_LONGLONG field.
......
...@@ -603,9 +603,6 @@ struct rw_lock_t ...@@ -603,9 +603,6 @@ struct rw_lock_t
/** File name where lock created */ /** File name where lock created */
const char* cfile_name; const char* cfile_name;
/** last s-lock file/line is not guaranteed to be correct */
const char* last_s_file_name;
/** File name where last x-locked */ /** File name where last x-locked */
const char* last_x_file_name; const char* last_x_file_name;
...@@ -615,9 +612,6 @@ struct rw_lock_t ...@@ -615,9 +612,6 @@ struct rw_lock_t
/** If 1 then the rw-lock is a block lock */ /** If 1 then the rw-lock is a block lock */
unsigned is_block_lock:1; unsigned is_block_lock:1;
/** Line number where last time s-locked */
unsigned last_s_line:14;
/** Line number where last time x-locked */ /** Line number where last time x-locked */
unsigned last_x_line:14; unsigned last_x_line:14;
......
...@@ -249,11 +249,6 @@ rw_lock_s_lock_low( ...@@ -249,11 +249,6 @@ rw_lock_s_lock_low(
ut_d(rw_lock_add_debug_info(lock, pass, RW_LOCK_S, file_name, line)); ut_d(rw_lock_add_debug_info(lock, pass, RW_LOCK_S, file_name, line));
/* These debugging values are not set safely: they may be incorrect
or even refer to a line that is invalid for the file name. */
lock->last_s_file_name = file_name;
lock->last_s_line = line;
return(TRUE); /* locking succeeded */ return(TRUE); /* locking succeeded */
} }
......
...@@ -590,7 +590,6 @@ sync_array_cell_print( ...@@ -590,7 +590,6 @@ sync_array_cell_print(
"number of readers " ULINTPF "number of readers " ULINTPF
", waiters flag %d, " ", waiters flag %d, "
"lock_word: %x\n" "lock_word: %x\n"
"Last time read locked in file %s line %u\n"
"Last time write locked in file %s line %u" "Last time write locked in file %s line %u"
#if 0 /* JAN: TODO: FIX LATER */ #if 0 /* JAN: TODO: FIX LATER */
"\nHolder thread " ULINTPF "\nHolder thread " ULINTPF
...@@ -600,8 +599,6 @@ sync_array_cell_print( ...@@ -600,8 +599,6 @@ sync_array_cell_print(
rw_lock_get_reader_count(rwlock), rw_lock_get_reader_count(rwlock),
my_atomic_load32_explicit(&rwlock->waiters, MY_MEMORY_ORDER_RELAXED), my_atomic_load32_explicit(&rwlock->waiters, MY_MEMORY_ORDER_RELAXED),
my_atomic_load32_explicit(&rwlock->lock_word, MY_MEMORY_ORDER_RELAXED), my_atomic_load32_explicit(&rwlock->lock_word, MY_MEMORY_ORDER_RELAXED),
innobase_basename(rwlock->last_s_file_name),
rwlock->last_s_line,
innobase_basename(rwlock->last_x_file_name), innobase_basename(rwlock->last_x_file_name),
rwlock->last_x_line rwlock->last_x_line
#if 0 /* JAN: TODO: FIX LATER */ #if 0 /* JAN: TODO: FIX LATER */
...@@ -1401,9 +1398,6 @@ sync_arr_fill_sys_semphore_waits_table( ...@@ -1401,9 +1398,6 @@ sync_arr_fill_sys_semphore_waits_table(
my_atomic_load32_explicit(&rwlock->waiters, MY_MEMORY_ORDER_RELAXED))); my_atomic_load32_explicit(&rwlock->waiters, MY_MEMORY_ORDER_RELAXED)));
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LOCK_WORD], OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LOCK_WORD],
my_atomic_load32_explicit(&rwlock->lock_word, MY_MEMORY_ORDER_RELAXED))); my_atomic_load32_explicit(&rwlock->lock_word, MY_MEMORY_ORDER_RELAXED)));
OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_LAST_READER_FILE], innobase_basename(rwlock->last_s_file_name)));
OK(fields[SYS_SEMAPHORE_WAITS_LAST_READER_LINE]->store(rwlock->last_s_line, true));
fields[SYS_SEMAPHORE_WAITS_LAST_READER_LINE]->set_notnull();
OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_FILE], innobase_basename(rwlock->last_x_file_name))); OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_FILE], innobase_basename(rwlock->last_x_file_name)));
OK(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->store(rwlock->last_x_line, true)); OK(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->store(rwlock->last_x_line, true));
fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->set_notnull(); fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->set_notnull();
......
...@@ -239,9 +239,7 @@ rw_lock_create_func( ...@@ -239,9 +239,7 @@ rw_lock_create_func(
ut_ad(cline <= 8192); ut_ad(cline <= 8192);
lock->cline = cline; lock->cline = cline;
lock->count_os_wait = 0; lock->count_os_wait = 0;
lock->last_s_file_name = "not yet reserved";
lock->last_x_file_name = "not yet reserved"; lock->last_x_file_name = "not yet reserved";
lock->last_s_line = 0;
lock->last_x_line = 0; lock->last_x_line = 0;
lock->event = os_event_create(0); lock->event = os_event_create(0);
lock->wait_ex_event = os_event_create(0); lock->wait_ex_event = os_event_create(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment