Skip to content
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

[WIP] DistinctErrorLog lock free. #325

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pveentjer
Copy link
Contributor

@pveentjer pveentjer commented Feb 4, 2025

As long as their are existing observations, the implementation is lock free.

Also the last observation timestamp is now guaranteed to be monotonic increasing.

Note: I have not updated the test yet.

import static org.agrona.BitUtil.SIZE_OF_INT;
import static org.agrona.BitUtil.SIZE_OF_LONG;
import static org.agrona.BitUtil.align;
import static org.agrona.BitUtil.*;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intellij and its autoformatting.. This will be fixed if we decide to merge this PR.

As long as their are existing observations, the implementation
is lock free.

Also the last observation timestamp is now guaranteed to be
monotonic increasing.
@pveentjer pveentjer force-pushed the improvement/DistinctErrorLog-lockfee branch from 5abc6cc to 86ab896 Compare February 4, 2025 13:27
@@ -157,38 +157,83 @@ public Charset charset()
*/
public boolean record(final Throwable observation)
{
final long timestampMs;
DistinctObservation distinctObservation;
final long timestampMs = clock.time();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the above logic should be moved into the updateLastObservationTimestamp method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant