Skip to content

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
Contributor

@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 Lorak-mmk and wprzytula 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
@wprzytula wprzytula mentioned this pull request Jun 17, 2025
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