diff options
author | Michael Widenius <monty@askmonty.org> | 2011-05-28 05:11:32 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-05-28 05:11:32 +0300 |
commit | f197991f4102ed8ac66b7b57071f24f1d3b86aea (patch) | |
tree | b4590b80e7d50b664d8e6ff6a62978cb2402f0a6 /storage/maria | |
parent | de44b51e151a00a00d0e396dc57ced3682d24d78 (diff) | |
parent | 306ed65302e14f303fdc33cfa9d19016fb319440 (diff) | |
download | mariadb-git-f197991f4102ed8ac66b7b57071f24f1d3b86aea.tar.gz |
Merge with 5.1-microseconds
A lot of small fixes and new test cases.
client/mysqlbinlog.cc:
Cast removed
client/mysqltest.cc:
Added missing DBUG_RETURN
include/my_pthread.h:
set_timespec_time_nsec() now only takes one argument
mysql-test/t/date_formats.test:
Remove --disable_ps_protocl as now also ps supports microseconds
mysys/my_uuid.c:
Changed to use my_interval_timer() instead of my_getsystime()
mysys/waiting_threads.c:
Changed to use my_hrtime()
sql/field.h:
Added bool special_const_compare() for fields that may convert values before compare (like year)
sql/field_conv.cc:
Added test to get optimal copying of identical temporal values.
sql/item.cc:
Return that item_int is equal if it's positive, even if unsigned flag is different.
Fixed Item_cache_str::save_in_field() to have identical null check as other similar functions
Added proper NULL check to Item_cache_int::save_in_field()
sql/item_cmpfunc.cc:
Don't call convert_constant_item() if there is nothing that is worth converting.
Simplified test when years should be converted
sql/item_sum.cc:
Mark cache values in Item_sum_hybrid as not constants to ensure they are not replaced by other cache values in compare_datetime()
sql/item_timefunc.cc:
Changed sec_to_time() to take a my_decimal argument to ensure we don't loose any sub seconds.
Added Item_temporal_func::get_time() (This simplifies some things)
sql/mysql_priv.h:
Added Lazy_string_decimal()
sql/mysqld.cc:
Added my_decimal constants max_seconds_for_time_type, time_second_part_factor
sql/table.cc:
Changed expr_arena to be of type CONVENTIONAL_EXECUTION to ensure that we don't loose any items that are created by fix_fields()
sql/tztime.cc:
TIME_to_gmt_sec() now sets *in_dst_time_gap in case of errors
This is needed to be able to detect if timestamp is 0
storage/maria/lockman.c:
Changed from my_getsystime() to set_timespec_time_nsec()
storage/maria/ma_loghandler.c:
Changed from my_getsystime() to my_hrtime()
storage/maria/ma_recovery.c:
Changed from my_getsystime() to mmicrosecond_interval_timer()
storage/maria/unittest/trnman-t.c:
Changed from my_getsystime() to mmicrosecond_interval_timer()
storage/xtradb/handler/ha_innodb.cc:
Added support for new time,datetime and timestamp
unittest/mysys/thr_template.c:
my_getsystime() -> my_interval_timer()
unittest/mysys/waiting_threads-t.c:
my_getsystime() -> my_interval_timer()
Diffstat (limited to 'storage/maria')
-rw-r--r-- | storage/maria/ha_maria.cc | 2 | ||||
-rw-r--r-- | storage/maria/lockman.c | 6 | ||||
-rw-r--r-- | storage/maria/ma_loghandler.c | 14 | ||||
-rw-r--r-- | storage/maria/ma_recovery.c | 14 | ||||
-rw-r--r-- | storage/maria/unittest/trnman-t.c | 12 |
5 files changed, 26 insertions, 22 deletions
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 69de73a7f9e..42387459024 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -500,6 +500,8 @@ static int table2maria(TABLE *table_arg, data_file_type row_type, if (found->flags & BLOB_FLAG) recinfo_pos->type= FIELD_BLOB; + else if (found->type() == MYSQL_TYPE_TIMESTAMP) + recinfo_pos->type= FIELD_NORMAL; else if (found->type() == MYSQL_TYPE_VARCHAR) recinfo_pos->type= FIELD_VARCHAR; else if (!(options & HA_OPTION_PACK_RECORD) || diff --git a/storage/maria/lockman.c b/storage/maria/lockman.c index d6d4dcd44e6..459ee5d8ae2 100644 --- a/storage/maria/lockman.c +++ b/storage/maria/lockman.c @@ -690,12 +690,12 @@ enum lockman_getlock_result lockman_getlock(LOCKMAN *lm, LOCK_OWNER *lo, } /* yuck. waiting */ - deadline= my_getsystime() + lm->lock_timeout * 10000; - set_timespec_nsec(timeout,lm->lock_timeout * 1000000); + deadline= my_hrtime().val*1000 + lm->lock_timeout * 1000000; + set_timespec_time_nsec(timeout, deadline); do { pthread_cond_timedwait(wait_for_lo->cond, wait_for_lo->mutex, &timeout); - } while (!DELETED(blocker->link) && my_getsystime() < deadline); + } while (!DELETED(blocker->link) && my_hrtime().val < deadline/1000); pthread_mutex_unlock(wait_for_lo->mutex); lf_rwlock_by_pins(pins); if (!DELETED(blocker->link)) diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index 4aaa30f7be2..d57b7e0be72 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -1081,7 +1081,7 @@ static my_bool translog_write_file_header() memcpy(page, maria_trans_file_magic, sizeof(maria_trans_file_magic)); page+= sizeof(maria_trans_file_magic); /* timestamp */ - timestamp= my_getsystime(); + timestamp= my_hrtime().val; int8store(page, timestamp); page+= 8; /* maria version */ @@ -7719,7 +7719,7 @@ static my_bool translog_sync_files(uint32 min, uint32 max, flush_interval= group_commit_wait; if (flush_interval) - flush_start= my_micro_time(); + flush_start= microsecond_interval_timer(); for (fn= min; fn <= max; fn++) { TRANSLOG_FILE *file= get_logfile_by_number(fn); @@ -7986,7 +7986,8 @@ retest: /* We do not check time here because pthread_mutex_lock rarely takes a lot of time so we can sacrifice a bit precision to performance - (taking into account that my_micro_time() might be expensive call). + (taking into account that microsecond_interval_timer() might be + expensive call). */ if (flush_interval == 0) break; /* flush pass is ended */ @@ -7995,7 +7996,8 @@ retest: if (log_descriptor.next_pass_max_lsn == LSN_IMPOSSIBLE) { if (flush_interval == 0 || - (time_spent= (my_micro_time() - flush_start)) >= flush_interval) + (time_spent= (microsecond_interval_timer() - flush_start)) >= + flush_interval) { pthread_mutex_unlock(&log_descriptor.log_flush_lock); break; @@ -8786,7 +8788,7 @@ ma_soft_sync_background( void *arg __attribute__((unused))) DBUG_ENTER("ma_soft_sync_background"); for(;;) { - ulonglong prev_loop= my_micro_time(); + ulonglong prev_loop= microsecond_interval_timer(); ulonglong time, sleep; uint32 min, max, sync_request; min= soft_sync_min; @@ -8798,7 +8800,7 @@ ma_soft_sync_background( void *arg __attribute__((unused))) sleep= group_commit_wait; if (sync_request) translog_sync_files(min, max, FALSE); - time= my_micro_time() - prev_loop; + time= microsecond_interval_timer() - prev_loop; if (time > sleep) sleep= 0; else diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c index 5be30dee0b5..697d6ac7803 100644 --- a/storage/maria/ma_recovery.c +++ b/storage/maria/ma_recovery.c @@ -335,7 +335,7 @@ int maria_apply_log(LSN from_lsn, LSN end_lsn, } } - now= my_getsystime(); + now= microsecond_interval_timer(); in_redo_phase= TRUE; trnman_init(max_trid_in_control_file); if (run_redo_phase(from_lsn, end_lsn, apply)) @@ -366,10 +366,10 @@ int maria_apply_log(LSN from_lsn, LSN end_lsn, in_redo_phase= FALSE; old_now= now; - now= my_getsystime(); + now= microsecond_interval_timer(); if (recovery_message_printed == REC_MSG_REDO) { - double phase_took= (now - old_now)/10000000.0; + double phase_took= (now - old_now)/1000000.0; /* Detailed progress info goes to stderr, because ma_message_no_user() cannot put several messages on one line. @@ -435,10 +435,10 @@ int maria_apply_log(LSN from_lsn, LSN end_lsn, } old_now= now; - now= my_getsystime(); + now= microsecond_interval_timer(); if (recovery_message_printed == REC_MSG_UNDO) { - double phase_took= (now - old_now)/10000000.0; + double phase_took= (now - old_now)/1000000.0; procent_printed= 1; fprintf(stderr, " (%.1f seconds); ", phase_took); fflush(stderr); @@ -455,10 +455,10 @@ int maria_apply_log(LSN from_lsn, LSN end_lsn, } old_now= now; - now= my_getsystime(); + now= microsecond_interval_timer(); if (recovery_message_printed == REC_MSG_FLUSH) { - double phase_took= (now - old_now)/10000000.0; + double phase_took= (now - old_now)/1000000.0; procent_printed= 1; fprintf(stderr, " (%.1f seconds); ", phase_took); fflush(stderr); diff --git a/storage/maria/unittest/trnman-t.c b/storage/maria/unittest/trnman-t.c index 43cf982a7f2..92919b37152 100644 --- a/storage/maria/unittest/trnman-t.c +++ b/storage/maria/unittest/trnman-t.c @@ -75,7 +75,7 @@ pthread_handler_t test_trnman(void *arg) void run_test(const char *test, pthread_handler handler, int n, int m) { pthread_t *threads; - ulonglong now= my_getsystime(); + ulonglong now= microsecond_interval_timer(); int i; litmus= 0; @@ -97,8 +97,8 @@ void run_test(const char *test, pthread_handler handler, int n, int m) } for (i= 0 ; i < n ; i++) pthread_join(threads[i], 0); - now= my_getsystime()-now; - ok(litmus == 0, "Tested %s in %g secs (%d)", test, ((double)now)/1e7, litmus); + now= microsecond_interval_timer() - now; + ok(litmus == 0, "Tested %s in %g secs (%d)", test, ((double)now)/1e6, litmus); my_free((void*)threads, MYF(0)); } @@ -162,10 +162,10 @@ int main(int argc __attribute__((unused)), char **argv) diag("mallocs: %d", trnman_allocated_transactions); { - ulonglong now= my_getsystime(); + ulonglong now= microsecond_interval_timer(); trnman_destroy(); - now= my_getsystime()-now; - diag("trnman_destroy: %g", ((double)now)/1e7); + now= microsecond_interval_timer() - now; + diag("trnman_destroy: %g", ((double)now)/1e6); } pthread_mutex_destroy(&rt_mutex); |