123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437 |
- # Copyright Materialize, Inc. and contributors. All rights reserved.
- #
- # Use of this software is governed by the Business Source License
- # included in the LICENSE file at the root of this repository.
- #
- # As of the Change Date specified in that file, in accordance with
- # the Business Source License, use of this software will be governed
- # by the Apache License, Version 2.0.
- from materialize.zippy.all_actions import Action, ValidateAll # noqa
- from materialize.zippy.backup_and_restore_actions import BackupAndRestore
- from materialize.zippy.balancerd_actions import (
- BalancerdRestart,
- BalancerdStart,
- BalancerdStop,
- )
- from materialize.zippy.blob_store_actions import BlobStoreRestart, BlobStoreStart
- from materialize.zippy.crdb_actions import CockroachRestart, CockroachStart
- from materialize.zippy.debezium_actions import CreateDebeziumSource, DebeziumStart
- from materialize.zippy.framework import ActionFactory, ActionOrFactory # noqa
- from materialize.zippy.kafka_actions import (
- CreateTopicParameterized,
- Ingest,
- KafkaInsertParallel,
- KafkaStart,
- )
- from materialize.zippy.kafka_capabilities import Envelope
- from materialize.zippy.mysql_actions import (
- CreateMySqlTable,
- MySqlDML,
- MySqlRestart,
- MySqlStart,
- )
- from materialize.zippy.mysql_cdc_actions import CreateMySqlCdcTable
- from materialize.zippy.mz_actions import (
- KillClusterd,
- Mz0dtDeploy,
- MzRestart,
- MzStart,
- MzStop,
- )
- from materialize.zippy.peek_actions import PeekCancellation
- from materialize.zippy.pg_cdc_actions import CreatePostgresCdcTable
- from materialize.zippy.postgres_actions import (
- CreatePostgresTable,
- PostgresDML,
- PostgresRestart,
- PostgresStart,
- )
- from materialize.zippy.replica_actions import (
- CreateReplica,
- DropDefaultReplica,
- DropReplica,
- )
- from materialize.zippy.sink_actions import CreateSinkParameterized
- from materialize.zippy.source_actions import (
- AlterSourceConnectionParameterized,
- CreateSourceParameterized,
- )
- from materialize.zippy.storaged_actions import (
- StoragedKill,
- StoragedRestart,
- StoragedStart,
- )
- from materialize.zippy.table_actions import DML, CreateTableParameterized, ValidateTable
- from materialize.zippy.view_actions import CreateViewParameterized, ValidateView
- class Scenario:
- def bootstrap(self) -> list[ActionOrFactory]:
- return [
- KafkaStart,
- CockroachStart,
- BlobStoreStart,
- MzStart,
- StoragedStart,
- BalancerdStart,
- ]
- def actions_with_weight(self) -> dict[ActionOrFactory, float]:
- raise RuntimeError
- def finalization(self) -> list[ActionOrFactory]:
- return [
- MzStart,
- BalancerdStart,
- StoragedStart,
- ValidateAll(),
- BackupAndRestore,
- ValidateAll(),
- ]
- class KafkaSources(Scenario):
- """A Zippy test using Kafka sources exclusively."""
- def actions_with_weight(self) -> dict[ActionOrFactory, float]:
- return {
- MzStart: 5,
- MzStop: 1,
- Mz0dtDeploy: 5,
- KillClusterd: 5,
- # Disabled because a separate clusterd is not supported by Mz0dtDeploy yet
- # StoragedKill: 5,
- # StoragedStart: 5,
- CreateTopicParameterized(): 5,
- CreateSourceParameterized(): 5,
- CreateViewParameterized(max_inputs=2): 5,
- CreateSinkParameterized(): 5,
- ValidateView: 10,
- Ingest: 100,
- PeekCancellation: 5,
- }
- class AlterConnectionWithKafkaSources(Scenario):
- """A Zippy test using Kafka sources and alter connections."""
- def actions_with_weight(self) -> dict[ActionOrFactory, float]:
- return {
- MzStart: 5,
- MzStop: 1,
- Mz0dtDeploy: 1,
- KillClusterd: 5,
- # Disabled because a separate clusterd is not supported by Mz0dtDeploy yet
- # StoragedKill: 5,
- # StoragedStart: 5,
- CreateTopicParameterized(): 5,
- CreateSourceParameterized(): 5,
- CreateViewParameterized(max_inputs=2): 5,
- CreateSinkParameterized(): 5,
- AlterSourceConnectionParameterized(): 5,
- ValidateView: 10,
- Ingest: 100,
- PeekCancellation: 5,
- }
- class UserTables(Scenario):
- """A Zippy test using user tables exclusively."""
- def actions_with_weight(self) -> dict[ActionOrFactory, float]:
- return {
- MzStart: 5,
- BalancerdStart: 1,
- MzStop: 10,
- Mz0dtDeploy: 10,
- BalancerdStop: 1,
- BalancerdRestart: 1,
- BackupAndRestore: 1,
- KillClusterd: 10,
- # Disabled because a separate clusterd is not supported by Mz0dtDeploy yet
- # StoragedRestart: 5,
- CreateTableParameterized(): 10,
- CreateViewParameterized(): 10,
- CreateSinkParameterized(): 10,
- ValidateTable: 20,
- ValidateView: 20,
- DML: 30,
- }
- class DebeziumPostgres(Scenario):
- """A Zippy test using Debezium Postgres exclusively."""
- def bootstrap(self) -> list[ActionOrFactory]:
- return super().bootstrap() + [
- DebeziumStart,
- PostgresStart,
- ]
- def actions_with_weight(self) -> dict[ActionOrFactory, float]:
- return {
- CreatePostgresTable: 10,
- CreateDebeziumSource: 10,
- KillClusterd: 5,
- StoragedKill: 5,
- StoragedStart: 5,
- CreateViewParameterized(): 10,
- ValidateView: 20,
- PostgresDML: 100,
- }
- class PostgresCdc(Scenario):
- """A Zippy test using Postgres CDC exclusively."""
- def bootstrap(self) -> list[ActionOrFactory]:
- return super().bootstrap() + [PostgresStart]
- def actions_with_weight(self) -> dict[ActionOrFactory, float]:
- return {
- CreatePostgresTable: 10,
- CreatePostgresCdcTable: 10,
- KillClusterd: 5,
- StoragedKill: 5,
- StoragedStart: 5,
- PostgresRestart: 10,
- CreateViewParameterized(): 10,
- ValidateView: 20,
- PostgresDML: 100,
- }
- def finalization(self) -> list[ActionOrFactory]:
- # Postgres sources can't be backup up and restored since Postgres
- # refuses to re-read previously confirmed LSNs
- return [
- MzStart,
- BalancerdStart,
- StoragedStart,
- ValidateAll(),
- ]
- class MySqlCdc(Scenario):
- """A Zippy test using MySQL CDC exclusively."""
- def bootstrap(self) -> list[ActionOrFactory]:
- return super().bootstrap() + [MySqlStart]
- def actions_with_weight(self) -> dict[ActionOrFactory, float]:
- return {
- CreateMySqlTable: 10,
- CreateMySqlCdcTable: 10,
- KillClusterd: 5,
- StoragedKill: 5,
- StoragedStart: 5,
- MySqlRestart: 10,
- CreateViewParameterized(): 10,
- ValidateView: 20,
- MySqlDML: 100,
- }
- class ClusterReplicas(Scenario):
- """A Zippy test that uses CREATE / DROP REPLICA and random killing."""
- def bootstrap(self) -> list[ActionOrFactory]:
- return super().bootstrap() + [
- DropDefaultReplica,
- CreateReplica,
- ]
- # Due to gh#13235 it is not possible to have MzStop/MzStart in this scenario
- def actions_with_weight(self) -> dict[ActionOrFactory, float]:
- return {
- KillClusterd: 5,
- StoragedRestart: 5,
- CreateReplica: 30,
- DropReplica: 10,
- CreateTopicParameterized(): 10,
- CreateSourceParameterized(): 10,
- CreateTableParameterized(): 10,
- CreateViewParameterized(): 20,
- CreateSinkParameterized(): 10,
- ValidateView: 20,
- Ingest: 50,
- DML: 50,
- PeekCancellation: 5,
- }
- class KafkaParallelInsert(Scenario):
- """A Zippy test using simple views over Kafka sources with parallel insertion."""
- def actions_with_weight(self) -> dict[ActionOrFactory, float]:
- return {
- KillClusterd: 5,
- StoragedKill: 5,
- StoragedStart: 5,
- CreateTopicParameterized(): 10,
- CreateSourceParameterized(): 10,
- CreateViewParameterized(expensive_aggregates=False, max_inputs=1): 5,
- ValidateView: 10,
- KafkaInsertParallel: 50,
- }
- class CrdbBlobStoreRestart(Scenario):
- """A Zippy test that restarts CRDB and BlobStore."""
- def actions_with_weight(self) -> dict[ActionOrFactory, float]:
- return {
- CreateTopicParameterized(): 5,
- CreateSourceParameterized(): 5,
- CreateViewParameterized(max_inputs=2): 5,
- CreateSinkParameterized(): 5,
- Ingest: 50,
- CreateTableParameterized(): 10,
- DML: 50,
- ValidateView: 15,
- MzRestart: 5,
- Mz0dtDeploy: 5,
- KillClusterd: 5,
- # Disabled because a separate clusterd is not supported by Mz0dtDeploy yet
- # StoragedRestart: 10,
- CockroachRestart: 15,
- BlobStoreRestart: 15,
- }
- class CrdbRestart(Scenario):
- """A Zippy test that restarts Cockroach."""
- def actions_with_weight(self) -> dict[ActionOrFactory, float]:
- return {
- CreateTopicParameterized(): 5,
- CreateSourceParameterized(): 5,
- CreateViewParameterized(max_inputs=2): 5,
- CreateSinkParameterized(): 5,
- Ingest: 50,
- CreateTableParameterized(): 10,
- DML: 50,
- ValidateView: 15,
- MzRestart: 5,
- Mz0dtDeploy: 5,
- KillClusterd: 5,
- # Disabled because a separate clusterd is not supported by Mz0dtDeploy yet
- # StoragedRestart: 10,
- CockroachRestart: 15,
- }
- class KafkaSourcesLarge(Scenario):
- """A Zippy test using a large number of Kafka sources, views and sinks (no killings)."""
- def actions_with_weight(self) -> dict[ActionOrFactory, float]:
- return {
- CreateTopicParameterized(max_topics=5): 10,
- CreateSourceParameterized(max_sources=25): 10,
- CreateViewParameterized(
- max_views=50, expensive_aggregates=False, max_inputs=1
- ): 5,
- CreateSinkParameterized(max_sinks=25): 10,
- ValidateView: 10,
- Ingest: 100,
- PeekCancellation: 5,
- }
- class DataflowsLarge(Scenario):
- """A Zippy test using a smaller number but more complex dataflows."""
- def actions_with_weight(self) -> dict[ActionOrFactory, float]:
- return {
- CreateReplica: 2,
- CreateTopicParameterized(
- max_topics=2, envelopes_with_weights={Envelope.UPSERT: 100}
- ): 10,
- CreateSourceParameterized(max_sources=10): 10,
- CreateViewParameterized(
- max_views=5, expensive_aggregates=True, max_inputs=5
- ): 10,
- ValidateView: 10,
- Ingest: 50,
- DML: 50,
- }
- class UserTablesLarge(Scenario):
- """A Zippy scenario over tables (no killing)."""
- def actions_with_weight(self) -> dict[ActionOrFactory, float]:
- return {
- CreateTableParameterized(max_tables=2): 10,
- CreateViewParameterized(
- max_views=5, expensive_aggregates=True, max_inputs=5
- ): 10,
- CreateSinkParameterized(max_sinks=10): 10,
- ValidateView: 10,
- DML: 50,
- }
- class BackupAndRestoreLarge(Scenario):
- """A Zippy scenario with the occasional Backup+Restore."""
- def actions_with_weight(self) -> dict[ActionOrFactory, float]:
- return {
- CreateTableParameterized(max_tables=2): 10,
- CreateViewParameterized(
- max_views=5, expensive_aggregates=True, max_inputs=5
- ): 10,
- CreateSinkParameterized(max_sinks=10): 10,
- ValidateView: 10,
- DML: 50,
- BackupAndRestore: 0.1,
- }
- class PostgresCdcLarge(Scenario):
- """A Zippy test using Postgres CDC exclusively (Pg not killed)."""
- def bootstrap(self) -> list[ActionOrFactory]:
- return super().bootstrap() + [PostgresStart]
- def actions_with_weight(self) -> dict[ActionOrFactory, float]:
- return {
- CreatePostgresTable: 10,
- CreatePostgresCdcTable: 10,
- KillClusterd: 5,
- StoragedKill: 5,
- StoragedStart: 5,
- CreateViewParameterized(): 10,
- ValidateView: 20,
- PostgresDML: 100,
- }
- def finalization(self) -> list[ActionOrFactory]:
- # Postgres sources can't be backup up and restored since Postgres
- # refuses to re-read previously confirmed LSNs
- return [
- MzStart,
- BalancerdStart,
- StoragedStart,
- ValidateAll(),
- ]
- class MySqlCdcLarge(Scenario):
- """A Zippy test using MySQL CDC exclusively (MySQL not killed)."""
- def bootstrap(self) -> list[ActionOrFactory]:
- return super().bootstrap() + [MySqlStart]
- def actions_with_weight(self) -> dict[ActionOrFactory, float]:
- return {
- CreateMySqlTable: 10,
- CreateMySqlCdcTable: 10,
- KillClusterd: 5,
- StoragedKill: 5,
- StoragedStart: 5,
- CreateViewParameterized(): 10,
- ValidateView: 20,
- MySqlDML: 100,
- }
|