Skip to content

Commit

Permalink
Fix percent repaired metrics purge issues
Browse files Browse the repository at this point in the history
  • Loading branch information
adejanovski committed May 25, 2021
1 parent aeef47d commit cbe6c77
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 65 deletions.
92 changes: 31 additions & 61 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: master

- name: Setup Maven Cache
uses: actions/cache@v2
Expand Down Expand Up @@ -89,22 +87,20 @@ jobs:
include:
# don't run against the following C* versions when using cassandra storage type
- cassandra-version: 1.2.19
cucumber-options: '--tags ~@cassandra_2_1_onwards --tags ~@cassandra_4_0_onwards'
cucumber-options: '--tags ~@cassandra_2_1_onwards --tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards'
- cassandra-version: 2.0.17
cucumber-options: '--tags ~@cassandra_2_1_onwards --tags ~@cassandra_4_0_onwards'
cucumber-options: '--tags ~@cassandra_2_1_onwards --tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards'
- cassandra-version: 2.1.22
cucumber-options: '--tags ~@cassandra_4_0_onwards'
cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards'
- cassandra-version: 2.2.19
cucumber-options: '--tags ~@cassandra_4_0_onwards'
cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards'
- cassandra-version: 3.0.24
cucumber-options: '--tags ~@cassandra_4_0_onwards'
cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards'
- cassandra-version: 3.11.10
cucumber-options: '--tags ~@cassandra_4_0_onwards'
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: master

- name: Setup Maven Cache
uses: actions/cache@v2
Expand Down Expand Up @@ -166,18 +162,6 @@ jobs:
name: Postgres backend
needs: build
runs-on: ubuntu-20.04
services:
postgres:
image: postgres:9.4
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
# this replaces the manual reaper creation
POSTGRES_DB: reaper
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
strategy:
matrix:
cassandra-version: [3.11.10]
Expand Down Expand Up @@ -206,8 +190,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: master

- name: Setup Maven Cache
uses: actions/cache@v2
Expand Down Expand Up @@ -238,6 +220,10 @@ jobs:
python-version: '3.x'
architecture: 'x64'

- name: Setup postgres DB
run:
docker run --name posttest -d -p 5432:5432 -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres -e POSTGRES_DB=reaper postgres:alpine -c max_connections=300

- name: Install CCM
run: |
pip install pyyaml
Expand Down Expand Up @@ -276,12 +262,18 @@ jobs:
cassandra-version: [2.1.22, 2.2.19, 3.0.24, 3.11.10, 'github:apache/trunk']
storage-type: [cassandra]
test-type: [ccm]
cucumber-options: ['--tags ~@cassandra_4_0_onwards']
include:
- cassandra-version: 2.1.22
cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards'
- cassandra-version: 2.2.19
cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards'
- cassandra-version: 3.0.24
cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards'
- cassandra-version: 3.11.10
cucumber-options: '--tags ~@cassandra_4_0_onwards'
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: master

- name: Setup Maven Cache
uses: actions/cache@v2
Expand Down Expand Up @@ -354,8 +346,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: master

- name: Setup Maven Cache
uses: actions/cache@v2
Expand Down Expand Up @@ -415,18 +405,6 @@ jobs:
needs: [its-ccm-local, its-pgsql, its-ccm-cass, its-elassandra]
name: Sidecar
runs-on: ubuntu-20.04
services:
postgres:
image: postgres:9.4
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
# this replaces the manual reaper creation
POSTGRES_DB: reaper
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
strategy:
matrix:
cassandra-version: [2.1.22, 2.2.19, 3.0.24, 3.11.10, 'github:apache/trunk']
Expand All @@ -437,11 +415,11 @@ jobs:
# all versions but trunk have the same cucumber options, but we can't declare that more effectively (yet)
include:
- cassandra-version: 2.1.22
cucumber-options: '--tags ~@cassandra_4_0_onwards --tags @sidecar'
cucumber-options: '--tags ~@cassandra_4_0_onwards --tags @sidecar --tags ~@cassandra_3_11_onwards'
- cassandra-version: 2.2.19
cucumber-options: '--tags ~@cassandra_4_0_onwards --tags @sidecar'
cucumber-options: '--tags ~@cassandra_4_0_onwards --tags @sidecar --tags ~@cassandra_3_11_onwards'
- cassandra-version: 3.0.24
cucumber-options: '--tags ~@cassandra_4_0_onwards --tags @sidecar'
cucumber-options: '--tags ~@cassandra_4_0_onwards --tags @sidecar --tags ~@cassandra_3_11_onwards'
- cassandra-version: 3.11.10
cucumber-options: '--tags ~@cassandra_4_0_onwards --tags @sidecar'
- cassandra-version: 'github:apache/trunk'
Expand All @@ -459,8 +437,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: master

