From: | Mikael Kjellström <mikael(dot)kjellstrom(at)mksoft(dot)nu> |
---|---|
To: | Andres Freund <andres(at)anarazel(dot)de>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, mikael(dot)kjellstrom(at)gmail(dot)com |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: recovery test failure on morepork with timestamp mystery |
Date: | 2022-05-13 07:00:20 |
Message-ID: | b34595d1-2893-b1f3-6b32-cbdeca2c4527@mksoft.nu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2022-05-13 04:14, Andres Freund wrote:
> One interesting tidbit is that the log timestamps are computed differently
> (with elog.c:get_formatted_log_time()) than the reset timestamp (with
> GetCurrentTimestamp()). Both use gettimeofday() internally.
>
> I wonder if there's a chance that somehow openbsd ends up with more usecs than
> "fit" in a second in the result of gettimeofday()? The elog.c case would
> truncate everything above a second away afaics:
> /* 'paste' milliseconds into place... */
> sprintf(msbuf, ".%03d", (int) (saved_timeval.tv_usec / 1000));
> memcpy(formatted_log_time + 19, msbuf, 4);
>
> whereas GetCurrentTimestamp() would add them to the timestamp:
> result = (TimestampTz) tp.tv_sec -
> ((POSTGRES_EPOCH_JDATE - UNIX_EPOCH_JDATE) * SECS_PER_DAY);
> result = (result * USECS_PER_SEC) + tp.tv_usec;
>
Well, I don't know if you remember but there was a thread a while back
and a test program (monotime.c) to test the clock if it could go
backwards and openbsd showed the following result when running the
attached testprogram:
openbsd 5.9:
$ ./monotime
1021006 Starting
1017367 Starting
1003415 Starting
1007598 Starting
1021006 Stopped
1007598 Stopped
1017367 Stopped
1003415 Stopped
openbsd 6.9:
$ ./monotime
410310 Starting
547727 Starting
410310 Back 262032.372314102 => 262032.242045208
410310 Stopped
465180 Starting
255646 Starting
547727 Stopped
465180 Stopped
255646 Stopped
could that have something to do with it?
/Mikael
Attachment | Content-Type | Size |
---|---|---|
monotime.c | text/plain | 1.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2022-05-13 07:09:00 | Re: Correct comment in ProcedureCreate() for pgstat_create_function() call. |
Previous Message | Antonin Houska | 2022-05-13 06:38:55 | Re: Privileges on PUBLICATION |