Different timestamps in mt_events table using EventAppendMode Quick #3762
Unanswered
DarkCloud14
asked this question in
General
Replies: 1 comment 1 reply
-
It was a mistake, nothing else. Unfortunately happens. I thought this was already dealt with by addressing the generated quick append function. It should be UTC every where. Do note that nothing in Marten actually uses that timestamp though unless you do in projections. The timestamp on streams is purely informational. So I guess my question back to you because it's not clear is if there's any place where the time is being stored not in UTC in the timestamp table in mt_events? I'm pretty sure that the rich append just uses DateTimeOffset.UtcNow. The default table value is overwritten regardless. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm new to Marten and not only started by looking at the documentation and some videos but also playing around with the EventSourcingIntro sample project. While doing so I also switched the events append mode from Rich to Quick and later on had a look at the generated events in the database.
What I saw is that in mt_events table timestamps generated with Quick mode are now 2 hours earlier so it looks to me like in Rich mode a timestamp with local time is generated and in Quick mode it's in UTC.
But that's not everything using append mode Quick, I also tried to use
StartStream
instead ofAppend
, I adjusted theReceiveProduct
method of theWarehouseProductHandler
class and instead ofsession.Events.Append(id, new ProductReceived(id, quantity, DateTime.UtcNow));
I used the following:
session.Events.StartStream(id, new ProductReceived(id, quantity, DateTime.UtcNow));
and now the ProductReceived event was added to mt_events table with a timestamp which has the local time but all other events which were added using Append had a timestamp with UTC.
I had a look at Martens code and saw that the default value of the timestamp column is
(now())
but looking further I saw that in QuickAppendEventFunction.cs(now() at time zone 'utc')
is used, I also found PR 3393 which introduced that change and I also saw that utc is only used for mt_events table in that case but not e.g. mt_streams.Is there a reason that one time a timestamp using UTC is generated and in, I guess, all other cases the local time is used, also could that lead to any problems, especially in Quick mode when using StartStream to create a new stream instead of Append like I mentioned above?
Beta Was this translation helpful? Give feedback.
All reactions