- name: Setup Maven Cache
uses: actions/cache@v2
Expand Down Expand Up @@ -490,6 +466,10 @@ jobs:
python-version: '3.x'
architecture: 'x64'

- name: Setup postgres DB
run:
docker run --name posttest -d -p 5432:5432 -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres -e POSTGRES_DB=reaper postgres:alpine -c max_connections=300

- name: Install CCM
run: |
pip install pyyaml
Expand Down Expand Up @@ -550,8 +530,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: master

- name: Setup Maven Cache
uses: actions/cache@v2
Expand Down Expand Up @@ -619,18 +597,16 @@ jobs:
include:
# all versions but trunk need to exclude trunk tests
- cassandra-version: 2.1.22
cucumber-options: '--tags ~@cassandra_4_0_onwards'
cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards'
- cassandra-version: 2.2.19
cucumber-options: '--tags ~@cassandra_4_0_onwards'
cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards'
- cassandra-version: 3.0.24
cucumber-options: '--tags ~@cassandra_4_0_onwards'
cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards'
- cassandra-version: 3.11.10
cucumber-options: '--tags ~@cassandra_4_0_onwards'
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: master

- name: Setup Maven Cache
uses: actions/cache@v2
Expand Down Expand Up @@ -700,18 +676,16 @@ jobs:
include:
# all versions but trunk need to exclude trunk tests
- cassandra-version: 2.1.22
cucumber-options: '--tags ~@cassandra_4_0_onwards'
cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards'
- cassandra-version: 2.2.19
cucumber-options: '--tags ~@cassandra_4_0_onwards'
cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards'
- cassandra-version: 3.0.24
cucumber-options: '--tags ~@cassandra_4_0_onwards'
cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards'
- cassandra-version: 3.11.10
cucumber-options: '--tags ~@cassandra_4_0_onwards'
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: master

- name: Setup Maven Cache
uses: actions/cache@v2
Expand Down Expand Up @@ -782,8 +756,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: master

- name: Setup Maven Cache
uses: actions/cache@v2
Expand Down Expand Up @@ -847,8 +819,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: master

- name: Setup Maven Cache
uses: actions/cache@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ public void purgeMetrics() {
Instant expirationTime = getExpirationTime(metricsTimeout);
storage.purgeOldMetrics(expirationTime);
storage.purgeOldSourceNodes(expirationTime);
storage.purgeOldPercentRepairMetrics(Instant.ofEpochMilli(DateTime.now().minusDays(1).getMillis()));
storage.purgeOldPercentRepairMetrics(expirationTime);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -958,8 +958,8 @@ Collection<PercentRepairedMetric> getPercentRepairedMetrics(
@Bind("since") Instant since
);

@SqlQuery(SQL_PURGE_PERCENT_REPAIRED)
void purgeOldPercentRepairMetrics(
@SqlUpdate(SQL_PURGE_PERCENT_REPAIRED)
int purgeOldPercentRepairMetrics(
@Bind("expirationTime") Instant expirationTime
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2038,7 +2038,7 @@ private static boolean isInstanceOfDistributedStorage(String storageClassname) {
public void percentRepairedMetricsGetCollectedForTheExistingSchedule() {
synchronized (BasicSteps.class) {
CLIENTS.parallelStream().forEach(client -> {
await().with().pollInterval(POLL_INTERVAL).atMost(3, MINUTES).until(() -> {
await().with().pollInterval(POLL_INTERVAL).atMost(5, MINUTES).until(() -> {
try {
List<RepairScheduleStatus> schedules = client.getRepairSchedulesForCluster(TestContext.TEST_CLUSTER);
callAndExpect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,25 @@ Feature: Using Reaper
Then reaper has 1 scheduled repairs for cluster called "test"
When reaper is upgraded to latest
Then reaper has 1 scheduled repairs for cluster called "test"
And deleting cluster called "test" fails
When all added schedules are deleted for the last added cluster
And the last added cluster is deleted
Then reaper has no longer the last added cluster in storage
${cucumber.upgrade-versions}

@sidecar
@all_nodes_reachable
@cassandra_3_11_onwards
Scenario Outline: Add a scheduled incremental repair and collect percent repaired metrics
Given that reaper <version> is running
And reaper has no cluster in storage
When an add-cluster request is made to reaper
Then reaper has the last added cluster in storage
And reaper has 0 scheduled repairs for cluster called "test"
When a new daily "incremental" repair schedule is added for "test" and keyspace "test_keyspace3"
Then reaper has 1 scheduled repairs for cluster called "test"
When reaper is upgraded to latest
Then reaper has 1 scheduled repairs for cluster called "test"
And percent repaired metrics get collected for the existing schedule
And deleting cluster called "test" fails
When all added schedules are deleted for the last added cluster
Expand Down

0 comments on commit cbe6c77

Please sign in to comment.