mariadb/mysys
Davi Arnaut eb58939395 Bug#42054: SELECT CURDATE() is returning bad value
The problem from a user point of view was that on Solaris the
time related functions (e.g. NOW(), SYSDATE(), etc) would always
return a fixed time.

This bug was happening due to a logic in the time retrieving
wrapper function which would only call the time() function every
half second. This interval between calls would be calculated
using the gethrtime() and the logic relied on the fact that time
returned by it is monotonic.

Unfortunately, due to bugs in the gethrtime() implementation,
there are some cases where the time returned by it can drift
(See Solaris bug id 6600939), potentially causing the interval
calculation logic to fail.

Since newer versions of Solaris (10+) have alleviated the
performance degradation associated with time(2), the solution is
to simply directly rely on time() at each invocation.

This simplification has an upside that it allows us to eliminate
a lock which was used to control access to the variables used
to track the half second interval, thus improving the overall
scalability of timekeeping related functions (e.g. NOW()).

Benchmarks runs have shown no significant degradation associated
with this change. With this, there are actually improvements in
performance for cases involving many connections.

In summary, the changes introduced by this patch are:

a) my_time() and my_micro_time_and_time() no longer use gethrtime().
   Instead, time() and gettimeofdate() are used correspondingly.

b) my_micro_time() is changed to not use gethrtime() so as to
   have the same time source as my_micro_time_and_time().
   There shouldn't be any performance impact from this change
   since this function is used only a few times during statement
   execution and, on Solaris, gettimeofday() shows acceptable
   performance.

mysys/my_getsystime.c:
  Use time() even if gethrtime() is available. Remove logic which
  relied on gethrtime() to only call time() every half second.
  Since gethrtime() is not used anymore, also remove it from
  my_micro_time() to keep a common time source.
  
  Also, function comments are cleaned up (fixed typos and wrong
  information) and converted to doxygen.
mysys/my_thr_init.c:
  Remove mutex which is no longer used.
mysys/mysys_priv.h:
  Remove mutex which is no longer used.
