ibessonov commented on code in PR #3566:
URL: https://github.com/apache/ignite-3/pull/3566#discussion_r1555863374
##########
modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/index/AbstractSortedIndexStorageTest.java:
##########
@@ -308,8 +313,52 @@ void testScan() {
}
}
- @Test
- public void testBoundsAndOrder() {
+ /**
+ * Tests the happy case of the {@link SortedIndexStorage#readOnlyScan}
method.
+ */
+ @RepeatedTest(5)
+ void testReadOnlyScan() {
Review Comment:
Looks like a copy of another test. Can you reuse the code instead of copying
it?
##########
modules/storage-api/src/main/java/org/apache/ignite/internal/storage/index/SortedIndexStorage.java:
##########
@@ -63,4 +64,27 @@ PeekCursor<IndexRow> scan(
@Nullable BinaryTuplePrefix upperBound,
@MagicConstant(flagsFromClass = SortedIndexStorage.class) int flags
);
+
+ /**
+ * Returns a range of index values between the lower bound and the upper
bound, use in read-only transactions.
+ *
+ * @param lowerBound Lower bound. Exclusivity is controlled by a {@link
#GREATER_OR_EQUAL} or {@link #GREATER} flag.
+ * {@code null} means unbounded.
+ * @param upperBound Upper bound. Exclusivity is controlled by a {@link
#LESS} or {@link #LESS_OR_EQUAL} flag.
+ * {@code null} means unbounded.
+ * @param flags Control flags. {@link #GREATER} | {@link #LESS} by
default. Other available values
+ * are {@link #GREATER_OR_EQUAL}, {@link #LESS_OR_EQUAL}.
+ * @return Cursor with fetched index rows.
+ * @throws IllegalArgumentException If backwards flag is passed and
backwards iteration is not supported by the storage.
+ */
+ Cursor<IndexRow> readOnlyScan(
+ @Nullable BinaryTuplePrefix lowerBound,
+ @Nullable BinaryTuplePrefix upperBound,
+ @MagicConstant(flagsFromClass = SortedIndexStorage.class) int flags
+ );
+
+ /** If read-only scan is implemented for this storage. */
+ default boolean readOnlyScanImplemented() {
Review Comment:
Nah, I don't like it. Why can't RO scan reuse RW scan by default? See no
issues with that, please remove this weird method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]