diff options
author | serg@serg.mylan <> | 2005-12-23 20:50:28 +0100 |
---|---|---|
committer | serg@serg.mylan <> | 2005-12-23 20:50:28 +0100 |
commit | c0638190759a616adc447207e18c155c81132ee9 (patch) | |
tree | 2594fb169d9c168d8ecb0490a4bbebd32149426e | |
parent | b867ef6df010e1fdc9da4c20f8c0fa56147ae7b5 (diff) | |
download | mariadb-git-c0638190759a616adc447207e18c155c81132ee9.tar.gz |
locking issues,
test for LONGLONG_MIN in decimal.c
-rw-r--r-- | myisam/mi_create.c | 5 | ||||
-rw-r--r-- | mysys/thr_alarm.c | 24 | ||||
-rw-r--r-- | server-tools/instance-manager/instance.cc | 3 | ||||
-rw-r--r-- | strings/decimal.c | 7 |
4 files changed, 19 insertions, 20 deletions
diff --git a/myisam/mi_create.c b/myisam/mi_create.c index 6d4106afda5..1a17febe94a 100644 --- a/myisam/mi_create.c +++ b/myisam/mi_create.c @@ -72,7 +72,6 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, } LINT_INIT(dfile); LINT_INIT(file); - pthread_mutex_lock(&THR_LOCK_myisam); errpos=0; options=0; bzero((byte*) &share,sizeof(share)); @@ -135,7 +134,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, pack_reclength++; min_pack_length++; /* We must test for 257 as length includes pack-length */ - if (test(rec->length >= 257)) + if (test(rec->length >= 257)) { long_varchar_count++; pack_reclength+= 2; /* May be packed on 3 bytes */ @@ -542,6 +541,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, if (! (flags & HA_DONT_TOUCH_DATA)) share.state.create_time= (long) time((time_t*) 0); + pthread_mutex_lock(&THR_LOCK_myisam); + if (ci->index_file_name) { fn_format(filename, ci->index_file_name,"",MI_NAME_IEXT,4); diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index e5b77de5e38..41914080a9d 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -401,7 +401,7 @@ void end_thr_alarm(my_bool free_structures) { DBUG_ENTER("end_thr_alarm"); if (alarm_aborted != 1) /* If memory not freed */ - { + { pthread_mutex_lock(&LOCK_alarm); DBUG_PRINT("info",("Resheduling %d waiting alarms",alarm_queue.elements)); alarm_aborted= -1; /* mark aborted */ @@ -415,13 +415,10 @@ void end_thr_alarm(my_bool free_structures) if (free_structures) { struct timespec abstime; - /* - The following test is just for safety, the caller should not - depend on this - */ + DBUG_ASSERT(!alarm_queue.elements); - /* Wait until alarm thread dies */ + /* Wait until alarm thread dies */ set_timespec(abstime, 10); /* Wait up to 10 seconds */ while (alarm_thread_running) { @@ -429,16 +426,13 @@ void end_thr_alarm(my_bool free_structures) if (error == ETIME || error == ETIMEDOUT) break; /* Don't wait forever */ } - if (!alarm_queue.elements) + delete_queue(&alarm_queue); + alarm_aborted= 1; + pthread_mutex_unlock(&LOCK_alarm); + if (!alarm_thread_running) /* Safety */ { - delete_queue(&alarm_queue); - alarm_aborted= 1; - pthread_mutex_unlock(&LOCK_alarm); - if (!alarm_thread_running) /* Safety */ - { - pthread_mutex_destroy(&LOCK_alarm); - pthread_cond_destroy(&COND_alarm); - } + pthread_mutex_destroy(&LOCK_alarm); + pthread_cond_destroy(&COND_alarm); } } else diff --git a/server-tools/instance-manager/instance.cc b/server-tools/instance-manager/instance.cc index 3d54d000d5f..3d04403f830 100644 --- a/server-tools/instance-manager/instance.cc +++ b/server-tools/instance-manager/instance.cc @@ -255,7 +255,10 @@ static void start_and_monitor_instance(Instance_options *old_instance_options, log_info("starting instance %s", instance_name_buff); if (start_process(old_instance_options, &process_info)) + { + instance_map->unlock(); return; /* error is logged */ + } /* allow users to delete instances */ instance_map->unlock(); diff --git a/strings/decimal.c b/strings/decimal.c index 0c1f03016e0..5fb37d374a2 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1069,9 +1069,9 @@ int decimal2longlong(decimal_t *from, longlong *to) } } /* boundary case: 9223372036854775808 */ - if (unlikely(from->sign==0 && x < 0 && -x < 0)) + if (unlikely(from->sign==0 && x == LONGLONG_MIN)) { - *to= -1-x; + *to= LONGLONG_MAX; return E_DEC_OVERFLOW; } @@ -2675,7 +2675,8 @@ void test_pr(const char *s1, int prec, int dec, char filler, const char *orig, int slen= sizeof(s2); int res; - sprintf(s, "'%s', %d, %d, '%c'", s1, prec, dec, filler); + sprintf(s, filler ? "'%s', %d, %d, '%c'" : "'%s', %d, %d, '\\0'", + s1, prec, dec, filler); end= strend(s1); string2decimal(s1, &a, &end); res= decimal2string(&a, s2, &slen, prec, dec, filler); |