Skip to content

Incorrect artifact createdOn and modifiedOn date when using Kafka topic storage #723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ajborley opened this issue Jul 29, 2020 · 5 comments · Fixed by #947
Closed

Incorrect artifact createdOn and modifiedOn date when using Kafka topic storage #723

ajborley opened this issue Jul 29, 2020 · 5 comments · Fixed by #947
Assignees
Labels
type/bug Something isn't working

Comments

@ajborley
Copy link
Contributor

ajborley commented Jul 29, 2020

When using the Kafka topic storage, Apicurio sets the artifact createdOn and modifiedOn metadata fields using the current system timestamp when the record was read out of Kafka (see (1) and (2)). This means that when a server restarts it will return different metadata for the same backing data. It also means that a cluster of Apicurio servers will each return different metadata for the same artifact.

Alternatives would be to use the Kafka record timestamps (so the createdOn field would match the time that the record was originally produced), or store the timestamps as part of the metadata object.

(1)

String currentTimeMillis = String.valueOf(System.currentTimeMillis());
contents.put(MetaDataKeys.CREATED_ON, currentTimeMillis);
contents.put(MetaDataKeys.MODIFIED_ON, currentTimeMillis);

(2)
cf.complete(createOrUpdateArtifact(
artifactId,
ArtifactType.values()[artifact.getArtifactType()],
ContentHandle.create(content),
Str.ActionType.CREATE == type,
offset));

@ajborley
Copy link
Contributor Author

This may be related to issue #653

@EricWittmann EricWittmann added the type/bug Something isn't working label Jul 31, 2020
@EricWittmann
Copy link
Member

@carlesarnal and @alesj Any thoughts on this bug?

@EricWittmann
Copy link
Member

Or does this only apply to the Kafka storage which will be deprecated/removed? If so then maybe it doesn't matter.

@carlesarnal
Copy link
Member

Please @alesj, correct me if I'm wrong, but I think this only applies to the Kafka storage.

@alesj
Copy link
Contributor

alesj commented Aug 4, 2020

Yes, this is Kafka storage only.
Even if deprecated, it should still be fixed -- and @ajborley suggestion with the record timestamp looks OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants