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

Add test method for empty pages #260

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
- name: Setup Python 3
uses: actions/setup-python@v2
with:
python-version: '3.x'
python-version: '3.11'

- name: Fetch Scylla and Cassandra versions
id: fetch-versions
Expand Down Expand Up @@ -134,11 +134,11 @@ jobs:
- name: Setup Python 3
uses: actions/setup-python@v2
with:
python-version: '3.x'
python-version: '3.11'

- name: Setup environment
run: |
pip3 install https://github.com/scylladb/scylla-ccm/archive/master.zip
pip3 install https://github.com/scylladb/scylla-ccm/archive/a93125bc6ad7dd5c9694331e89dc1fb212431ffe.zip
- name: Run integration tests on Cassandra (${{ matrix.cassandra-version }})
run: mvn -B -e verify -Dccm.version=${{ matrix.cassandra-version }} -Dfmt.skip=true -Dclirr.skip=true -Danimal.sniffer.skip=true

Expand Down Expand Up @@ -186,11 +186,11 @@ jobs:
- name: Setup Python 3
uses: actions/setup-python@v2
with:
python-version: '3.x'
python-version: '3.11'

- name: Setup environment
run: |
pip3 install https://github.com/scylladb/scylla-ccm/archive/master.zip
pip3 install https://github.com/scylladb/scylla-ccm/archive/a93125bc6ad7dd5c9694331e89dc1fb212431ffe.zip
sudo sh -c "echo 2097152 > /proc/sys/fs/aio-max-nr"
- name: Run integration tests on Scylla (${{ matrix.scylla-version }})
run: mvn -B verify -Dccm.version=${{ matrix.scylla-version }} -Dccm.scylla=true -Dfmt.skip=true -Dclirr.skip=true -Danimal.sniffer.skip=true
Expand All @@ -213,4 +213,4 @@ jobs:
if: ${{ failure() }}
with:
name: ccm-logs-scylla-${{ matrix.scylla-version }}
path: /tmp/ccm*/ccm*/node*/logs/*
path: /tmp/ccm*/ccm*/node*/logs/*
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected Row computeNext() {
}

private void maybeMoveToNextPage() {
if (!currentRows.hasNext() && currentPage.hasMorePages()) {
while (!currentRows.hasNext() && currentPage.hasMorePages()) {
BlockingOperation.checkNotDriverThread();
AsyncResultSet nextPage =
CompletableFutures.getUninterruptibly(currentPage.fetchNextPage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,4 +367,31 @@ public void should_use_page_size() {
// Should have only fetched 10 (page size) rows.
assertThat(result.remaining()).isEqualTo(10);
}

@Test
public void should_not_fail_on_empty_pages() {
SESSION_RULE
.session()
.execute(
"CREATE KEYSPACE IF NOT EXISTS ks WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 1}");

SESSION_RULE
.session()
.execute("CREATE TABLE IF NOT EXISTS ks.t (pk int, ck int, v int, PRIMARY KEY(pk, ck))");

for (int i = 0; i < 50; i++) {
SESSION_RULE.session().execute("INSERT INTO ks.t(pk, ck, v) VALUES (?, ?, ?)", i, i, 15);
SESSION_RULE.session().execute("INSERT INTO ks.t(pk, ck, v) VALUES (?, ?, ?)", i, i, 32);
}

SESSION_RULE.session().execute("INSERT INTO ks.t(pk, ck, v) VALUES (?, ?, ?)", 8, 8, 14);
SESSION_RULE.session().execute("INSERT INTO ks.t(pk, ck, v) VALUES (?, ?, ?)", 11, 11, 14);
SESSION_RULE.session().execute("INSERT INTO ks.t(pk, ck, v) VALUES (?, ?, ?)", 14, 14, 14);

SimpleStatement st =
SimpleStatement.newInstance("SELECT * FROM ks.t WHERE v = 14 ALLOW FILTERING");
st = st.setPageSize(1);
List<Row> allRows = SESSION_RULE.session().execute(st).all();
assertThat(allRows.size()).isEqualTo(3);
}
}
Loading