Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This page is meant as a template for writing a KIP. To create a KIP choose Tools->Copy on this page and modify with your content and replace the heading with the next KIP number and a description of your issue. Replace anything in italics with your own description.

Status

Current state: Under Discussion

...

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

Motivation


In the current IQv2 code, there are noticeable differences when interfacing with plain-kv-store and ts-kv-store. Notably, the return type V acts as a simple value for plain-kv-store but evolves into ValueAndTimestamp<V> for ts-kv-store, which presents type safety issues in the API.

...

Why introduce TimestampedKeyQuery and TimestampedRangeQuery? The primary motivation behind this is to ensure type safety and foster a clear distinction in our API. They bridge the difference between simple key-value stores and those integrated with timestamps, offering a more robust and intuitive querying mechanism.

Proposed Changes

Within the current IQv2 codebase, there have been distinct interactions between plain-kv-store and ts-kv-store. These differences, especially in return types, have raised concerns over type safety within the API.

...

This restructuring ensures a more intuitive, type-safe, and consistent querying mechanism for users across different types of key-value stores in the IQv2.

Compatibility, Deprecation, and Migration Plan

  • Changing the semantics of existing `KeyQuery` and `RangeQuery` is a breaking change. However, both classes are marked as `@Evolving` and thus a breaking change in a minor release is allowed without a deprecation period. Given that IQv2 is not yet widely adopted, we believe it’s cleaner to make this breaking change right away.
  • Adding new query types does not imply any compatibility concerns.

Test Plan

To ensure the robustness and accuracy of our new query types, TimestampedKeyQuery and TimestampedRangeQuery, it's essential to have thorough test coverage. With that in mind, we propose the creation of two specific test methods:

...

We will focus on conducting a detailed test for shouldHandleTimestampedRangeQuery.


Rejected Alternatives

The alternative would be to deprecate the existing `KeyQuery` and `RangeQuery` and add new query types that always return plain value. However, it seems to introduce unnecessary “deprecation noise”, and it would be hard to find good names for these newly added query types. Making a semantics change on the existing queries allows us to keep the existing names