diff options
author | Keith Bostic <keith.bostic@mongodb.com> | 2016-10-06 20:23:29 -0400 |
---|---|---|
committer | Alex Gorrod <alexander.gorrod@mongodb.com> | 2016-10-07 11:23:29 +1100 |
commit | 7b838e2403bf549daf2a8f27f5a67ed80a45f720 (patch) | |
tree | 512a895b75ed243ef37ca8e0cf63bd8048b10baf /src/os_posix | |
parent | 4aa57e5ed1b0ada49c47be325b83f21c2e5fb56a (diff) | |
download | mongo-7b838e2403bf549daf2a8f27f5a67ed80a45f720.tar.gz |
WT-2948 simplify error handling by making __wt_epoch return never fail (#3080)
If a system call to retrieve a timestamp fails it will now result in a panic. We couldn't find any case where that's a real possibility.
Diffstat (limited to 'src/os_posix')
-rw-r--r-- | src/os_posix/os_mtx_cond.c | 2 | ||||
-rw-r--r-- | src/os_posix/os_time.c | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/os_posix/os_mtx_cond.c b/src/os_posix/os_mtx_cond.c index b25bb8c25d1..842bb6eeec9 100644 --- a/src/os_posix/os_mtx_cond.c +++ b/src/os_posix/os_mtx_cond.c @@ -63,7 +63,7 @@ __wt_cond_wait_signal( locked = true; if (usecs > 0) { - WT_ERR(__wt_epoch(session, &ts)); + __wt_epoch(session, &ts); ts.tv_sec += (time_t) (((uint64_t)ts.tv_nsec + WT_THOUSAND * usecs) / WT_BILLION); ts.tv_nsec = (long) diff --git a/src/os_posix/os_time.c b/src/os_posix/os_time.c index b1b22a8e684..c7ae881af97 100644 --- a/src/os_posix/os_time.c +++ b/src/os_posix/os_time.c @@ -12,26 +12,26 @@ * __wt_epoch -- * Return the time since the Epoch. */ -int +void __wt_epoch(WT_SESSION_IMPL *session, struct timespec *tsp) { WT_DECL_RET; #if defined(HAVE_CLOCK_GETTIME) - WT_SYSCALL(clock_gettime(CLOCK_REALTIME, tsp), ret); + WT_SYSCALL_RETRY(clock_gettime(CLOCK_REALTIME, tsp), ret); if (ret == 0) - return (0); - WT_RET_MSG(session, ret, "clock_gettime"); + return; + WT_PANIC_MSG(session, ret, "clock_gettime"); #elif defined(HAVE_GETTIMEOFDAY) struct timeval v; - WT_SYSCALL(gettimeofday(&v, NULL), ret); + WT_SYSCALL_RETRY(gettimeofday(&v, NULL), ret); if (ret == 0) { tsp->tv_sec = v.tv_sec; tsp->tv_nsec = v.tv_usec * WT_THOUSAND; - return (0); + return; } - WT_RET_MSG(session, ret, "gettimeofday"); + WT_PANIC_MSG(session, ret, "gettimeofday"); #else NO TIME-OF-DAY IMPLEMENTATION: see src/os_posix/os_time.c #endif |