Skip to content

Implement timestamp generators and enable 4 out of 5 TimestampTests #295

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

Merged
merged 6 commits into from
May 7, 2025

Conversation

muzarski
Copy link
Contributor

@muzarski muzarski commented May 6, 2025

Fixes: #46
Ref: #132

This PR implements timestamp methods.

Enabled integration TimestampTests

  • Statement
  • BatchStatement
  • ServerSideTimestampGeneratorStatement
  • ServerSideTimestampGeneratorBatchStatement

Disabled integration test

There is one test that we need to keep disabled (for now). I want to create a separate issue for this. issue: #296.

Pre-review checklist

  • I have split my patch into logically separate commits.
  • All commit messages clearly explain what they change and why.
  • PR description sums up the changes and reasons why they should be introduced.
  • [ ] I have implemented Rust unit tests for the features/changes introduced.
  • I have enabled appropriate tests in .github/workflows/build.yml in gtest_filter.
  • I have enabled appropriate tests in .github/workflows/cassandra.yml in gtest_filter.

@muzarski muzarski self-assigned this May 6, 2025
@muzarski muzarski added the P2 P2 item - probably some people use this, let's implement that label May 6, 2025
@muzarski muzarski added this to the 0.5 milestone May 6, 2025
@muzarski muzarski added area/testing Related to unit/integration testing enhancement New feature or request labels May 6, 2025
@muzarski muzarski requested review from Lorak-mmk and wprzytula May 6, 2025 13:34
Copy link
Collaborator

@Lorak-mmk Lorak-mmk left a comment

Choose a reason for hiding this comment

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

Ooops, that was not supposed to be an approve

@muzarski
Copy link
Contributor Author

muzarski commented May 7, 2025

Rebased on master (did not address comments yet)

@muzarski
Copy link
Contributor Author

muzarski commented May 7, 2025

v1.1: Addressed comments - most importantly fixed a bug where we would compare interval <= 0 instead of threshold <= 0.

@muzarski muzarski requested review from wprzytula and Lorak-mmk May 7, 2025 07:27
muzarski added 6 commits May 7, 2025 09:40
Things to pay attention to during review:
- warning threshold is passed in microseconds, while warning interval is
  passed in millis
- documentation says that if threshold is <= 0, it should disable the warnings
- documentation says that if interval is <= 0, it should fallback to 1ms interval
I was really curious why these methods were not defined in `testing_unimplemented`.
The testing binary linking should fail.

Well... I found out that they are defined in src/,
where we still have a cpp implementation of the timestamp generators.

Note: While having both cpp and rust implementations, the linker did not
complain, and happily linked the test binary even though there are duplicate
definitions of timestamp_gen methods.

It seems that linker picked up the cpp implementations. Why?
The test causes segfault when calling `cass_cluster_set_timestamp_gen`
when we try to clone an Arc. It means that pointer `cass_timestamp_gen_server_side_new`
does not originate from Arc allocation - this suggests that the origin of
the pointer is different (created by cpp API).
The remaining test (MonotonicTimestampGenerator) needs further adjustments.
Currently it segfaults - I'll create a separate issue for this one.

TLDR - currently, the generator provided to `cass_cluster_set_timestamp_gen`
is constructed using pure c++ API (no API from cassandra.h is used).
It depends on `src/timestamp_generator.cpp`, which we should ultimately remove.
However, to remove this file, we need to implement a testing utility which
allows us to read the generated timestamps during the test. The test would
then need to be rewritten using this new utility.
@muzarski
Copy link
Contributor Author

muzarski commented May 7, 2025

v1.3: Forgot to cover warning_interval_ms == 0 case correctly...

@muzarski muzarski requested review from Lorak-mmk and wprzytula May 7, 2025 07:41
@muzarski muzarski merged commit 9ff131d into scylladb:master May 7, 2025
12 checks passed
@muzarski muzarski deleted the timestamps-gen branch May 7, 2025 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing Related to unit/integration testing enhancement New feature or request P2 P2 item - probably some people use this, let's implement that
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement timestamp generator configuration
3 participants