summaryrefslogtreecommitdiff
path: root/storage/innobase/ut
diff options
context:
space:
mode:
authorTimothy Smith <timothy.smith@sun.com>2008-12-14 12:18:59 -0700
committerTimothy Smith <timothy.smith@sun.com>2008-12-14 12:18:59 -0700
commitefbac9aabc7245afa12b3ec954ff4b65766cc2d1 (patch)
tree3779a01d1e40edfb02758e363a5cf6c233e9f9a7 /storage/innobase/ut
parent1945f661f7b4baf57bb7a95222f70a7d14544a5a (diff)
downloadmariadb-git-efbac9aabc7245afa12b3ec954ff4b65766cc2d1.tar.gz
Complete application of InnoDB snapshot innodb-5.1-ss2485, part 1. Fixes
Bug #36819: ut_usectime does not handle errors from gettimeofday Detailed revision comments: r2480 | vasil | 2008-05-27 11:40:07 +0300 (Tue, 27 May 2008) | 11 lines branches/5.1: Fix Bug#36819 ut_usectime does not handle errors from gettimeofday by retrying gettimeofday() several times if it fails in ut_usectime(). If it fails on all calls then return error to the caller to be handled at higher level. Update the variable innodb_row_lock_time_max in SHOW STATUS output only if ut_usectime() was successful.
Diffstat (limited to 'storage/innobase/ut')
-rw-r--r--storage/innobase/ut/ut0ut.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/storage/innobase/ut/ut0ut.c b/storage/innobase/ut/ut0ut.c
index 1ca278cd633..6b5bcef1830 100644
--- a/storage/innobase/ut/ut0ut.c
+++ b/storage/innobase/ut/ut0ut.c
@@ -112,19 +112,45 @@ ut_time(void)
}
/**************************************************************
-Returns system time. */
+Returns system time.
+Upon successful completion, the value 0 is returned; otherwise the
+value -1 is returned and the global variable errno is set to indicate the
+error. */
-void
+int
ut_usectime(
/*========*/
+ /* out: 0 on success, -1 otherwise */
ulint* sec, /* out: seconds since the Epoch */
ulint* ms) /* out: microseconds since the Epoch+*sec */
{
struct timeval tv;
+ int ret;
+ int errno_gettimeofday;
+ int i;
+
+ for (i = 0; i < 10; i++) {
+
+ ret = ut_gettimeofday(&tv, NULL);
+
+ if (ret == -1) {
+ errno_gettimeofday = errno;
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: gettimeofday(): %s\n",
+ strerror(errno_gettimeofday));
+ os_thread_sleep(100000); /* 0.1 sec */
+ errno = errno_gettimeofday;
+ } else {
+ break;
+ }
+ }
+
+ if (ret != -1) {
+ *sec = (ulint) tv.tv_sec;
+ *ms = (ulint) tv.tv_usec;
+ }
- ut_gettimeofday(&tv, NULL);
- *sec = (ulint) tv.tv_sec;
- *ms = (ulint) tv.tv_usec;
+ return(ret);
}
/**************************************************************