diff --git a/src/docs/content/docs/backends/_index.md b/src/docs/content/docs/backends/_index.md index 6cc002fdd..815518dad 100644 --- a/src/docs/content/docs/backends/_index.md +++ b/src/docs/content/docs/backends/_index.md @@ -8,22 +8,17 @@ weight = 10 # Backends Reaper for Apache Cassandra can be used with either an ephemeral memory storage or persistent database. For persistent scalable database storage, a Cassandra cluster can be set up to back Reaper. To use a Cassandra cluster as the backed storage for Reaper set `storageType` to a value of **cassandra** in the Reaper configuration file. **Astra** can also be used as storage backend by setting `storageType` to a value of **astra**. With purge settings tuned appropriately, Reaper's workload should fit perfectly into the free tier of Astra. -Alternatively, a relational database storage; either H2 or Postgres can be set up to back Reaper. To use one of the relational database options as the backed storage for Reaper set `storageType` to a value of either **h2** or **postrges** in the Reaper configuration file. Further information on the available storage options is provided in the following section. * [In-Memory]({{}}) * [Cassanda]({{}}) -* [PostgresQL]({{}}) -* [H2]({{}}) * [Astra]({{}}) Sample YAML files are available in the *[src/packaging/resource](https://github.com/thelastpickle/cassandra-reaper/tree/master/src/packaging/resource)* directory for each of the above storage options: * cassandra-reaper-memory.yaml * cassandra-reaper-cassandra.yaml -* cassandra-reaper-postgres.yaml -* cassandra-reaper-h2.yaml * cassandra-reaper-astra.yaml For configuring other aspects of the service, see the available configuration options in the [Configuration Reference](../configuration). diff --git a/src/docs/content/docs/backends/h2.md b/src/docs/content/docs/backends/h2.md index c754e03b0..c24f46c2e 100644 --- a/src/docs/content/docs/backends/h2.md +++ b/src/docs/content/docs/backends/h2.md @@ -8,6 +8,8 @@ weight = 2 # H2 Backend +**Removed in v3.0.0** + To use H2 as the persistent storage for Reaper, the `storageType` setting must be set to **h2** in the Reaper configuration YAML file. When using H2 storage, the database will be automatically created under the path configured in the configuration YAML file. An example of how to configure H2 as persistent storage for Reaper can be found in the *[cassandra-reaper-h2.yaml](https://github.com/thelastpickle/cassandra-reaper/blob/master/src/packaging/resource/cassandra-reaper-h2.yaml)*. diff --git a/src/docs/content/docs/backends/postgres.md b/src/docs/content/docs/backends/postgres.md index 36e3d31ed..e8fb34dad 100644 --- a/src/docs/content/docs/backends/postgres.md +++ b/src/docs/content/docs/backends/postgres.md @@ -7,6 +7,8 @@ weight = 3 # Postgres Backend +**Removed in v3.0.0** + To use PostgreSQL as the persistent storage for Reaper, the `storageType` setting must be set to **postgres** in the Reaper configuration YAML file. The schema will be initialized/upgraded automatically upon startup in the configured database. Ensure that the correct JDBC credentials are specified in the *cassandra-reaper.yaml* to allow object creation. An example of how to configure Postgres as persistent storage for Reaper can be found in the *[cassandra-reaper-postgres.yaml](https://github.com/thelastpickle/cassandra-reaper/blob/master/src/packaging/resource/cassandra-reaper-postgres.yaml)*. diff --git a/src/docs/content/docs/configuration/backend_specific.md b/src/docs/content/docs/configuration/backend_specific.md index a9401aa2d..6f8c219b6 100644 --- a/src/docs/content/docs/configuration/backend_specific.md +++ b/src/docs/content/docs/configuration/backend_specific.md @@ -122,6 +122,8 @@ Cassandra native protocol password. ## H2 or Postgres Database Settings +**Removed in v3.0.0** + The following settings are specific to a Reaper deployment that is backed by either a H2 or Postgres database. An example of the configuration settings for a Postgres database are as follows. ```yaml diff --git a/src/docs/content/docs/configuration/docker_vars.md b/src/docs/content/docs/configuration/docker_vars.md index a18fb30ea..5d112a248 100644 --- a/src/docs/content/docs/configuration/docker_vars.md +++ b/src/docs/content/docs/configuration/docker_vars.md @@ -221,6 +221,8 @@ Allows Reaper to establish an encrypted connection when establishing a connectio ## Direct Mapping to H2 or Postgres Backend Configuration Settings +**Removed in v3.0.0** + The Docker environment variables listed in this section map directly to H2/Postgres backend specific settings in the *cassandra-reaper.yaml* configuration file. The following table below lists the Docker environment variables, their associated H2/Postgres backend specific setting in the *cassandra-reaper.yaml* configuration file, and the default value assigned by the Docker container (if any). Definitions for each Docker environment variable can be found via the link to the associated setting. In order to use the following settings, `REAPER_STORAGE_TYPE` must be set to `h2` or `postgres`. diff --git a/src/docs/content/docs/configuration/reaper_specific.md b/src/docs/content/docs/configuration/reaper_specific.md index 55a266dd8..e5d3d70dd 100644 --- a/src/docs/content/docs/configuration/reaper_specific.md +++ b/src/docs/content/docs/configuration/reaper_specific.md @@ -96,17 +96,17 @@ For security reasons, it is possible that Reaper will have access limited to nod **ALL** - requires Reaper to have access via JMX to all nodes across all datacenters. In this mode Reaper can be backed by all available storage types. -**LOCAL** - requires Reaper to have access via JMX to all nodes only in the same datacenter local to Reaper. A single Reaper instance can operate in this mode and trigger repairs from within its local data center. In this case, can be backed by all available storage types and repairs to any remote datacenters are be handled internally by Cassandra. A Reaper instance can be deployed to each datacenter and be configured to operate in this mode. In this case, Reaper can use either of Apache Cassandra or Postgres as its storage. +**LOCAL** - requires Reaper to have access via JMX to all nodes only in the same datacenter local to Reaper. A single Reaper instance can operate in this mode and trigger repairs from within its local data center. In this case, can be backed by all available storage types and repairs to any remote datacenters are be handled internally by Cassandra. A Reaper instance can be deployed to each datacenter and be configured to operate in this mode. In this case, Reaper can use Apache Cassandra or Astra as its storage. Further information can be found in the [Operating with a Multi DC Cluster](../../usage/multi_dc) section. -**EACH** - requires a minimum of one Reaper instance operating in each datacenter. Each Reaper instance is required to have access via JMX to all nodes only in its local datacenter. When operating in this mode, Reaper can use either of Apache Cassandra or Postgres as its storage. In addition, metrics from nodes in remote datacenters must be collected through the storage backend. If any metric is unavailable, the segment will be postponed for later processing. +**EACH** - requires a minimum of one Reaper instance operating in each datacenter. Each Reaper instance is required to have access via JMX to all nodes only in its local datacenter. When operating in this mode, Reaper can use either of Apache Cassandra or Astra as its storage. In addition, metrics from nodes in remote datacenters must be collected through the storage backend. If any metric is unavailable, the segment will be postponed for later processing. Further information can be found in the [Operating with a Multi DC Cluster](../../usage/multi_dc) section. **SIDECAR** - requires one reaper instance for each node in the cluster. Each Reaper instance is required to have access via JMX to its local node. -When operating in this mode, Reaper can use either of Apache Cassandra or Postgres as its storage. +When operating in this mode, Reaper can use either of Apache Cassandra or Astra as its storage. Further information can be found in the [Sidecar Mode](../../usage/sidecar_mode) section. @@ -397,7 +397,7 @@ Note that to bind the service to all interfaces use value **0.0.0.0** or leave t Type: *String* -The storage type to use in which Reaper will store its control data. The value must be either **cassandra**, **astra**, **h2**, **memory**, or **postgres**. If the recommended (persistent) storage type **cassandra**, **h2**, or **postgres** is being used, the database client parameters must be specified in the respective `cassandra`, `h2`, or `postgres` section in the configuration file. See the example settings in provided the *[src/packaging/resources](https://github.com/thelastpickle/cassandra-reaper/tree/master/src/packaging/resource)* directory of the repository. +The storage type to use in which Reaper will store its control data. The value must be either **cassandra**, **astra** or **memory**. If the recommended (persistent) storage type **cassandra**, or **astra** is being used, the database client parameters must be specified in the `cassandra` section in the configuration file. See the example settings in provided the *[src/packaging/resources](https://github.com/thelastpickle/cassandra-reaper/tree/master/src/packaging/resource)* directory of the repository.
diff --git a/src/docs/content/docs/download/_index.md b/src/docs/content/docs/download/_index.md index 6ebc5732b..285437770 100644 --- a/src/docs/content/docs/download/_index.md +++ b/src/docs/content/docs/download/_index.md @@ -26,52 +26,3 @@ The current development version can be downloaded as Debian/RPM packages in [the For a docker image, please see the [Docker](docker) section. Once the appropriate package has been downloaded, head over to the [Install and Run](install) section. - -## Upgrading from 1.2.0/1.2.1 to 1.2.2 -We unfortunately had to break schema migrations for upgrades to 1.2.2 from 1.2.0 and 1.2.1. -Here is the upgrade procedure for each Reaper backend: - -### Cassandra - -* Stop all Reaper instances -* Run the following DDL statement on the backend cluster : - -``` -ALTER TABLE reaper_db.repair_unit_v1 DROP repair_thread_count; -``` -* Upgrade Reaper to 1.2.2 and start it - -**Note:** by doing so the number of threads for each existing schedule will revert back to 0, which will be translated to a single repair thread. If you previously had defined a specific number of threads you will need to recreate these schedules or update the `repair_unit_v1` table manually (this field is only useful with Cassandra 2.2, there is no benefit in Cassandra <=2.1 or >=3.0). - -### H2 - -* Stop Reaper -* Pointing to your current Reaper jar file (located in `/usr/share/cassandra-reaper` for packaged installs), run the following command : -``` -java -cp /usr/share/cassandra-reaper/cassandra-reaper-1.2.*.jar org.h2.tools.Shell -``` -When asked, provide the JDBC URL from your Reaper for Apache Cassandra yaml file (for example : `jdbc:h2:~/reaper-db/db;MODE=PostgreSQL`), use the default `Driver` and leave username/password empty. -Then run the following statements: - -``` -ALTER TABLE REPAIR_UNIT DROP COLUMN repair_thread_count; -ALTER TABLE REPAIR_SEGMENT DROP COLUMN TOKEN_RANGES; -``` -* Upgrade Reaper to 1.2.2 and start it - -**Note:** by doing so the number of threads for each existing schedule will revert back to 0, which will be translated to a single repair thread. If you previously had defined a specific number of threads you will need to recreate these schedules or update the `repair_unit` table manually (this field is only useful with Cassandra 2.2, there is no benefit in Cassandra <=2.1 or >=3.0). - -### Postgres - -* Stop Reaper -* Connect to your Postgres database using the psql shell (or any other client) and run the following statements: - -``` -ALTER TABLE "repair_unit" DROP COLUMN "repair_thread_count"; -ALTER TABLE "repair_segment" DROP COLUMN "token_ranges"; -``` -* Upgrade Reaper to 1.2.2 and start it - -**Note:** by doing so the number of threads for each existing schedule will revert back to 0, which will be translated to a single repair thread. If you previously had defined a specific number of threads you will need to recreate these schedules or update the `repair_unit` table manually (this field is only useful with Cassandra 2.2, there is no benefit in Cassandra <=2.1 or >=3.0). - - diff --git a/src/docs/content/docs/usage/multi_dc_non-distributed.md b/src/docs/content/docs/usage/multi_dc_non-distributed.md index 4a09e21c3..8c451ba46 100644 --- a/src/docs/content/docs/usage/multi_dc_non-distributed.md +++ b/src/docs/content/docs/usage/multi_dc_non-distributed.md @@ -19,7 +19,7 @@ In the case where the JMX port is accessible (with or without authentication) fr datacenterAvailability: ALL ``` -This setup works with all backends : Apache Cassandra, Memory, H2 and Postgres. +This setup works with all backends : Apache Cassandra, Astra and Memory. {{< screenshot src="/img/singlereaper-multidc-all.png">}} @@ -44,7 +44,7 @@ Be aware that this setup will not allow to handle backpressure for those remote If multiple clusters are registered in Reaper it is required that Reaper can access all nodes in at least one data center in each of the registered clusters. -This setup works with all backends : Apache Cassandra, Memory, H2 and Postgres. +This setup works with all backends : Apache Cassandra, Astra and Memory. {{< screenshot src="/img/singlereaper-multidc-local.png">}} diff --git a/src/docs/content/faq.md b/src/docs/content/faq.md index 0d805300d..c288a4f06 100644 --- a/src/docs/content/faq.md +++ b/src/docs/content/faq.md @@ -3,7 +3,6 @@ ### Why use Reaper instead of noddetool + cron? - While it's possible to set up crontab to call nodetool, it requires staggering the crons to ensure overlap is kept to a minimum. Reaper is able to intelligently schedule repairs to avoid putting too much load on the cluster, avoiding impacting performance. Reaper also offers a simple UI to schedule repairs as granularly as needed. @@ -12,10 +11,9 @@ While it's possible to set up crontab to call nodetool, it requires staggering t Yes! Repair is a necessary anti-entropy mechanism that keeps your cluster consistent. Without repair, queries at LOCAL_ONE could return incorrect results. -### Why are there four backends? Which should i use? +### Which backend is used to store Reaper's data? When we (The Last Pickle) took over development of Reaper, we found it cumbersome to require a PostGres database in addition to the Cassandra database. We also knew Reaper would need to be fault tolerant and work across datacenters. The most straightforward way to do this would be to leverage Cassandra's fault tolerance. -For small setups, using a local DB (H2) can make sense. This would allow reaper to run on a single node using EBS for storage. This is intentionally a very simple design to keep costs down and avoid extra operational work. - -For new installations, we're recommending the Cassandra backend as it allows the most flexibility, with the highest level of availability. +Postgres and H2 were removed starting with v3.0.0 in order to simplify the codebase and feature addition. +The memory backend is still available for testing purposes. \ No newline at end of file diff --git a/src/server/src/main/docker/Dockerfile b/src/server/src/main/docker/Dockerfile index 475e8085d..aa54a5d4b 100644 --- a/src/server/src/main/docker/Dockerfile +++ b/src/server/src/main/docker/Dockerfile @@ -62,7 +62,7 @@ ENV REAPER_SEGMENT_COUNT_PER_NODE=64 \ REAPER_CASS_AUTH_USERNAME="cassandra" \ REAPER_CASS_AUTH_PASSWORD="cassandra" \ REAPER_CASS_NATIVE_PROTOCOL_SSL_ENCRYPTION_ENABLED="false" \ - REAPER_DB_URL="jdbc:h2:/var/lib/cassandra-reaper/db;MODE=PostgreSQL" \ + REAPER_DB_URL="" \ REAPER_DB_USERNAME="" \ REAPER_DB_PASSWORD="" \ REAPER_METRICS_ENABLED=false \ diff --git a/src/server/src/main/docker/configure-persistence.sh b/src/server/src/main/docker/configure-persistence.sh index 129a7b53a..98ad6b673 100644 --- a/src/server/src/main/docker/configure-persistence.sh +++ b/src/server/src/main/docker/configure-persistence.sh @@ -98,28 +98,5 @@ fi # END cassandra persistence options ;; - "postgres") - -# BEGIN postgres persistence options -cat <> /etc/cassandra-reaper.yml -postgres: - url: ${REAPER_DB_URL} - user: ${REAPER_DB_USERNAME} - password: ${REAPER_DB_PASSWORD} -EOT -# END postgres persistence options - - ;; - "h2") - -# BEGIN h2 persistence options -cat <> /etc/cassandra-reaper.yml -h2: - url: ${REAPER_DB_URL} - user: ${REAPER_DB_USERNAME} - password: ${REAPER_DB_PASSWORD} -EOT -# END h2 persistence options - esac diff --git a/src/server/src/main/resources/db/h2/V10_0_0__multithreaded_repair.sql b/src/server/src/main/resources/db/h2/V10_0_0__multithreaded_repair.sql deleted file mode 100644 index 35fc9e561..000000000 --- a/src/server/src/main/resources/db/h2/V10_0_0__multithreaded_repair.sql +++ /dev/null @@ -1,22 +0,0 @@ --- --- Copyright 2018-2018 The Last Pickle Ltd --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Support for segment coalescing --- - -ALTER TABLE repair_unit -ADD repair_thread_count INT; - - diff --git a/src/server/src/main/resources/db/h2/V11_0_0__custom_jmx_port.sql b/src/server/src/main/resources/db/h2/V11_0_0__custom_jmx_port.sql deleted file mode 100644 index 3538dd021..000000000 --- a/src/server/src/main/resources/db/h2/V11_0_0__custom_jmx_port.sql +++ /dev/null @@ -1,23 +0,0 @@ --- --- Copyright 2019-2019 The Last Pickle Ltd --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- --- Support for custom cluster properties --- - -ALTER TABLE cluster -ADD properties TEXT; - - diff --git a/src/server/src/main/resources/db/h2/V12_0_0__fix_repair_run_timestamps.sql b/src/server/src/main/resources/db/h2/V12_0_0__fix_repair_run_timestamps.sql deleted file mode 100644 index 30cb69d76..000000000 --- a/src/server/src/main/resources/db/h2/V12_0_0__fix_repair_run_timestamps.sql +++ /dev/null @@ -1,42 +0,0 @@ --- --- Copyright 2019-2019 The Last Pickle Ltd --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Fix timestamp inconsistencies in the repair_run table --- - -UPDATE repair_run -SET start_time = NULL -WHERE start_time is NOT NULL -AND state = 'NOT_STARTED'; - -UPDATE repair_run -SET end_time = NULL -WHERE end_time IS NOT NULL -AND state NOT IN ('ERROR', 'DONE', 'ABORTED', 'DELETED'); - -UPDATE repair_run -SET end_time = start_time -WHERE end_time IS NULL -AND state IN ('ERROR', 'DONE', 'ABORTED', 'DELETED'); - -UPDATE repair_run -SET start_time = end_time -WHERE start_time is NULL -AND end_time IS NOT NULL; - -UPDATE repair_run -SET pause_time = start_time -WHERE pause_time IS NULL -AND state = 'PAUSED'; diff --git a/src/server/src/main/resources/db/h2/V13_0_0__fix_repair_run_timestamps.sql b/src/server/src/main/resources/db/h2/V13_0_0__fix_repair_run_timestamps.sql deleted file mode 100644 index ba6debb94..000000000 --- a/src/server/src/main/resources/db/h2/V13_0_0__fix_repair_run_timestamps.sql +++ /dev/null @@ -1,32 +0,0 @@ --- --- Copyright 2019-2019 The Last Pickle Ltd --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Fix timestamp inconsistencies in the repair_run table --- - -UPDATE repair_run -SET end_time = NULL -WHERE end_time IS NOT NULL -AND state NOT IN ('ERROR', 'DONE', 'ABORTED', 'DELETED'); - -UPDATE repair_run -SET end_time = start_time -WHERE end_time IS NULL -AND state IN ('ERROR', 'DONE', 'ABORTED', 'DELETED'); - -UPDATE repair_run -SET pause_time = CAST(NULL as TIMESTAMP WITH TIME ZONE) -WHERE pause_time IS NOT NULL -AND state <> 'PAUSED'; diff --git a/src/server/src/main/resources/db/h2/V14_0_0__repair_run_tables.sql b/src/server/src/main/resources/db/h2/V14_0_0__repair_run_tables.sql deleted file mode 100644 index 8586c0a56..000000000 --- a/src/server/src/main/resources/db/h2/V14_0_0__repair_run_tables.sql +++ /dev/null @@ -1,20 +0,0 @@ --- --- Copyright 2019-2019 The Last Pickle Ltd --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Upgrade to handle the new segment count per node --- - -ALTER TABLE repair_run -ADD tables ARRAY; diff --git a/src/server/src/main/resources/db/h2/V15_0_0__cluster_states.sql b/src/server/src/main/resources/db/h2/V15_0_0__cluster_states.sql deleted file mode 100644 index 50871027c..000000000 --- a/src/server/src/main/resources/db/h2/V15_0_0__cluster_states.sql +++ /dev/null @@ -1,22 +0,0 @@ --- --- Copyright 2019-2019 The Last Pickle Ltd --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Upgrade to store cluster state and last jmx connection time - -ALTER TABLE cluster -ADD state TEXT; - -ALTER TABLE cluster -ADD last_contact TIMESTAMP; diff --git a/src/server/src/main/resources/db/h2/V16_0_0__diag_event_subscription.sql b/src/server/src/main/resources/db/h2/V16_0_0__diag_event_subscription.sql deleted file mode 100644 index 4ecf19389..000000000 --- a/src/server/src/main/resources/db/h2/V16_0_0__diag_event_subscription.sql +++ /dev/null @@ -1,29 +0,0 @@ --- --- Copyright 2018-2018 Stefan Podkowinski --- Copyright 2019-2019 The Last Pickle Ltd --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Diagnostic event subscriptions --- - -CREATE TABLE IF NOT EXISTS diag_event_subscription ( - id SERIAL PRIMARY KEY, - cluster VARCHAR NOT NULL, - description VARCHAR, - include_nodes ARRAY NOT NULL, - events ARRAY NOT NULL, - export_sse BOOLEAN NOT NULL DEFAULT FALSE, - export_file_logger VARCHAR NULL, - export_http_endpoint VARCHAR NULL -); diff --git a/src/server/src/main/resources/db/h2/V17_0_0__multi_instance.sql b/src/server/src/main/resources/db/h2/V17_0_0__multi_instance.sql deleted file mode 100644 index 98494bbe2..000000000 --- a/src/server/src/main/resources/db/h2/V17_0_0__multi_instance.sql +++ /dev/null @@ -1,29 +0,0 @@ --- H2-compatible version of multi-instance reaper Postgres DDL --- CHANGES: --- node VARCHAR --> node VARCHAR(255) because H2 doesn't support index on VARCHAR - -CREATE TABLE IF NOT EXISTS leader ( - leader_id BIGINT PRIMARY KEY, - reaper_instance_id BIGINT, - reaper_instance_host VARCHAR, - last_heartbeat TIMESTAMP WITH TIME ZONE -); - -CREATE TABLE IF NOT EXISTS running_reapers ( - reaper_instance_id BIGINT PRIMARY KEY, - reaper_instance_host VARCHAR, - last_heartbeat TIMESTAMP WITH TIME ZONE -); - -CREATE TABLE IF NOT EXISTS node_metrics_v1 ( - run_id BIGINT, - ts TIMESTAMP WITH TIME ZONE, - node VARCHAR, - cluster VARCHAR, - datacenter VARCHAR, - requested BOOLEAN, - pending_compactions INT, - has_repair_running BOOLEAN, - active_anticompactions INT, - PRIMARY KEY (run_id, ts, node) -); \ No newline at end of file diff --git a/src/server/src/main/resources/db/h2/V18_0_0__sidecar_mode.sql b/src/server/src/main/resources/db/h2/V18_0_0__sidecar_mode.sql deleted file mode 100644 index 5b71e0cad..000000000 --- a/src/server/src/main/resources/db/h2/V18_0_0__sidecar_mode.sql +++ /dev/null @@ -1,34 +0,0 @@ -CREATE TABLE IF NOT EXISTS node_metrics_v2_source_nodes ( - source_node_id SERIAL UNIQUE, - cluster VARCHAR, - host VARCHAR, - last_updated TIMESTAMP WITH TIME ZONE, - PRIMARY KEY (cluster, host) -); - -CREATE TABLE IF NOT EXISTS node_metrics_v2_metric_types ( - metric_type_id SERIAL UNIQUE, - metric_domain VARCHAR, - metric_type VARCHAR, - metric_scope VARCHAR, - metric_name VARCHAR, - metric_attribute VARCHAR, - PRIMARY KEY (metric_domain, metric_type, metric_scope, metric_name, metric_attribute) -); - -CREATE TABLE IF NOT EXISTS node_metrics_v2 ( - metric_type_id INT, - source_node_id INT, - ts TIMESTAMP WITH TIME ZONE, - value DOUBLE PRECISION, - PRIMARY KEY (metric_type_id, source_node_id, ts) -); - -CREATE TABLE IF NOT EXISTS node_operations ( - cluster VARCHAR, - type VARCHAR, - host VARCHAR, - ts TIMESTAMP WITH TIME ZONE, - data VARCHAR, - PRIMARY KEY (cluster, type, host, ts) -); diff --git a/src/server/src/main/resources/db/h2/V19_0_0__list_replicas_segment.sql b/src/server/src/main/resources/db/h2/V19_0_0__list_replicas_segment.sql deleted file mode 100644 index 10d83b3eb..000000000 --- a/src/server/src/main/resources/db/h2/V19_0_0__list_replicas_segment.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE repair_segment -ADD replicas VARCHAR; \ No newline at end of file diff --git a/src/server/src/main/resources/db/h2/V1_0_1__Initial_reaper_h2_db.sql b/src/server/src/main/resources/db/h2/V1_0_1__Initial_reaper_h2_db.sql deleted file mode 100644 index d719d9f3d..000000000 --- a/src/server/src/main/resources/db/h2/V1_0_1__Initial_reaper_h2_db.sql +++ /dev/null @@ -1,98 +0,0 @@ --- --- Copyright 2017-2017 Spotify AB --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- H2 schema for cassandra-reaper database --- - --- For cleaning up the database, just do first in the following order: --- DROP TABLE repair_segment; --- DROP TABLE repair_run; --- DROP TABLE repair_schedule; --- DROP TABLE repair_unit; --- DROP TABLE cluster; - -CREATE TABLE IF NOT EXISTS cluster ( - name VARCHAR PRIMARY KEY, - partitioner VARCHAR NOT NULL, - seed_hosts ARRAY NOT NULL -); - --- Repair unit is basically a keyspace with a set of column families. --- Cassandra supports repairing multiple column families in one go. --- -CREATE TABLE IF NOT EXISTS repair_unit ( - id SERIAL PRIMARY KEY, - cluster_name VARCHAR NOT NULL REFERENCES cluster (name), - keyspace_name VARCHAR NOT NULL, - column_families ARRAY NOT NULL, - incremental_repair BOOLEAN NOT NULL -); - -CREATE INDEX IF NOT EXISTS repair_unit_column_families_gin_idx ON repair_unit (column_families); - - -CREATE TABLE IF NOT EXISTS repair_run ( - id SERIAL PRIMARY KEY, - cluster_name VARCHAR NOT NULL REFERENCES cluster (name), - repair_unit_id INT NOT NULL REFERENCES repair_unit (id), - cause VARCHAR NOT NULL, - owner VARCHAR NOT NULL, --- see (Java) RepairRun.RunState for state values - state VARCHAR NOT NULL, - creation_time TIMESTAMP NOT NULL, - start_time TIMESTAMP DEFAULT NULL, - end_time TIMESTAMP DEFAULT NULL, - pause_time TIMESTAMP DEFAULT NULL, - intensity REAL NOT NULL, - last_event VARCHAR NOT NULL, - segment_count INT NOT NULL, - repair_parallelism VARCHAR NOT NULL -); - -CREATE TABLE IF NOT EXISTS repair_segment ( - id SERIAL PRIMARY KEY, - repair_unit_id INT NOT NULL REFERENCES repair_unit (id), - run_id INT NOT NULL REFERENCES repair_run (id), - start_token NUMERIC(50) NOT NULL, - end_token NUMERIC(50) NOT NULL, --- see (Java) RepairSegment.State for state values - state SMALLINT NOT NULL, - coordinator_host VARCHAR DEFAULT NULL, - start_time TIMESTAMP DEFAULT NULL, - end_time TIMESTAMP DEFAULT NULL, - fail_count INT NOT NULL DEFAULT 0 -); - -CREATE INDEX IF NOT EXISTS repair_segment_run_id_fail_count_idx ON repair_segment (run_id ASC, fail_count ASC); - -CREATE INDEX IF NOT EXISTS repair_segment_state_idx ON repair_segment (state); - -CREATE TABLE IF NOT EXISTS repair_schedule ( - id SERIAL PRIMARY KEY, - repair_unit_id INT NOT NULL REFERENCES repair_unit (id), --- see (Java) RepairSchedule.State for state values - state VARCHAR NOT NULL, - days_between SMALLINT NOT NULL, - next_activation TIMESTAMP NOT NULL, --- run_history contains repair run ids, with latest scheduled run in the end - run_history ARRAY NOT NULL, - segment_count INT NOT NULL, - repair_parallelism VARCHAR NOT NULL, - intensity REAL NOT NULL, - creation_time TIMESTAMP NOT NULL, - owner VARCHAR NOT NULL, - pause_time TIMESTAMP DEFAULT NULL -); - diff --git a/src/server/src/main/resources/db/h2/V20_0_0__concurrent_repairs.sql b/src/server/src/main/resources/db/h2/V20_0_0__concurrent_repairs.sql deleted file mode 100644 index 93bd9d0cc..000000000 --- a/src/server/src/main/resources/db/h2/V20_0_0__concurrent_repairs.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE IF NOT EXISTS running_repairs ( - repair_id BIGINT, - node VARCHAR, - reaper_instance_host VARCHAR, - reaper_instance_id BIGINT, - segment_id INT, - last_heartbeat TIMESTAMP WITH TIME ZONE, - PRIMARY KEY(repair_id, node) -); \ No newline at end of file diff --git a/src/server/src/main/resources/db/h2/V21_0_0__percent_repaired_schedule.sql b/src/server/src/main/resources/db/h2/V21_0_0__percent_repaired_schedule.sql deleted file mode 100644 index 99b3835e8..000000000 --- a/src/server/src/main/resources/db/h2/V21_0_0__percent_repaired_schedule.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE IF NOT EXISTS percent_repaired_by_schedule ( - cluster VARCHAR, - repair_schedule_id BIGINT, - node VARCHAR, - keyspace_name VARCHAR, - table_name VARCHAR, - percent_repaired INT, - ts TIMESTAMP WITH TIME ZONE, - PRIMARY KEY(cluster, repair_schedule_id, node) -); \ No newline at end of file diff --git a/src/server/src/main/resources/db/h2/V2_0_0__specific_nodes_repair.sql b/src/server/src/main/resources/db/h2/V2_0_0__specific_nodes_repair.sql deleted file mode 100644 index a62a8e7b2..000000000 --- a/src/server/src/main/resources/db/h2/V2_0_0__specific_nodes_repair.sql +++ /dev/null @@ -1,23 +0,0 @@ --- --- Copyright 2017-2017 Spotify AB --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- H2 schema addition for repair on specific nodes --- - -ALTER TABLE repair_unit -ADD nodes ARRAY; - -ALTER TABLE repair_unit -ADD datacenters ARRAY; diff --git a/src/server/src/main/resources/db/h2/V3_0_0__table_blacklist.sql b/src/server/src/main/resources/db/h2/V3_0_0__table_blacklist.sql deleted file mode 100644 index df2e78eea..000000000 --- a/src/server/src/main/resources/db/h2/V3_0_0__table_blacklist.sql +++ /dev/null @@ -1,20 +0,0 @@ --- --- Copyright 2017-2017 Spotify AB --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- H2 schema addition for repair on specific nodes --- - -ALTER TABLE repair_unit -ADD blacklisted_tables ARRAY; diff --git a/src/server/src/main/resources/db/h2/V4_0_0__segment_count_per_node.sql b/src/server/src/main/resources/db/h2/V4_0_0__segment_count_per_node.sql deleted file mode 100644 index 63a1f06ea..000000000 --- a/src/server/src/main/resources/db/h2/V4_0_0__segment_count_per_node.sql +++ /dev/null @@ -1,20 +0,0 @@ --- --- Copyright 2017-2017 Spotify AB --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Upgrade to handle the new segment count per node --- - -ALTER TABLE repair_schedule -ADD segment_count_per_node INT NOT NULL DEFAULT 0; diff --git a/src/server/src/main/resources/db/h2/V5_0_0__fix_repair_segment_table.sql b/src/server/src/main/resources/db/h2/V5_0_0__fix_repair_segment_table.sql deleted file mode 100644 index 03c7c787e..000000000 --- a/src/server/src/main/resources/db/h2/V5_0_0__fix_repair_segment_table.sql +++ /dev/null @@ -1,30 +0,0 @@ --- --- Copyright 2017-2017 Spotify AB --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Fix inconsistencies in the repair_segment table --- to comply with new safety policies on segments --- - -UPDATE repair_segment -SET end_time = NULL -WHERE end_time IS NOT NULL -AND state != 2; - -UPDATE repair_segment -SET start_time = end_time -WHERE start_time is NULL -AND end_time IS NOT NULL; - - diff --git a/src/server/src/main/resources/db/h2/V6_0_0__fix_repair_segment_table.sql b/src/server/src/main/resources/db/h2/V6_0_0__fix_repair_segment_table.sql deleted file mode 100644 index 811dfd4b7..000000000 --- a/src/server/src/main/resources/db/h2/V6_0_0__fix_repair_segment_table.sql +++ /dev/null @@ -1,24 +0,0 @@ --- --- Copyright 2017-2017 Spotify AB --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- fix segment start and end times in the repair_run table --- - -UPDATE repair_segment -SET start_time = end_time -WHERE start_time is NULL -AND end_time IS NOT NULL; - - diff --git a/src/server/src/main/resources/db/h2/V7_0_0__fix_repair_segment_table.sql b/src/server/src/main/resources/db/h2/V7_0_0__fix_repair_segment_table.sql deleted file mode 100644 index 811dfd4b7..000000000 --- a/src/server/src/main/resources/db/h2/V7_0_0__fix_repair_segment_table.sql +++ /dev/null @@ -1,24 +0,0 @@ --- --- Copyright 2017-2017 Spotify AB --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- fix segment start and end times in the repair_run table --- - -UPDATE repair_segment -SET start_time = end_time -WHERE start_time is NULL -AND end_time IS NOT NULL; - - diff --git a/src/server/src/main/resources/db/h2/V8_0_0__snapshots.sql b/src/server/src/main/resources/db/h2/V8_0_0__snapshots.sql deleted file mode 100644 index c572fdb4e..000000000 --- a/src/server/src/main/resources/db/h2/V8_0_0__snapshots.sql +++ /dev/null @@ -1,27 +0,0 @@ --- --- Copyright 2018-2018 The Last Pickle Ltd --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Support for snapshots --- - -CREATE TABLE IF NOT EXISTS snapshot ( - cluster VARCHAR, - snapshot_name VARCHAR, - owner VARCHAR, - cause VARCHAR, - creation_time TIMESTAMP NOT NULL, - PRIMARY KEY(cluster, snapshot_name) -); - diff --git a/src/server/src/main/resources/db/h2/V9_0_0__coalesce_segments.sql b/src/server/src/main/resources/db/h2/V9_0_0__coalesce_segments.sql deleted file mode 100644 index d8788fa6e..000000000 --- a/src/server/src/main/resources/db/h2/V9_0_0__coalesce_segments.sql +++ /dev/null @@ -1,22 +0,0 @@ --- --- Copyright 2018-2018 The Last Pickle Ltd --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Support for segment coalescing --- - -ALTER TABLE repair_segment -ADD token_ranges VARCHAR; - - diff --git a/src/server/src/main/resources/db/postgres/V10_0_0__repair_thread_count.sql b/src/server/src/main/resources/db/postgres/V10_0_0__repair_thread_count.sql deleted file mode 100644 index 4f636d435..000000000 --- a/src/server/src/main/resources/db/postgres/V10_0_0__repair_thread_count.sql +++ /dev/null @@ -1,22 +0,0 @@ --- --- Copyright 2018-2018 The Last Pickle Ltd --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Support for segment coalescing --- - -ALTER TABLE "repair_unit" -ADD "repair_thread_count" INT; - - diff --git a/src/server/src/main/resources/db/postgres/V11_0_0__custom_jmx_port.sql b/src/server/src/main/resources/db/postgres/V11_0_0__custom_jmx_port.sql deleted file mode 100644 index a093a82d5..000000000 --- a/src/server/src/main/resources/db/postgres/V11_0_0__custom_jmx_port.sql +++ /dev/null @@ -1,23 +0,0 @@ --- --- Copyright 2019-2019 The Last Pickle Ltd --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- --- Support for custom cluster properties --- - -ALTER TABLE "cluster" -ADD "properties" TEXT; - - diff --git a/src/server/src/main/resources/db/postgres/V12_0_0__fix_repair_run_timestamps.sql b/src/server/src/main/resources/db/postgres/V12_0_0__fix_repair_run_timestamps.sql deleted file mode 100644 index 8c9fc38bf..000000000 --- a/src/server/src/main/resources/db/postgres/V12_0_0__fix_repair_run_timestamps.sql +++ /dev/null @@ -1,42 +0,0 @@ --- --- Copyright 2019-2019 The Last Pickle Ltd --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Fix timestamp inconsistencies in the repair_run table --- - -UPDATE repair_run -SET start_time = CAST(NULL as TIMESTAMP WITH TIME ZONE) -WHERE start_time is NOT NULL -AND state = 'NOT_STARTED'; - -UPDATE repair_run -SET end_time = CAST(NULL as TIMESTAMP WITH TIME ZONE) -WHERE end_time IS NOT NULL -AND state NOT IN ('ERROR', 'DONE', 'ABORTED', 'DELETED'); - -UPDATE repair_run -SET end_time = start_time -WHERE end_time IS NULL -AND state IN ('ERROR', 'DONE', 'ABORTED', 'DELETED'); - -UPDATE repair_run -SET start_time = end_time -WHERE start_time is NULL -AND end_time IS NOT NULL; - -UPDATE repair_run -SET pause_time = start_time -WHERE pause_time IS NULL -AND state = 'PAUSED'; diff --git a/src/server/src/main/resources/db/postgres/V13_0_0__fix_repair_run_timestamps_.sql b/src/server/src/main/resources/db/postgres/V13_0_0__fix_repair_run_timestamps_.sql deleted file mode 100644 index 5e6cfb071..000000000 --- a/src/server/src/main/resources/db/postgres/V13_0_0__fix_repair_run_timestamps_.sql +++ /dev/null @@ -1,32 +0,0 @@ --- --- Copyright 2019-2019 The Last Pickle Ltd --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Fix timestamp inconsistencies in the repair_run table --- - -UPDATE repair_run -SET end_time = CAST(NULL as TIMESTAMP WITH TIME ZONE) -WHERE end_time IS NOT NULL -AND state NOT IN ('ERROR', 'DONE', 'ABORTED', 'DELETED'); - -UPDATE repair_run -SET end_time = start_time -WHERE end_time IS NULL -AND state IN ('ERROR', 'DONE', 'ABORTED', 'DELETED'); - -UPDATE repair_run -SET pause_time = CAST(NULL as TIMESTAMP WITH TIME ZONE) -WHERE pause_time IS NOT NULL -AND state <> 'PAUSED'; diff --git a/src/server/src/main/resources/db/postgres/V14_0_0__repair_run_tables.sql b/src/server/src/main/resources/db/postgres/V14_0_0__repair_run_tables.sql deleted file mode 100644 index 18f746e53..000000000 --- a/src/server/src/main/resources/db/postgres/V14_0_0__repair_run_tables.sql +++ /dev/null @@ -1,20 +0,0 @@ --- --- Copyright 2019-2019 The Last Pickle Ltd --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Upgrade to handle the new segment count per node --- - -ALTER TABLE "repair_run" -ADD "tables" TEXT []; diff --git a/src/server/src/main/resources/db/postgres/V15_0_0__cluster_states.sql b/src/server/src/main/resources/db/postgres/V15_0_0__cluster_states.sql deleted file mode 100644 index d44a7fb22..000000000 --- a/src/server/src/main/resources/db/postgres/V15_0_0__cluster_states.sql +++ /dev/null @@ -1,22 +0,0 @@ --- --- Copyright 2019-2019 The Last Pickle Ltd --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Upgrade to store cluster state and last jmx connection time - -ALTER TABLE "cluster" -ADD "state" TEXT; - -ALTER TABLE "cluster" -ADD "last_contact" TIMESTAMP; diff --git a/src/server/src/main/resources/db/postgres/V16_0_0__diag_event_subscription.sql b/src/server/src/main/resources/db/postgres/V16_0_0__diag_event_subscription.sql deleted file mode 100644 index ac7a76144..000000000 --- a/src/server/src/main/resources/db/postgres/V16_0_0__diag_event_subscription.sql +++ /dev/null @@ -1,29 +0,0 @@ --- --- Copyright 2018-2018 Stefan Podkowinski --- Copyright 2019-2019 The Last Pickle Ltd --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Diagnostic event subscriptions --- - -CREATE TABLE IF NOT EXISTS "diag_event_subscription" ( - "id" SERIAL PRIMARY KEY, - "cluster" VARCHAR NOT NULL, - "description" VARCHAR, - "include_nodes" TEXT [] NOT NULL, - "events" TEXT [] NOT NULL, - "export_sse" BOOLEAN NOT NULL DEFAULT FALSE, - "export_file_logger" VARCHAR NULL, - "export_http_endpoint" VARCHAR NULL -); diff --git a/src/server/src/main/resources/db/postgres/V17_0_0__multi_instance.sql b/src/server/src/main/resources/db/postgres/V17_0_0__multi_instance.sql deleted file mode 100644 index fe39e7891..000000000 --- a/src/server/src/main/resources/db/postgres/V17_0_0__multi_instance.sql +++ /dev/null @@ -1,25 +0,0 @@ -CREATE TABLE IF NOT EXISTS "leader" ( - "leader_id" BIGINT PRIMARY KEY, - "reaper_instance_id" BIGINT, - "reaper_instance_host" TEXT, - "last_heartbeat" TIMESTAMP WITH TIME ZONE -); - -CREATE TABLE IF NOT EXISTS "running_reapers" ( - "reaper_instance_id" BIGINT PRIMARY KEY, - "reaper_instance_host" TEXT, - "last_heartbeat" TIMESTAMP WITH TIME ZONE -); - -CREATE TABLE IF NOT EXISTS "node_metrics_v1" ( - "run_id" BIGINT, - "ts" TIMESTAMP WITH TIME ZONE, - "node" TEXT, - "cluster" TEXT, - "datacenter" TEXT, - "requested" BOOLEAN, - "pending_compactions" INT, - "has_repair_running" BOOLEAN, - "active_anticompactions" INT, - PRIMARY KEY("run_id", "ts", "node") -); diff --git a/src/server/src/main/resources/db/postgres/V18_0_0__sidecar_mode.sql b/src/server/src/main/resources/db/postgres/V18_0_0__sidecar_mode.sql deleted file mode 100644 index 761d9e934..000000000 --- a/src/server/src/main/resources/db/postgres/V18_0_0__sidecar_mode.sql +++ /dev/null @@ -1,34 +0,0 @@ -CREATE TABLE IF NOT EXISTS "node_metrics_v2_source_nodes" ( - "source_node_id" SERIAL UNIQUE, - "cluster" TEXT, - "host" TEXT, - "last_updated" TIMESTAMP WITH TIME ZONE, - PRIMARY KEY ("cluster", "host") -); - -CREATE TABLE IF NOT EXISTS "node_metrics_v2_metric_types" ( - "metric_type_id" SERIAL UNIQUE, - "metric_domain" TEXT, - "metric_type" TEXT, - "metric_scope" TEXT, - "metric_name" TEXT, - "metric_attribute" TEXT, - PRIMARY KEY ("metric_domain", "metric_type", "metric_scope", "metric_name", "metric_attribute") -); - -CREATE TABLE IF NOT EXISTS "node_metrics_v2" ( - "metric_type_id" INT REFERENCES "node_metrics_v2_metric_types"("metric_type_id"), - "source_node_id" INT REFERENCES "node_metrics_v2_source_nodes"("source_node_id"), - "ts" TIMESTAMP WITH TIME ZONE, - "value" DOUBLE PRECISION, - PRIMARY KEY ("metric_type_id", "source_node_id", "ts") -); - -CREATE TABLE IF NOT EXISTS "node_operations" ( - "cluster" TEXT, - "type" TEXT, - "host" TEXT, - "ts" TIMESTAMP WITH TIME ZONE, - "data" TEXT, - PRIMARY KEY ("cluster", "type", "host", "ts") -); diff --git a/src/server/src/main/resources/db/postgres/V19_0_0__list_replicas_segment.sql b/src/server/src/main/resources/db/postgres/V19_0_0__list_replicas_segment.sql deleted file mode 100644 index a611645d4..000000000 --- a/src/server/src/main/resources/db/postgres/V19_0_0__list_replicas_segment.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "repair_segment" -ADD "replicas" TEXT; \ No newline at end of file diff --git a/src/server/src/main/resources/db/postgres/V1_0_1__Initial_reaper_postgres_db.sql b/src/server/src/main/resources/db/postgres/V1_0_1__Initial_reaper_postgres_db.sql deleted file mode 100644 index e7bac7d3b..000000000 --- a/src/server/src/main/resources/db/postgres/V1_0_1__Initial_reaper_postgres_db.sql +++ /dev/null @@ -1,118 +0,0 @@ --- --- Copyright 2014-2017 Spotify AB --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- PostgreSQL schema for cassandra-reaper database --- Assumes PostgreSQL version 9.3 or newer --- - --- CREATE DATABASE reaper_db; --- \connect reaper_db; --- CREATE USER reaper WITH PASSWORD 'my_secret_password'; --- GRANT ALL PRIVILEGES ON DATABASE reaper_db TO reaper; - --- For cleaning up the database, just do first in the following order: --- DROP TABLE "repair_segment"; --- DROP TABLE "repair_run"; --- DROP TABLE "repair_schedule"; --- DROP TABLE "repair_unit"; --- DROP TABLE "cluster"; - -CREATE TABLE IF NOT EXISTS "cluster" ( - "name" TEXT PRIMARY KEY, - "partitioner" TEXT NOT NULL, - "seed_hosts" TEXT [] NOT NULL -); - --- Repair unit is basically a keyspace with a set of column families. --- Cassandra supports repairing multiple column families in one go. --- -CREATE TABLE IF NOT EXISTS "repair_unit" ( - "id" SERIAL PRIMARY KEY, - "cluster_name" TEXT NOT NULL REFERENCES "cluster" ("name"), - "keyspace_name" TEXT NOT NULL, - "column_families" TEXT [] NOT NULL, - "incremental_repair" BOOLEAN NOT NULL -); - --- Using GIN index to make @> (contains) type of array operations faster -DROP INDEX IF EXISTS repair_unit_column_families_gin_idx; -CREATE INDEX repair_unit_column_families_gin_idx ON repair_unit USING GIN (column_families); - -CREATE TABLE IF NOT EXISTS "repair_run" ( - "id" SERIAL PRIMARY KEY, - "cluster_name" TEXT NOT NULL REFERENCES "cluster" ("name"), - "repair_unit_id" INT NOT NULL REFERENCES "repair_unit" ("id"), - "cause" TEXT NOT NULL, - "owner" TEXT NOT NULL, --- see (Java) RepairRun.RunState for state values - "state" TEXT NOT NULL, - "creation_time" TIMESTAMP WITH TIME ZONE NOT NULL, - "start_time" TIMESTAMP WITH TIME ZONE DEFAULT NULL, - "end_time" TIMESTAMP WITH TIME ZONE DEFAULT NULL, - "pause_time" TIMESTAMP WITH TIME ZONE DEFAULT NULL, - "intensity" REAL NOT NULL, - "last_event" TEXT NOT NULL, - "segment_count" INT NOT NULL, - "repair_parallelism" TEXT NOT NULL -); - -CREATE TABLE IF NOT EXISTS "repair_segment" ( - "id" SERIAL PRIMARY KEY, - "repair_unit_id" INT NOT NULL REFERENCES "repair_unit" ("id"), - "run_id" INT NOT NULL REFERENCES "repair_run" ("id"), - "start_token" NUMERIC(50) NOT NULL, - "end_token" NUMERIC(50) NOT NULL, --- see (Java) RepairSegment.State for state values - "state" SMALLINT NOT NULL, - "coordinator_host" TEXT DEFAULT NULL, - "start_time" TIMESTAMP WITH TIME ZONE DEFAULT NULL, - "end_time" TIMESTAMP WITH TIME ZONE DEFAULT NULL, - "fail_count" INT NOT NULL DEFAULT 0 -); - -DROP INDEX IF EXISTS "repair_segment_run_id_fail_count_idx"; -CREATE INDEX "repair_segment_run_id_fail_count_idx" -ON "repair_segment" USING BTREE ("run_id" ASC, "fail_count" ASC); - -DROP INDEX IF EXISTS "repair_segment_state_idx"; -CREATE INDEX "repair_segment_state_idx" -ON "repair_segment" USING BTREE ("state"); - -CREATE TABLE IF NOT EXISTS "repair_schedule" ( - "id" SERIAL PRIMARY KEY, - "repair_unit_id" INT NOT NULL REFERENCES "repair_unit" ("id"), --- see (Java) RepairSchedule.State for state values - "state" TEXT NOT NULL, - "days_between" SMALLINT NOT NULL, - "next_activation" TIMESTAMP WITH TIME ZONE NOT NULL, --- run_history contains repair run ids, with latest scheduled run in the end - "run_history" INT [] NOT NULL, - "segment_count" INT NOT NULL, - "repair_parallelism" TEXT NOT NULL, - "intensity" REAL NOT NULL, - "creation_time" TIMESTAMP WITH TIME ZONE NOT NULL, - "owner" TEXT NOT NULL, - "pause_time" TIMESTAMP WITH TIME ZONE DEFAULT NULL -); - --- GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE cluster TO reaper; --- GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE repair_unit TO reaper; --- GRANT USAGE, SELECT ON SEQUENCE repair_unit_id_seq TO reaper; --- GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE repair_run TO reaper; --- GRANT USAGE, SELECT ON SEQUENCE repair_run_id_seq TO reaper; --- GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE repair_segment TO reaper; --- GRANT USAGE, SELECT ON SEQUENCE repair_segment_id_seq TO reaper; --- GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE repair_schedule TO reaper; --- GRANT USAGE, SELECT ON SEQUENCE repair_schedule_id_seq TO reaper; diff --git a/src/server/src/main/resources/db/postgres/V2.0.0__specific_nodes_repair.sql b/src/server/src/main/resources/db/postgres/V2.0.0__specific_nodes_repair.sql deleted file mode 100644 index a23093b97..000000000 --- a/src/server/src/main/resources/db/postgres/V2.0.0__specific_nodes_repair.sql +++ /dev/null @@ -1,24 +0,0 @@ --- --- Copyright 2017-2017 Spotify AB --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- PostgreSQL schema addition for repair on specific nodes --- - - -ALTER TABLE "repair_unit" -ADD "nodes" TEXT []; - -ALTER TABLE "repair_unit" -ADD "datacenters" TEXT []; diff --git a/src/server/src/main/resources/db/postgres/V20_0_0__concurrent_repairs.sql b/src/server/src/main/resources/db/postgres/V20_0_0__concurrent_repairs.sql deleted file mode 100644 index 1b12ccdaa..000000000 --- a/src/server/src/main/resources/db/postgres/V20_0_0__concurrent_repairs.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE IF NOT EXISTS "running_repairs" ( - "repair_id" BIGINT, - "node" TEXT, - "reaper_instance_host" TEXT, - "reaper_instance_id" BIGINT, - "segment_id" BIGINT, - "last_heartbeat" TIMESTAMP WITH TIME ZONE, - PRIMARY KEY("repair_id", "node") -); - diff --git a/src/server/src/main/resources/db/postgres/V21_0_0__percent_repaired_schedule.sql b/src/server/src/main/resources/db/postgres/V21_0_0__percent_repaired_schedule.sql deleted file mode 100644 index afce85fb8..000000000 --- a/src/server/src/main/resources/db/postgres/V21_0_0__percent_repaired_schedule.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE IF NOT EXISTS "percent_repaired_by_schedule" ( - "cluster" TEXT, - "repair_schedule_id" BIGINT, - "node" TEXT, - "keyspace_name" TEXT, - "table_name" TEXT, - "percent_repaired" INT, - "ts" TIMESTAMP WITH TIME ZONE, - PRIMARY KEY("cluster", "repair_schedule_id", "node") -); \ No newline at end of file diff --git a/src/server/src/main/resources/db/postgres/V3.0.0__table_blacklist.sql b/src/server/src/main/resources/db/postgres/V3.0.0__table_blacklist.sql deleted file mode 100644 index 94cf6abe9..000000000 --- a/src/server/src/main/resources/db/postgres/V3.0.0__table_blacklist.sql +++ /dev/null @@ -1,21 +0,0 @@ --- --- Copyright 2017-2017 Spotify AB --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- PostgreSQL schema addition for repair on specific nodes --- - - -ALTER TABLE "repair_unit" -ADD "blacklisted_tables" TEXT []; diff --git a/src/server/src/main/resources/db/postgres/V4.0.0__segment_count_per_node.sql b/src/server/src/main/resources/db/postgres/V4.0.0__segment_count_per_node.sql deleted file mode 100644 index df2e6bec7..000000000 --- a/src/server/src/main/resources/db/postgres/V4.0.0__segment_count_per_node.sql +++ /dev/null @@ -1,21 +0,0 @@ --- --- Copyright 2017-2017 Spotify AB --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Upgrade to handle the new segment count per node --- - - -ALTER TABLE "repair_schedule" -ADD "segment_count_per_node" INT NOT NULL DEFAULT 0; diff --git a/src/server/src/main/resources/db/postgres/V5_0_0__fix_repair_segment_table.sql b/src/server/src/main/resources/db/postgres/V5_0_0__fix_repair_segment_table.sql deleted file mode 100644 index 03c7c787e..000000000 --- a/src/server/src/main/resources/db/postgres/V5_0_0__fix_repair_segment_table.sql +++ /dev/null @@ -1,30 +0,0 @@ --- --- Copyright 2017-2017 Spotify AB --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Fix inconsistencies in the repair_segment table --- to comply with new safety policies on segments --- - -UPDATE repair_segment -SET end_time = NULL -WHERE end_time IS NOT NULL -AND state != 2; - -UPDATE repair_segment -SET start_time = end_time -WHERE start_time is NULL -AND end_time IS NOT NULL; - - diff --git a/src/server/src/main/resources/db/postgres/V6_0_0__fix_repair_segment_table.sql b/src/server/src/main/resources/db/postgres/V6_0_0__fix_repair_segment_table.sql deleted file mode 100644 index 811dfd4b7..000000000 --- a/src/server/src/main/resources/db/postgres/V6_0_0__fix_repair_segment_table.sql +++ /dev/null @@ -1,24 +0,0 @@ --- --- Copyright 2017-2017 Spotify AB --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- fix segment start and end times in the repair_run table --- - -UPDATE repair_segment -SET start_time = end_time -WHERE start_time is NULL -AND end_time IS NOT NULL; - - diff --git a/src/server/src/main/resources/db/postgres/V7_0_0__fix_repair_segment_table.sql b/src/server/src/main/resources/db/postgres/V7_0_0__fix_repair_segment_table.sql deleted file mode 100644 index 811dfd4b7..000000000 --- a/src/server/src/main/resources/db/postgres/V7_0_0__fix_repair_segment_table.sql +++ /dev/null @@ -1,24 +0,0 @@ --- --- Copyright 2017-2017 Spotify AB --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- fix segment start and end times in the repair_run table --- - -UPDATE repair_segment -SET start_time = end_time -WHERE start_time is NULL -AND end_time IS NOT NULL; - - diff --git a/src/server/src/main/resources/db/postgres/V8_0_0__snapshots.sql b/src/server/src/main/resources/db/postgres/V8_0_0__snapshots.sql deleted file mode 100644 index 19daa3c9e..000000000 --- a/src/server/src/main/resources/db/postgres/V8_0_0__snapshots.sql +++ /dev/null @@ -1,28 +0,0 @@ --- --- Copyright 2018-2018 The Last Pickle Ltd --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Support for snapshots --- - -CREATE TABLE IF NOT EXISTS "snapshot" ( - "cluster" text, - "snapshot_name" text, - "owner" text, - "cause" text, - "creation_time" TIMESTAMP WITH TIME ZONE NOT NULL, - PRIMARY KEY("cluster","snapshot_name") -); - - diff --git a/src/server/src/main/resources/db/postgres/V9_0_0__coalesce_segments.sql b/src/server/src/main/resources/db/postgres/V9_0_0__coalesce_segments.sql deleted file mode 100644 index 31d95a4eb..000000000 --- a/src/server/src/main/resources/db/postgres/V9_0_0__coalesce_segments.sql +++ /dev/null @@ -1,22 +0,0 @@ --- --- Copyright 2018-2018 The Last Pickle Ltd --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Support for segment coalescing --- - -ALTER TABLE "repair_segment" -ADD "token_ranges" TEXT; - -