Closed nicollaas94 closed 2 years ago
Hi @nicollaas94,
Good morning.
Upon investigating, it looks like that the RejectedRecord class is auto-generated from timestream-write service model. The ExistingVersion(RecordVersion) is of type long
and correctly modeled in the RejectedRecord
class. The service model doesn't specify anything that indicates nullable data type in the shape. Also, due to backwards compatibility, this has been limitation in other model classes as well, something which team is aware of.
As pointed by you, RejectedRecord API specifies that ExistingVersion
value is populated in scenarios where an identical record exists with a higher version than the version in the write request. However, I also see that in Record data type, the value of Version
must be 1
or greater, with default value 1
. Hence, it appears that you should be able to distinguish if the ExistingVersion
is populated or not in RejectedRecordsException
by comparing with the value 0
. Please correct me if this is not the case and you have somehow value 0
for Version
for existing records.
Thanks, Ashish
This issue has not received a response in 5 days. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.
Hey @ashishdhingra, sorry for the late reply, yes I am having value 0 for version for existing records, this is what triggered my confusion :D.
Wasn't aware that the version starts from 1, so it is a problem in the Timestream itself I suppose? Can I help with some log, account id, should I open ticket support at AWS instead?
Note, it is easily reproducible. We even have an automated test checking this scenario
Description
I'd like to catch and handle Timetream RejectedRecordsException, one of the scenarios is that a message already exists in the database.
For that, the documentation states the following:
However, when trying to check if ExistingVersion is populated, it is impossible to distinguish between the not-populated version and version 0.
ex.RejectedRecords.Any(r => r.ExistingVersion != default)
the only alternative is to then check the Reason field instead.
ex.RejectedRecords.Any(r => r.Reason.Contains("record already exists"))
Reproduction Steps
Insert 2 items with the same time, dimensions, measure name, and record version. Catch the exception and try to verify if ExistingVersion is populated.
Resolution
Make ExistingVersion nullable
Workaround
check reason string instead (far from ideal)
This is a :bug: bug-report