2011-01-12 18:36:39 -02:00
..
array.c Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled 2010-07-08 18:20:08 -03:00
base64.c
ChangeLog
charset-def.c Backporting WL#1213 2010-02-24 13:15:34 +04:00
charset.c Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled 2010-07-08 18:20:08 -03:00
checksum.c WL#5498: Remove dead and unused source code 2010-07-23 17:09:27 -03:00
CMakeLists.txt Patch for Bug#55854 (MySQL AB should not be AUTHOR, copyright incorrect). 2010-08-12 19:19:57 +04:00
default.c Bug #58173: Valgrind warning in load_defaults() 2010-11-16 11:58:39 +01:00
errors.c Manual merge with mysql-5.1-bugteam. 2010-12-09 13:49:11 +03:00
hash.c Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled 2010-07-08 18:20:08 -03:00
lf_alloc-pin.c WL#5498: Remove dead and unused source code 2010-07-23 17:13:36 -03:00
lf_dynarray.c Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled 2010-07-08 18:20:08 -03:00
lf_hash.c WL#5498: Remove dead and unused source code 2010-07-23 17:13:36 -03:00
list.c Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled 2010-07-08 18:20:08 -03:00
md5.c
mf_arr_appstr.c
mf_cache.c Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled 2010-07-08 18:20:08 -03:00
mf_dirname.c WL#5486: Remove code for unsupported platforms 2010-07-15 08:26:38 -03:00
mf_fn_ext.c WL#5486: Remove code for unsupported platforms 2010-07-15 08:26:38 -03:00
mf_format.c
mf_getdate.c
mf_iocache.c Remove configuration preprocessor symbols 'THREAD' 2011-01-11 10:07:37 +01:00
mf_iocache2.c Remove configuration preprocessor symbols 'THREAD' 2011-01-11 10:07:37 +01:00
mf_keycache.c Remove configuration preprocessor symbols 'THREAD' 2011-01-11 10:07:37 +01:00
mf_keycaches.c Remove configuration preprocessor symbols 'THREAD' 2011-01-11 10:07:37 +01:00
mf_loadpath.c Merge of mysql-5.1-bugteam into mysql-trunk-merge. 2010-07-02 16:38:04 -03:00
mf_pack.c Merge 2010-12-29 01:26:31 +01:00
mf_path.c WL#5486: Remove code for unsupported platforms 2010-07-15 08:13:30 -03:00
mf_qsort.c
mf_qsort2.c
mf_radix.c
mf_same.c
mf_sort.c Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled 2010-07-08 18:20:08 -03:00
mf_soundex.c
mf_tempdir.c WL#5486: Remove code for unsupported platforms 2010-07-15 08:13:30 -03:00
mf_tempfile.c WL#5486: Remove code for unsupported platforms 2010-07-15 08:17:56 -03:00
mf_unixpath.c WL#5486: Remove code for unsupported platforms 2010-07-15 08:16:06 -03:00
mf_wcomp.c
mulalloc.c
my_access.c
my_aes.c
my_alarm.c
my_alloc.c Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled 2010-07-08 18:20:08 -03:00
my_atomic.c WL#5498: Remove dead and unused source code 2010-07-23 17:18:36 -03:00
my_bit.c WL#5498: Remove dead and unused source code 2010-07-23 17:18:36 -03:00
my_bitmap.c Remove configuration preprocessor symbols 'THREAD' 2011-01-11 10:07:37 +01:00
my_chsize.c This is the downport of 2009-09-11 22:26:35 +02:00
my_compress.c Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled 2010-07-08 18:20:08 -03:00
my_conio.c
my_copy.c Merge of mysql-5.1-bugteam into mysql-trunk-merge. 2010-07-20 16:30:10 -03:00
my_crc32.c
my_create.c WL#5161 : Cross-platform build with CMake 2009-11-09 12:32:48 +01:00
my_delete.c Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111 2010-06-25 19:32:59 +04:00
my_div.c
my_error.c Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled 2010-07-08 18:20:08 -03:00
my_file.c Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled 2010-07-08 18:20:08 -03:00
my_fopen.c Merge of mysql-5.1 into mysql-5.5. 2011-01-07 17:30:52 -02:00
my_fstream.c Remove configuration preprocessor symbols 'THREAD' 2011-01-11 10:07:37 +01:00
my_gethostbyname.c Remove configuration preprocessor symbols 'THREAD' 2011-01-11 10:07:37 +01:00
my_gethwaddr.c Merge of mysql-5.1-bugteam into mysql-5.5-bugteam. 2010-10-20 12:48:19 -02:00
my_getncpus.c Bug#58057: 5.1 libmysql/libmysql.c unused variable/compile failure 2010-11-10 19:14:47 -02:00
my_getopt.c Bug#51631 general-log flag doesn't accept "on" as a value in 2011-01-10 15:18:20 +01:00
my_getpagesize.c
my_getsystime.c Bug#42054: SELECT CURDATE() is returning bad value 2011-01-12 18:36:39 -02:00
my_getwd.c WL#5486: Remove code for unsupported platforms 2010-07-15 08:26:38 -03:00
my_handler.c WL#5498: Remove dead and unused source code 2010-07-23 17:16:29 -03:00
my_handler_errors.h WL#5016: Fix header file include guards 2009-09-23 23:32:31 +02:00
my_init.c Bug#42054: SELECT CURDATE() is returning bad value 2011-01-12 18:36:39 -02:00
my_largepage.c Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled 2010-07-08 18:20:08 -03:00
my_lib.c Remove configuration preprocessor symbols 'THREAD' 2011-01-11 10:07:37 +01:00
my_libwrap.c
my_lock.c WL#5486: Remove code for unsupported platforms 2010-07-15 08:26:38 -03:00
my_lockmem.c Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled 2010-07-08 18:20:08 -03:00
my_malloc.c Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled 2010-07-08 18:20:08 -03:00
my_memmem.c
my_mess.c WL#5486: Remove code for unsupported platforms 2010-07-15 08:13:30 -03:00
my_mkdir.c
my_mmap.c Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111 2010-06-25 19:32:59 +04:00
my_new.cc
my_once.c Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled 2010-07-08 18:20:08 -03:00
my_open.c Remove configuration preprocessor symbols 'THREAD' 2011-01-11 10:07:37 +01:00
my_port.c
my_pread.c Remove configuration preprocessor symbols 'THREAD' 2011-01-11 10:07:37 +01:00
my_pthread.c Remove configuration preprocessor symbols 'THREAD' 2011-01-11 10:07:37 +01:00
my_quick.c This is the downport of 2009-09-11 22:26:35 +02:00
my_rdtsc.c WL#5665: Removal of the autotools-based build system 2010-11-20 20:56:09 -02:00
my_read.c Remove configuration preprocessor symbols 'THREAD' 2011-01-11 10:07:37 +01:00
my_redel.c Merge of mysql-5.1-bugteam into mysql-trunk-merge. 2010-07-20 16:30:10 -03:00
my_rename.c WL#5486: Remove code for unsupported platforms 2010-07-15 08:13:30 -03:00
my_seek.c Manual merge with mysql-5.1-bugteam. 2010-12-09 13:49:11 +03:00
my_sleep.c WL#5486: Remove code for unsupported platforms 2010-07-15 08:13:30 -03:00
my_static.c Remove configuration preprocessor symbols 'THREAD' 2011-01-11 10:07:37 +01:00
my_static.h WL#5498: Remove dead and unused source code 2010-07-23 17:14:35 -03:00
my_symlink.c Fix for bug#48451: my_seek and my_tell ignore MY_WME flag 2010-12-09 12:59:12 +03:00
my_symlink2.c
my_sync.c Merge of mysql-5.1-bugteam into mysql-5.5-bugteam. 2010-10-19 15:05:25 -02:00
my_thr_init.c Bug#42054: SELECT CURDATE() is returning bad value 2011-01-12 18:36:39 -02:00
my_timer_cycles.il WL#2373 Use cycle counter for timing 2009-11-24 16:36:31 -07:00
my_wincond.c A follow-up to the patch for bug #56405 "Deadlock in the MDL deadlock 2010-10-04 13:03:11 +02:00
my_windac.c Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled 2010-07-08 18:20:08 -03:00
my_winerr.c This is the downport of 2009-09-11 22:26:35 +02:00
my_winfile.c Bug#55629 5.5.x goes into infinite loop and high cpu after 2010-10-05 14:18:16 +02:00
my_winthread.c A follow-up to the patch for bug #56405 "Deadlock in the MDL deadlock 2010-10-04 13:03:11 +02:00
my_write.c Remove configuration preprocessor symbols 'THREAD' 2011-01-11 10:07:37 +01:00
mysys_priv.h Bug#42054: SELECT CURDATE() is returning bad value 2011-01-12 18:36:39 -02:00
ptr_cmp.c Bug #58699 cannot build with gcc dbg on solaris 2010-12-21 13:00:26 +01:00
queues.c Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled 2010-07-08 18:20:08 -03:00
rijndael.c WL#5498: Remove dead and unused source code 2010-07-23 17:09:27 -03:00
sha1.c Bug #56427 : Replace copyright notice removed from SHA1 code 2010-10-05 17:03:04 +03:00
stacktrace.c Merge of mysql-5.1-bugteam into mysql-5.5-bugteam. 2010-11-30 21:20:32 -02:00
string.c Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled 2010-07-08 18:20:08 -03:00
test_charset.c WL#5498: Remove dead and unused source code 2010-07-23 17:09:27 -03:00
test_dir.c
test_xml.c
testhash.c Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled 2010-07-08 18:20:08 -03:00
thr_alarm.c Remove configuration preprocessor symbols 'THREAD' 2011-01-11 10:07:37 +01:00
thr_lock.c Remove configuration preprocessor symbols 'THREAD' 2011-01-11 10:07:37 +01:00
thr_mutex.c Remove configuration preprocessor symbols 'THREAD' 2011-01-11 10:07:37 +01:00
thr_rwlock.c Remove configuration preprocessor symbols 'THREAD' 2011-01-11 10:07:37 +01:00
tree.c Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled 2010-07-08 18:20:08 -03:00
typelib.c Fix C++ style comments, they cause syntax errors in C file. 2010-03-13 22:17:47 +01:00