├── .dockerignore ├── .gitattributes ├── .github ├── .codecov.yml ├── .golangci.yml ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── actionlint-matcher.json └── workflows │ ├── check-pr-placeholders.yml │ ├── create-tag.yml │ ├── features-integration.yml │ ├── goreleaser.yml │ ├── linters.yml │ ├── run-tests.yml │ ├── stale.yml │ ├── trigger-publish.yml │ └── trigger-version-info-service.yml ├── .gitignore ├── .gitmodules ├── .goreleaser.yml ├── .vscode └── launch.json ├── CONTRIBUTING.md ├── LICENSE ├── Makefile ├── README.md ├── api ├── adminservice │ └── v1 │ │ ├── request_response.go-helpers.pb.go │ │ ├── request_response.pb.go │ │ ├── service.pb.go │ │ └── service_grpc.pb.go ├── adminservicemock │ └── v1 │ │ ├── service.pb.mock.go │ │ └── service_grpc.pb.mock.go ├── archiver │ └── v1 │ │ ├── message.go-helpers.pb.go │ │ └── message.pb.go ├── checksum │ └── v1 │ │ ├── message.go-helpers.pb.go │ │ └── message.pb.go ├── cli │ └── v1 │ │ ├── message.go-helpers.pb.go │ │ └── message.pb.go ├── clock │ └── v1 │ │ ├── message.go-helpers.pb.go │ │ └── message.pb.go ├── cluster │ └── v1 │ │ ├── message.go-helpers.pb.go │ │ └── message.pb.go ├── common │ └── v1 │ │ ├── dlq.go-helpers.pb.go │ │ └── dlq.pb.go ├── deployment │ └── v1 │ │ ├── message.go-helpers.pb.go │ │ └── message.pb.go ├── enums │ └── v1 │ │ ├── cluster.go-helpers.pb.go │ │ ├── cluster.pb.go │ │ ├── common.go-helpers.pb.go │ │ ├── common.pb.go │ │ ├── dlq.go-helpers.pb.go │ │ ├── dlq.pb.go │ │ ├── nexus.go-helpers.pb.go │ │ ├── nexus.pb.go │ │ ├── predicate.go-helpers.pb.go │ │ ├── predicate.pb.go │ │ ├── replication.go-helpers.pb.go │ │ ├── replication.pb.go │ │ ├── task.go-helpers.pb.go │ │ ├── task.pb.go │ │ ├── workflow.go-helpers.pb.go │ │ ├── workflow.pb.go │ │ ├── workflow_task_type.go-helpers.pb.go │ │ └── workflow_task_type.pb.go ├── errordetails │ └── v1 │ │ ├── message.go-helpers.pb.go │ │ └── message.pb.go ├── history │ └── v1 │ │ ├── message.go-helpers.pb.go │ │ └── message.pb.go ├── historyservice │ └── v1 │ │ ├── request_response.go-helpers.pb.go │ │ ├── request_response.pb.go │ │ ├── service.pb.go │ │ └── service_grpc.pb.go ├── historyservicemock │ └── v1 │ │ ├── service.pb.mock.go │ │ └── service_grpc.pb.mock.go ├── matchingservice │ └── v1 │ │ ├── request_response.go-helpers.pb.go │ │ ├── request_response.pb.go │ │ ├── service.pb.go │ │ └── service_grpc.pb.go ├── matchingservicemock │ └── v1 │ │ ├── service.pb.mock.go │ │ └── service_grpc.pb.mock.go ├── metrics │ └── v1 │ │ ├── message.go-helpers.pb.go │ │ └── message.pb.go ├── namespace │ └── v1 │ │ ├── message.go-helpers.pb.go │ │ └── message.pb.go ├── persistence │ └── v1 │ │ ├── chasm.go-helpers.pb.go │ │ ├── chasm.pb.go │ │ ├── cluster_metadata.go-helpers.pb.go │ │ ├── cluster_metadata.pb.go │ │ ├── executions.go-helpers.pb.go │ │ ├── executions.pb.go │ │ ├── history_tree.go-helpers.pb.go │ │ ├── history_tree.pb.go │ │ ├── hsm.go-helpers.pb.go │ │ ├── hsm.pb.go │ │ ├── namespaces.go-helpers.pb.go │ │ ├── namespaces.pb.go │ │ ├── nexus.go-helpers.pb.go │ │ ├── nexus.pb.go │ │ ├── predicates.go-helpers.pb.go │ │ ├── predicates.pb.go │ │ ├── queue_metadata.go-helpers.pb.go │ │ ├── queue_metadata.pb.go │ │ ├── queues.go-helpers.pb.go │ │ ├── queues.pb.go │ │ ├── task_queues.go-helpers.pb.go │ │ ├── task_queues.pb.go │ │ ├── tasks.go-helpers.pb.go │ │ ├── tasks.pb.go │ │ ├── update.go-helpers.pb.go │ │ ├── update.pb.go │ │ ├── workflow_mutable_state.go-helpers.pb.go │ │ └── workflow_mutable_state.pb.go ├── replication │ └── v1 │ │ ├── message.go-helpers.pb.go │ │ └── message.pb.go ├── schedule │ └── v1 │ │ ├── message.go-helpers.pb.go │ │ └── message.pb.go ├── taskqueue │ └── v1 │ │ ├── message.go-helpers.pb.go │ │ └── message.pb.go ├── testservice │ └── v1 │ │ ├── request_response.go-helpers.pb.go │ │ ├── request_response.pb.go │ │ ├── service.pb.go │ │ └── service_grpc.pb.go ├── testservicemock │ └── v1 │ │ ├── service.pb.mock.go │ │ └── service_grpc.pb.mock.go ├── token │ └── v1 │ │ ├── message.go-helpers.pb.go │ │ └── message.pb.go └── workflow │ └── v1 │ ├── message.go-helpers.pb.go │ └── message.pb.go ├── chasm ├── component.go ├── component_field_option.go ├── component_mock.go ├── context.go ├── engine.go ├── export_test.go ├── field.go ├── field_internal.go ├── field_test.go ├── field_type.go ├── fields_iterator.go ├── fields_iterator_test.go ├── library.go ├── library_mock.go ├── map.go ├── map_test.go ├── path_encoder.go ├── ref.go ├── ref_test.go ├── registrable_component.go ├── registrable_task.go ├── registry.go ├── registry_test.go ├── task.go ├── task_mock.go ├── test_component_test.go ├── test_library_test.go ├── test_task_test.go ├── tree.go ├── tree_mock.go └── tree_test.go ├── client ├── admin │ ├── client.go │ ├── client_gen.go │ ├── metric_client.go │ ├── metric_client_gen.go │ ├── retryable_client.go │ └── retryable_client_gen.go ├── client_bean.go ├── client_bean_mock.go ├── client_factory_mock.go ├── clientfactory.go ├── frontend │ ├── client.go │ ├── client_gen.go │ ├── metric_client.go │ ├── metric_client_gen.go │ ├── retryable_client.go │ └── retryable_client_gen.go ├── history │ ├── caching_redirector.go │ ├── caching_redirector_test.go │ ├── client.go │ ├── client_gen.go │ ├── client_test.go │ ├── connections.go │ ├── connections_mock.go │ ├── historytest │ │ └── clienttest.go │ ├── metadata.go │ ├── metadata_test.go │ ├── metric_client.go │ ├── metric_client_gen.go │ ├── redirector.go │ ├── redirector_test.go │ ├── retryable_client.go │ └── retryable_client_gen.go └── matching │ ├── client.go │ ├── client_gen.go │ ├── loadbalancer.go │ ├── loadbalancer_test.go │ ├── metric_client.go │ ├── metric_client_gen.go │ ├── retryable_client.go │ └── retryable_client_gen.go ├── cmd ├── server │ └── main.go └── tools │ ├── cassandra │ └── main.go │ ├── codegen │ └── helpers.go │ ├── gendynamicconfig │ ├── dynamic_config.tmpl │ └── main.go │ ├── genrpcserverinterceptors │ ├── main.go │ ├── main_test.go │ └── server_interceptors.tmpl │ ├── genrpcwrappers │ └── main.go │ ├── gensearchattributehelpers │ ├── main.go │ └── search_attribute_helpers.tmpl │ ├── getproto │ ├── files.go │ ├── main.go │ └── run.sh │ ├── sql │ └── main.go │ ├── tdbg │ └── main.go │ ├── test-runner │ └── main.go │ └── test │ └── find_altered_tests.go ├── common ├── aggregate │ ├── bench_test.go │ ├── moving_window_average.go │ └── noop_moving_window_average.go ├── api │ ├── metadata.go │ └── metadata_test.go ├── archiver │ ├── README.md │ ├── archival_metadata.go │ ├── archival_metadata_mock.go │ ├── constants.go │ ├── filestore │ │ ├── history_archiver.go │ │ ├── history_archiver_test.go │ │ ├── query_parser.go │ │ ├── query_parser_mock.go │ │ ├── query_parser_test.go │ │ ├── util.go │ │ ├── util_test.go │ │ ├── visibility_archiver.go │ │ └── visibility_archiver_test.go │ ├── gcloud │ │ ├── README.md │ │ ├── connector │ │ │ ├── client.go │ │ │ ├── client_delegate.go │ │ │ ├── client_delegate_mock.go │ │ │ ├── client_mock.go │ │ │ └── client_test.go │ │ ├── history_archiver.go │ │ ├── history_archiver_test.go │ │ ├── query_parser.go │ │ ├── query_parser_mock.go │ │ ├── util.go │ │ ├── util_test.go │ │ ├── visibility_archiver.go │ │ └── visibility_archiver_test.go │ ├── history_iterator.go │ ├── history_iterator_mock.go │ ├── history_iterator_test.go │ ├── interface.go │ ├── interface_mock.go │ ├── metadata_mock.go │ ├── metadata_mock_test.go │ ├── options.go │ ├── provider │ │ ├── provider.go │ │ └── provider_mock.go │ ├── s3store │ │ ├── README.md │ │ ├── history_archiver.go │ │ ├── history_archiver_test.go │ │ ├── mocks │ │ │ ├── generate.go │ │ │ └── s3api.go │ │ ├── query_parser.go │ │ ├── query_parser_mock.go │ │ ├── query_parser_test.go │ │ ├── util.go │ │ ├── util_test.go │ │ ├── visibility_archiver.go │ │ └── visibility_archiver_test.go │ ├── uri.go │ ├── uri_test.go │ └── util.go ├── auth │ ├── testdata │ │ ├── README.md │ │ ├── ca.crt │ │ ├── ca.key │ │ ├── invalid_ca.crt │ │ ├── invalid_ca.key │ │ ├── invalid_localhost.crt │ │ ├── invalid_localhost.key │ │ ├── localhost.cnf │ │ ├── localhost.crt │ │ └── localhost.key │ ├── tls.go │ ├── tls_config_helper.go │ └── tls_config_helper_test.go ├── authorization │ ├── authorizer.go │ ├── authorizer_mock.go │ ├── claim_mapper.go │ ├── claim_mapper_mock.go │ ├── default_authorizer.go │ ├── default_authorizer_test.go │ ├── default_jwt_claim_mapper.go │ ├── default_jwt_claim_mapper_test.go │ ├── default_token_key_provider.go │ ├── frontend_api.go │ ├── interceptor.go │ ├── interceptor_test.go │ ├── noop_authorizer.go │ ├── roles.go │ ├── roles_test.go │ └── token_key_provider.go ├── backoff │ ├── cron.go │ ├── cron_test.go │ ├── jitter.go │ ├── jitter_test.go │ ├── retry.go │ ├── retry_test.go │ ├── retrypolicy.go │ └── retrypolicy_test.go ├── build │ └── build.go ├── cache │ ├── cache.go │ ├── lru.go │ ├── lru_test.go │ ├── simple.go │ ├── simple_test.go │ ├── size_getter.go │ └── size_getter_mock.go ├── channel │ └── shutdown_once.go ├── checksum │ ├── crc.go │ └── crc_test.go ├── circuitbreaker │ ├── circuitbreaker.go │ └── circuitbreaker_test.go ├── client_cache.go ├── clock │ ├── context.go │ ├── context_test.go │ ├── event_time_source.go │ ├── event_time_source_test.go │ ├── hybrid_logical_clock │ │ ├── hybrid_logical_clock.go │ │ └── hybrid_logical_clock_test.go │ ├── time_source.go │ └── time_source_test.go ├── cluster │ ├── clustertest │ │ └── test_metadata.go │ ├── frontend_http_client.go │ ├── fx.go │ ├── metadata.go │ ├── metadata_mock.go │ ├── metadata_test.go │ └── metadata_test_config.go ├── codec │ ├── gob │ │ ├── gob.go │ │ └── gob_test.go │ ├── jsonpb.go │ └── jsonpb_test.go ├── collection │ ├── concurrent_tx_map.go │ ├── concurrent_tx_map_test.go │ ├── indexedtakelist.go │ ├── indexedtakelist_test.go │ ├── interface.go │ ├── iterator.go │ ├── oncemap.go │ ├── oncemap_test.go │ ├── paging_iterator.go │ ├── paging_iterator_test.go │ ├── priority_queue.go │ ├── priority_queue_test.go │ ├── sorted_set_manager.go │ ├── sorted_set_manager_test.go │ ├── sync_map.go │ ├── sync_map_test.go │ └── util.go ├── config │ ├── archival.go │ ├── config.go │ ├── config_test.go │ ├── fx.go │ ├── loader.go │ ├── loader_test.go │ ├── localip.go │ ├── localip_test.go │ ├── persistence.go │ └── persistence_test.go ├── constants.go ├── convert │ └── convert.go ├── daemon.go ├── deadlock │ ├── deadlock.go │ ├── deadlock_test.go │ └── fx.go ├── debug │ ├── debug.go │ └── not_debug.go ├── definition │ ├── resource_dedup.go │ ├── resource_dedup_test.go │ └── workflow_key.go ├── dynamicconfig │ ├── cachedvalue.go │ ├── client.go │ ├── collection.go │ ├── collection_bench_test.go │ ├── collection_test.go │ ├── config │ │ └── testConfig.yaml │ ├── constants.go │ ├── file_based_client.go │ ├── file_based_client_mock.go │ ├── file_based_client_test.go │ ├── find_match_test.go │ ├── fx.go │ ├── memory_client.go │ ├── memory_client_test.go │ ├── registry.go │ ├── setting.go │ ├── setting_gen.go │ ├── shared_constants.go │ └── static_client.go ├── effect │ ├── README.md │ ├── buffer.go │ ├── buffer_test.go │ ├── controller.go │ ├── immediate.go │ └── immediate_test.go ├── enums │ └── defaults.go ├── failure │ ├── failure.go │ └── failure_test.go ├── finalizer │ ├── finalizer.go │ └── finalizer_test.go ├── future │ ├── future.go │ ├── future_impl.go │ ├── future_test.go │ └── ready_future_impl.go ├── goro │ ├── adaptive_pool.go │ ├── adaptive_pool_test.go │ ├── example_group_test.go │ ├── goro.go │ ├── goro_test.go │ ├── group.go │ ├── group_test.go │ └── package.go ├── headers │ ├── caller_info.go │ ├── caller_info_test.go │ ├── headers.go │ ├── headers_test.go │ ├── version_checker.go │ └── version_checker_test.go ├── locks │ ├── condition_variable.go │ ├── condition_variable_impl.go │ ├── condition_variable_test.go │ ├── id_mutex.go │ ├── id_mutex_test.go │ ├── lock.go │ ├── priority_mutex.go │ ├── priority_mutex_impl.go │ ├── priority_mutex_test.go │ ├── priority_semaphore.go │ ├── priority_semaphore_impl.go │ └── priority_semaphore_test.go ├── log │ ├── config.go │ ├── interface.go │ ├── interface_mock.go │ ├── lazy_logger.go │ ├── noop_logger.go │ ├── panic.go │ ├── panic_test.go │ ├── replay_logger.go │ ├── sdk_logger.go │ ├── sdk_logger_test.go │ ├── slog.go │ ├── slog_test.go │ ├── tag │ │ ├── interface.go │ │ ├── tags.go │ │ ├── tags_test.go │ │ ├── values.go │ │ └── zap_tag.go │ ├── throttle_logger.go │ ├── with_logger.go │ ├── zap_logger.go │ ├── zap_logger_bench_test.go │ └── zap_logger_test.go ├── masker │ ├── masker.go │ └── masker_test.go ├── membership │ ├── grpc_resolver.go │ ├── grpc_resolver_test.go │ ├── hostinfo.go │ ├── hostinfo_provider.go │ ├── interfaces.go │ ├── interfaces_mock.go │ ├── ringpop │ │ ├── factory.go │ │ ├── factory_test.go │ │ ├── fx.go │ │ ├── hostinfo.go │ │ ├── monitor.go │ │ ├── monitor_test.go │ │ ├── service_resolver.go │ │ └── test_cluster.go │ └── static │ │ ├── fx.go │ │ ├── monitor.go │ │ └── service_resolver.go ├── metrics │ ├── baggage_bench_test.go │ ├── config.go │ ├── config_test.go │ ├── consts.go │ ├── defs.go │ ├── defs_base.debug.go │ ├── defs_base.go │ ├── fx.go │ ├── grpc.go │ ├── grpc_test.go │ ├── metric_defs.go │ ├── metrics.go │ ├── metrics_mock.go │ ├── metrics_test.go │ ├── metricstest │ │ ├── capture_handler.go │ │ ├── metricstest.go │ │ ├── metricstest_test.go │ │ └── task_queues_test.go │ ├── noop_impl.go │ ├── opentelemetry_provider.go │ ├── option.go │ ├── otel_metrics_handler.go │ ├── otel_metrics_handler_test.go │ ├── otel_options.go │ ├── otel_options_test.go │ ├── panic.go │ ├── registry.go │ ├── registry_test.go │ ├── runtime.go │ ├── statsd_exporter.go │ ├── statsd_exporter_test.go │ ├── tags.go │ ├── tally │ │ └── statsd │ │ │ ├── reporter.go │ │ │ └── reporter_test.go │ ├── tally_metrics_handler.go │ ├── tally_metrics_handler_test.go │ └── task_queues.go ├── namespace │ ├── archival_config_state_machine.go │ ├── const.go │ ├── mutate.go │ ├── namespace.go │ ├── namespace_test.go │ ├── nsmanager │ │ ├── attr_validator.go │ │ ├── attr_validator_test.go │ │ └── errors.go │ ├── nsregistry │ │ ├── fx.go │ │ ├── registry.go │ │ ├── registry_mock.go │ │ └── registry_test.go │ ├── nsreplication │ │ ├── dlq_message_handler.go │ │ ├── dlq_message_handler_mock.go │ │ ├── dlq_message_handler_test.go │ │ ├── replication_task_executor.go │ │ ├── replication_task_executor_test.go │ │ ├── replication_task_handler_mock.go │ │ ├── transmission_task_handler.go │ │ └── transmission_task_handler_test.go │ ├── registry.go │ ├── registry_mock.go │ └── testconstructors.go ├── nexus │ ├── callback_token.go │ ├── endpoint_registry.go │ ├── endpoint_registry_test.go │ ├── failure.go │ ├── nexustest │ │ ├── registry.go │ │ └── server.go │ ├── payload_serializer.go │ ├── payload_serializer_test.go │ ├── routes.go │ ├── routes_test.go │ ├── trace.go │ └── util.go ├── number │ ├── number.go │ └── number_test.go ├── payload │ ├── payload.go │ └── payload_test.go ├── payloads │ ├── payloads.go │ └── payloads_test.go ├── persistence │ ├── cassandra │ │ ├── cluster_metadata_store.go │ │ ├── common.go │ │ ├── errors.go │ │ ├── errors_test.go │ │ ├── execution_store.go │ │ ├── factory.go │ │ ├── helpers.go │ │ ├── history_store.go │ │ ├── matching_task_store.go │ │ ├── metadata_store.go │ │ ├── mutable_state_store.go │ │ ├── mutable_state_task_store.go │ │ ├── nexus_endpoint_store.go │ │ ├── queue_store.go │ │ ├── queue_v2_store.go │ │ ├── schema_version_reader.go │ │ ├── shard_store.go │ │ ├── test.go │ │ ├── util.go │ │ └── version_checker.go │ ├── client │ │ ├── abstract_data_store_factory.go │ │ ├── factory.go │ │ ├── factory_test.go │ │ ├── fx.go │ │ ├── health_request_rate_limiter.go │ │ ├── persistence_rate_limited_clients_test.go │ │ ├── quotas.go │ │ └── quotas_test.go │ ├── cluster_metadata.go │ ├── cluster_metadata_store.go │ ├── data_blob.go │ ├── data_interfaces.go │ ├── data_interfaces_mock.go │ ├── dlq_metrics_emitter.go │ ├── dlq_metrics_emitter_test.go │ ├── error_type.go │ ├── execution_manager.go │ ├── faultinjection │ │ ├── cluster_metadata_store_gen.go │ │ ├── data_store_factory.go │ │ ├── execution_store_gen.go │ │ ├── fault.go │ │ ├── fault_generator.go │ │ ├── gowrap_template │ │ ├── metadata_store_gen.go │ │ ├── method_fault_generator.go │ │ ├── method_fault_generator_test.go │ │ ├── nexus_endpoint_store_gen.go │ │ ├── queue_gen.go │ │ ├── queue_v2_gen.go │ │ ├── shard_store_gen.go │ │ ├── store_fault_generator.go │ │ ├── store_fault_generator_test.go │ │ └── task_store_gen.go │ ├── health_signal_aggregator.go │ ├── health_signal_aggregator_test.go │ ├── history_branch_util.go │ ├── history_branch_util_mock.go │ ├── history_branch_util_test.go │ ├── history_manager.go │ ├── history_manager_util.go │ ├── history_node_util.go │ ├── history_node_util_test.go │ ├── history_task_queue_manager.go │ ├── history_task_queue_manager_test.go │ ├── json_history_token_serializer.go │ ├── metadata_manager.go │ ├── mock │ │ └── store_mock.go │ ├── namespace_replication_queue.go │ ├── namespace_replication_queue_mock.go │ ├── nexus_endpoint_manager.go │ ├── noop_health_signal_aggregator.go │ ├── nosql │ │ └── nosqlplugin │ │ │ └── cassandra │ │ │ ├── gocql │ │ │ ├── batch.go │ │ │ ├── client.go │ │ │ ├── client_test.go │ │ │ ├── consistency.go │ │ │ ├── errors.go │ │ │ ├── interfaces.go │ │ │ ├── iter.go │ │ │ ├── query.go │ │ │ ├── session.go │ │ │ ├── session_test.go │ │ │ └── uuid.go │ │ │ └── translator │ │ │ ├── fixed_address_translator.go │ │ │ ├── fixed_address_translator_test.go │ │ │ └── translator_plugin.go │ ├── operation_mode_validator.go │ ├── operation_mode_validator_test.go │ ├── persistence-tests │ │ ├── cluster_metadata_manager.go │ │ ├── history_v2_persistence.go │ │ ├── metadata_persistence_v2.go │ │ ├── persistence_test_base.go │ │ ├── queue_persistence.go │ │ ├── setup.go │ │ └── shared_test.go │ ├── persistence_interface.go │ ├── persistence_metric_clients.go │ ├── persistence_rate_limited_clients.go │ ├── persistence_retryable_clients.go │ ├── persistence_retryable_clients_test.go │ ├── persistencetest │ │ ├── queues.go │ │ └── queues_test.go │ ├── query_util.go │ ├── query_util_test.go │ ├── queue_v2.go │ ├── queue_v2_util.go │ ├── queue_v2_util_test.go │ ├── schema │ │ ├── version.go │ │ └── version_reader.go │ ├── serialization │ │ ├── blob.go │ │ ├── serializer.go │ │ ├── serializer_test.go │ │ ├── task_serializer.go │ │ └── task_serializer_test.go │ ├── serializer_test.go │ ├── shard_manager.go │ ├── size.go │ ├── size_util.go │ ├── sql │ │ ├── cluster_metadata.go │ │ ├── common.go │ │ ├── errors.go │ │ ├── execution.go │ │ ├── execution_state_map.go │ │ ├── execution_state_non_map.go │ │ ├── execution_tasks.go │ │ ├── execution_util.go │ │ ├── factory.go │ │ ├── history_store.go │ │ ├── metadata.go │ │ ├── nexus_endpoint_store.go │ │ ├── queue.go │ │ ├── queue_v2.go │ │ ├── shard.go │ │ ├── sqlplugin │ │ │ ├── cluster_metadata.go │ │ │ ├── db_handle.go │ │ │ ├── db_handle_test.go │ │ │ ├── history_activity.go │ │ │ ├── history_buffer.go │ │ │ ├── history_chasm.go │ │ │ ├── history_child_workflow.go │ │ │ ├── history_execution.go │ │ │ ├── history_immediate_tasks.go │ │ │ ├── history_node.go │ │ │ ├── history_replication_dlq_tasks.go │ │ │ ├── history_replication_tasks.go │ │ │ ├── history_request_cancel.go │ │ │ ├── history_scheduled_tasks.go │ │ │ ├── history_shard.go │ │ │ ├── history_signal.go │ │ │ ├── history_signal_request.go │ │ │ ├── history_timer.go │ │ │ ├── history_timer_tasks.go │ │ │ ├── history_transfer_tasks.go │ │ │ ├── history_tree.go │ │ │ ├── history_visibility_tasks.go │ │ │ ├── interfaces.go │ │ │ ├── matching_task.go │ │ │ ├── matching_task_queue.go │ │ │ ├── mysql │ │ │ │ ├── admin.go │ │ │ │ ├── cluster_metadata.go │ │ │ │ ├── db.go │ │ │ │ ├── events.go │ │ │ │ ├── execution.go │ │ │ │ ├── execution_maps.go │ │ │ │ ├── namespace.go │ │ │ │ ├── nexus_endpoints.go │ │ │ │ ├── plugin.go │ │ │ │ ├── queue.go │ │ │ │ ├── queue_v2.go │ │ │ │ ├── session │ │ │ │ │ ├── session.go │ │ │ │ │ └── session_test.go │ │ │ │ ├── shard.go │ │ │ │ ├── task.go │ │ │ │ ├── typeconv.go │ │ │ │ └── visibility.go │ │ │ ├── namespace.go │ │ │ ├── nexus_endpoints.go │ │ │ ├── postgresql │ │ │ │ ├── admin.go │ │ │ │ ├── cluster_metadata.go │ │ │ │ ├── db.go │ │ │ │ ├── driver │ │ │ │ │ ├── interface.go │ │ │ │ │ ├── pgx.go │ │ │ │ │ └── pq.go │ │ │ │ ├── events.go │ │ │ │ ├── execution.go │ │ │ │ ├── execution_maps.go │ │ │ │ ├── namespace.go │ │ │ │ ├── nexus_endpoints.go │ │ │ │ ├── plugin.go │ │ │ │ ├── queue.go │ │ │ │ ├── queue_v2.go │ │ │ │ ├── session │ │ │ │ │ └── session.go │ │ │ │ ├── shard.go │ │ │ │ ├── task.go │ │ │ │ ├── typeconv.go │ │ │ │ └── visibility.go │ │ │ ├── queue_message.go │ │ │ ├── queue_metadata.go │ │ │ ├── queue_v2_message.go │ │ │ ├── queue_v2_metadata.go │ │ │ ├── sqlite │ │ │ │ ├── LICENSE │ │ │ │ ├── admin.go │ │ │ │ ├── cluster_metadata.go │ │ │ │ ├── conn_pool.go │ │ │ │ ├── db.go │ │ │ │ ├── driver.go │ │ │ │ ├── events.go │ │ │ │ ├── execution.go │ │ │ │ ├── execution_maps.go │ │ │ │ ├── namespace.go │ │ │ │ ├── nexus_endpoints.go │ │ │ │ ├── plugin.go │ │ │ │ ├── queue.go │ │ │ │ ├── queue_v2.go │ │ │ │ ├── shard.go │ │ │ │ ├── task.go │ │ │ │ ├── typeconv.go │ │ │ │ └── visibility.go │ │ │ ├── tests │ │ │ │ ├── context.go │ │ │ │ ├── history_current_execution.go │ │ │ │ ├── history_execution.go │ │ │ │ ├── history_execution_activity.go │ │ │ │ ├── history_execution_buffer.go │ │ │ │ ├── history_execution_chasm.go │ │ │ │ ├── history_execution_child_workflow.go │ │ │ │ ├── history_execution_request_cancel.go │ │ │ │ ├── history_execution_signal.go │ │ │ │ ├── history_execution_signal_requested.go │ │ │ │ ├── history_execution_timer.go │ │ │ │ ├── history_node.go │ │ │ │ ├── history_replication_task.go │ │ │ │ ├── history_replication_task_dlq.go │ │ │ │ ├── history_shard.go │ │ │ │ ├── history_timer_task.go │ │ │ │ ├── history_transfer_task.go │ │ │ │ ├── history_tree.go │ │ │ │ ├── history_visibility_task.go │ │ │ │ ├── matching_task.go │ │ │ │ ├── matching_task_queue.go │ │ │ │ ├── namespace.go │ │ │ │ ├── queue_message.go │ │ │ │ ├── queue_metadata.go │ │ │ │ ├── queue_v2.go │ │ │ │ └── visibility.go │ │ │ ├── util.go │ │ │ ├── visibility.go │ │ │ └── visibility_test.go │ │ ├── store.go │ │ ├── task.go │ │ ├── test_sql_persistence.go │ │ └── version_checker.go │ ├── task_manager.go │ ├── telemetry │ │ ├── cluster_metadata_store_gen.go │ │ ├── data_store_factory.go │ │ ├── execution_store_gen.go │ │ ├── gowrap_template │ │ ├── nexus_endpoint_store_gen.go │ │ ├── queue_gen.go │ │ ├── queue_v2_gen.go │ │ ├── shard_store_gen.go │ │ ├── shared_store_gen.go │ │ └── task_store_gen.go │ ├── tests │ │ ├── cassandra_test.go │ │ ├── cassandra_test_util.go │ │ ├── execution_mutable_state.go │ │ ├── execution_mutable_state_task.go │ │ ├── history_store.go │ │ ├── history_task_queue_manager_test_suite.go │ │ ├── mysql_test.go │ │ ├── mysql_test_util.go │ │ ├── nexus_endpoint_suite.go │ │ ├── persistence_connection_suite.go │ │ ├── postgresql_test.go │ │ ├── postgresql_test_util.go │ │ ├── queue_v2_test_suite.go │ │ ├── shard.go │ │ ├── sqlite_test.go │ │ ├── task_queue.go │ │ ├── task_queue_task.go │ │ ├── task_queue_user_data.go │ │ ├── util.go │ │ └── visibility_persistence_suite.go │ ├── transitionhistory │ │ ├── transition_history.go │ │ └── transition_history_test.go │ ├── versionhistory │ │ ├── version_histories.go │ │ ├── version_history.go │ │ ├── version_history_item.go │ │ └── version_history_test.go │ ├── visibility │ │ ├── defs.go │ │ ├── factory.go │ │ ├── manager │ │ │ ├── visibility_manager.go │ │ │ └── visibility_manager_mock.go │ │ ├── manager_selector.go │ │ ├── manager_selector_mock.go │ │ ├── quotas.go │ │ ├── store │ │ │ ├── elasticsearch │ │ │ │ ├── client │ │ │ │ │ ├── aws.go │ │ │ │ │ ├── bulk_processor.go │ │ │ │ │ ├── bulk_processor_mock.go │ │ │ │ │ ├── bulk_processor_v7.go │ │ │ │ │ ├── bulk_service.go │ │ │ │ │ ├── bulk_service_v7.go │ │ │ │ │ ├── client.go │ │ │ │ │ ├── client_factory.go │ │ │ │ │ ├── client_mock.go │ │ │ │ │ ├── client_test.go │ │ │ │ │ ├── client_v7.go │ │ │ │ │ ├── config.go │ │ │ │ │ └── logger.go │ │ │ │ ├── converter.go │ │ │ │ ├── converter_test.go │ │ │ │ ├── processor.go │ │ │ │ ├── processor_mock.go │ │ │ │ ├── processor_test.go │ │ │ │ ├── query_interceptors.go │ │ │ │ ├── query_interceptors_test.go │ │ │ │ ├── visibility_store.go │ │ │ │ ├── visibility_store_read_test.go │ │ │ │ ├── visibility_store_validation_test.go │ │ │ │ └── visibility_store_write_test.go │ │ │ ├── errors.go │ │ │ ├── query │ │ │ │ ├── LICENSE │ │ │ │ ├── converter.go │ │ │ │ ├── errors.go │ │ │ │ ├── interceptors.go │ │ │ │ ├── interceptors_test.go │ │ │ │ ├── util.go │ │ │ │ └── util_test.go │ │ │ ├── sql │ │ │ │ ├── pagination_token.go │ │ │ │ ├── pagination_token_test.go │ │ │ │ ├── query_converter.go │ │ │ │ ├── query_converter_factory.go │ │ │ │ ├── query_converter_mysql.go │ │ │ │ ├── query_converter_mysql_test.go │ │ │ │ ├── query_converter_postgresql.go │ │ │ │ ├── query_converter_postgresql_test.go │ │ │ │ ├── query_converter_sqlite.go │ │ │ │ ├── query_converter_sqlite_test.go │ │ │ │ ├── query_converter_test.go │ │ │ │ ├── query_converter_util.go │ │ │ │ └── visibility_store.go │ │ │ ├── visibility_store.go │ │ │ └── visibility_store_mock.go │ │ ├── visibility_manager_dual.go │ │ ├── visibility_manager_impl.go │ │ ├── visibility_manager_rate_limited.go │ │ ├── visibility_manager_test.go │ │ └── visiblity_manager_metrics.go │ ├── workflow_state_status_validator.go │ ├── workflow_state_status_validator_test.go │ └── xdc_cache.go ├── pingable │ └── pingable.go ├── pprof │ ├── fx.go │ └── pprof.go ├── predicates │ ├── and.go │ ├── and_test.go │ ├── empty.go │ ├── empty_test.go │ ├── not.go │ ├── not_test.go │ ├── or.go │ ├── or_test.go │ ├── predicates.go │ ├── predicates_test.go │ ├── universal.go │ └── universal_test.go ├── primitives │ ├── README.MD │ ├── constants.go │ ├── namespaces.go │ ├── role.go │ ├── task_queues.go │ ├── timestamp │ │ ├── duration.go │ │ ├── duration_test.go │ │ ├── parse_duration.go │ │ ├── parse_duration_test.go │ │ └── time.go │ └── uuid.go ├── priorities │ ├── priority_util.go │ └── priority_util_test.go ├── protocol │ ├── naming.go │ └── naming_test.go ├── quotas │ ├── bench_test.go │ ├── calculator │ │ ├── calculator.go │ │ ├── cluster_aware_quota_calculator.go │ │ ├── cluster_aware_quota_calculator_test.go │ │ ├── logged_calculator.go │ │ └── logged_calculator_test.go │ ├── clocked_rate_limiter.go │ ├── clocked_rate_limiter_test.go │ ├── delayed_request_rate_limiter.go │ ├── delayed_request_rate_limiter_test.go │ ├── dynamic.go │ ├── dynamic_rate_limiter_impl.go │ ├── map_request_rate_limiter_impl.go │ ├── multi_rate_limiter_impl.go │ ├── multi_rate_limiter_impl_test.go │ ├── multi_request_rate_limiter_impl.go │ ├── multi_reservation_impl.go │ ├── multi_reservation_impl_test.go │ ├── noop_request_rate_limiter_impl.go │ ├── noop_request_rate_limiter_impl_test.go │ ├── noop_reservation_impl.go │ ├── priority_rate_limiter_impl.go │ ├── priority_rate_limiter_impl_test.go │ ├── priority_reservation_impl.go │ ├── priority_reservation_impl_test.go │ ├── quotastest │ │ └── fake_instance_counter.go │ ├── rate_limiter.go │ ├── rate_limiter_impl.go │ ├── rate_limiter_impl_test.go │ ├── rate_limiter_mock.go │ ├── request.go │ ├── request_rate_limiter.go │ ├── request_rate_limiter_adapter_impl.go │ ├── request_rate_limiter_delegator.go │ ├── request_rate_limiter_delegator_test.go │ ├── request_rate_limiter_mock.go │ ├── reservation.go │ ├── reservation_mock.go │ └── routing_rate_limiter_impl.go ├── resolver │ ├── noop_resolver.go │ ├── service_resolver.go │ └── service_resolver_mock.go ├── resource │ └── fx.go ├── resourcetest │ └── test_resource.go ├── retrypolicy │ ├── retry_policy.go │ └── retry_policy_test.go ├── routing │ ├── route.go │ └── route_test.go ├── rpc.go ├── rpc │ ├── context.go │ ├── context_test.go │ ├── encryption │ │ ├── fixedTLSConfigProvider.go │ │ ├── local_store_cert_provider.go │ │ ├── local_store_cert_provider_test.go │ │ ├── local_store_per_host_cert_provider_map.go │ │ ├── local_store_tls_provider.go │ │ ├── test_dynamic_cert_provider.go │ │ ├── test_dynamic_tlsconfig_provider.go │ │ ├── tls_config_test.go │ │ └── tls_factory.go │ ├── grpc.go │ ├── interceptor │ │ ├── caller_info.go │ │ ├── caller_info_test.go │ │ ├── concurrent_request_limit.go │ │ ├── concurrent_request_limit_test.go │ │ ├── dc_redirection_policy.go │ │ ├── dc_redirection_policy_mock.go │ │ ├── dc_redirection_policy_test.go │ │ ├── health.go │ │ ├── logtags │ │ │ ├── admin_service_server_gen.go │ │ │ ├── history_service_server_gen.go │ │ │ ├── matching_service_server_gen.go │ │ │ ├── workflow_service_server_gen.go │ │ │ ├── workflow_tags.go │ │ │ └── workflow_tags_test.go │ │ ├── mask_internal_error.go │ │ ├── mask_internal_error_test.go │ │ ├── namespace.go │ │ ├── namespace_handover.go │ │ ├── namespace_logger.go │ │ ├── namespace_rate_limit.go │ │ ├── namespace_test.go │ │ ├── namespace_validator.go │ │ ├── namespace_validator_test.go │ │ ├── rate_limit.go │ │ ├── rate_limit_test.go │ │ ├── redirection.go │ │ ├── redirection_test.go │ │ ├── retry.go │ │ ├── sdk_version.go │ │ ├── sdk_version_test.go │ │ ├── service_error_interceptor.go │ │ ├── service_error_interceptor_test.go │ │ ├── slow_request_logger.go │ │ ├── slow_request_logger_test.go │ │ ├── stream_error.go │ │ ├── stream_error_test.go │ │ ├── telemetry.go │ │ └── telemetry_test.go │ ├── request_issues.go │ ├── request_issues_test.go │ ├── rpc.go │ └── test │ │ ├── http_test.go │ │ ├── rpc_common_test.go │ │ └── rpc_localstore_tls_test.go ├── rpc_mock.go ├── sdk │ ├── converter.go │ ├── factory.go │ ├── factory_mock.go │ └── metrics_handler.go ├── searchattribute │ ├── defs.go │ ├── defs_test.go │ ├── encode.go │ ├── encode_test.go │ ├── encode_value.go │ ├── encode_value_test.go │ ├── event.go │ ├── event_gen.go │ ├── manager.go │ ├── manager_test.go │ ├── mapper.go │ ├── mapper_mock.go │ ├── mapper_test.go │ ├── name_type_map.go │ ├── name_type_map_test.go │ ├── search_attirbute.go │ ├── search_attribute_mock.go │ ├── search_attribute_test.go │ ├── stringify.go │ ├── stringify_test.go │ ├── system_provider.go │ ├── test_provider.go │ ├── validator.go │ └── validator_test.go ├── serviceerror │ ├── activity_start_during_transition.go │ ├── convert.go │ ├── convert_test.go │ ├── current_branch_changed.go │ ├── obsolete_dispatch_build_id.go │ ├── obsolete_matching_task.go │ ├── retry_replication.go │ ├── service_error_with_dpanic.go │ ├── service_error_with_dpanic_test.go │ ├── shard_ownership_lost.go │ ├── sticky_worker_unavailable.go │ ├── sync_state.go │ └── task_already_started.go ├── shuffle │ └── shuffle.go ├── softassert │ └── softassert.go ├── sqlquery │ ├── query.go │ └── query_test.go ├── stream_batcher │ ├── batcher.go │ └── batcher_test.go ├── tasks │ ├── benchmark_test.go │ ├── dynamic_worker_pool_scheduler.go │ ├── dynamic_worker_pool_scheduler_test.go │ ├── fifo_scheduler.go │ ├── fifo_scheduler_test.go │ ├── group_by_scheduler.go │ ├── group_by_scheduler_test.go │ ├── interleaved_weighted_round_robin.go │ ├── interleaved_weighted_round_robin_test.go │ ├── priority.go │ ├── rate_limited_scheduler.go │ ├── runnable_scheduler.go │ ├── scheduler.go │ ├── scheduler_mock.go │ ├── sequential_scheduler.go │ ├── sequential_scheduler_test.go │ ├── sequential_task_queue.go │ ├── sequential_task_queue_test.go │ ├── state.go │ ├── task.go │ ├── task_mock.go │ └── weighted_channel.go ├── tasktoken │ ├── serializer.go │ └── token.go ├── telemetry │ ├── config.go │ ├── config_test.go │ ├── env.go │ ├── env_test.go │ ├── export_test.go │ ├── grpc.go │ ├── grpc_test.go │ └── tags.go ├── testing │ ├── event_generator.go │ ├── fakedata │ │ ├── fakedata.go │ │ └── fakedata_test.go │ ├── freeport │ │ └── freeport.go │ ├── generator_interface.go │ ├── history_event_test.go │ ├── history_event_util.go │ ├── historyrequire │ │ ├── history_require.go │ │ └── history_require_test.go │ ├── mockapi │ │ ├── generate.go │ │ ├── operatorservicemock │ │ │ └── v1 │ │ │ │ └── service_grpc.pb.mock.go │ │ └── workflowservicemock │ │ │ └── v1 │ │ │ └── service_grpc.pb.mock.go │ ├── mocksdk │ │ ├── client_mock.go │ │ ├── generate.go │ │ ├── generate.sh │ │ ├── value_mock.go │ │ ├── worker_mock.go │ │ └── workflowrun_mock.go │ ├── nettest │ │ ├── listener.go │ │ ├── listener_test.go │ │ ├── package.go │ │ ├── pipe.go │ │ ├── pipe_benchmark_test.go │ │ ├── pipe_test.go │ │ ├── rpc_factory.go │ │ └── rpc_factory_test.go │ ├── otellogger │ │ └── otellogger.go │ ├── protoassert │ │ ├── LICENSE │ │ ├── assert.go │ │ ├── assert_test.go │ │ ├── pretty_print.go │ │ └── testify_assert.go │ ├── protomock │ │ └── matchers.go │ ├── protorequire │ │ └── require.go │ ├── protoutils │ │ └── any.go │ ├── runtime │ │ └── goroutine.go │ ├── taskpoller │ │ └── taskpoller.go │ ├── temporalapi │ │ ├── public_methods.go │ │ └── public_methods_test.go │ ├── testhooks │ │ ├── key.go │ │ ├── noop_impl.go │ │ └── test_impl.go │ ├── testlogger │ │ └── testlogger.go │ ├── testvars │ │ ├── any.go │ │ ├── const.go │ │ ├── hash.go │ │ ├── rand.go │ │ └── test_vars.go │ └── updateutils │ │ └── update.go ├── timer │ ├── gate.go │ ├── local_gate.go │ ├── local_gate_test.go │ ├── remote_gate.go │ └── remote_gate_test.go ├── tqid │ ├── task_queue_id.go │ ├── task_queue_id_test.go │ ├── task_queue_validator.go │ └── task_queue_validator_test.go ├── util.go ├── util │ ├── error_type.go │ ├── proto.go │ ├── proto_test.go │ ├── strings.go │ ├── strings_test.go │ ├── util.go │ ├── util_test.go │ ├── wildcard.go │ └── wildcard_test.go ├── util_test.go ├── worker_versioning │ ├── worker_versioning.go │ └── worker_versioning_test.go └── xdc │ ├── ndc_history_resender.go │ ├── ndc_history_resender_mock.go │ └── ndc_history_resender_test.go ├── components ├── callbacks │ ├── config.go │ ├── executors.go │ ├── executors_test.go │ ├── fx.go │ ├── hsm_invocation.go │ ├── metrics.go │ ├── nexus_invocation.go │ ├── statemachine.go │ ├── statemachine_test.go │ └── tasks.go ├── dummy │ ├── executors.go │ ├── statemachine.go │ └── tasks.go ├── nexusoperations │ ├── completion.go │ ├── config.go │ ├── events.go │ ├── events_test.go │ ├── executors.go │ ├── executors_test.go │ ├── frontend │ │ ├── fx.go │ │ └── handler.go │ ├── fx.go │ ├── helpers_test.go │ ├── link_converter.go │ ├── link_converter_test.go │ ├── metrics.go │ ├── response_size_limiter.go │ ├── statemachine.go │ ├── statemachine_test.go │ ├── tasks.go │ └── workflow │ │ ├── commands.go │ │ └── commands_test.go └── scheduler │ ├── config.go │ ├── generator.go │ ├── generator_executors.go │ ├── generator_executors_test.go │ ├── generator_tasks.go │ ├── helper_test.go │ ├── invoker.go │ ├── invoker_executors.go │ ├── invoker_executors_test.go │ ├── invoker_tasks.go │ ├── scheduler.go │ ├── scheduler_test.go │ ├── spec_processor.go │ ├── spec_processor_mock.go │ ├── spec_processor_test.go │ ├── util.go │ └── util_test.go ├── config ├── development-cass-archival.yaml ├── development-cass-es-custom.yaml ├── development-cass-es-dual.yaml ├── development-cass-es-fi.yaml ├── development-cass-es.yaml ├── development-cass-s3.yaml ├── development-cluster-a.yaml ├── development-cluster-b.yaml ├── development-cluster-c.yaml ├── development-mysql-es.yaml ├── development-mysql8.yaml ├── development-postgres-es.yaml ├── development-postgres12.yaml ├── development-sqlite-file.yaml ├── development-sqlite.yaml ├── development.yaml ├── docker.yaml └── dynamicconfig │ ├── README.md │ ├── development-cass.yaml │ ├── development-sql.yaml │ ├── development-xdc.yaml │ └── docker.yaml ├── develop ├── buf-breaking.sh ├── docker-compose │ ├── README.md │ ├── docker-compose.cdc.darwin.yml │ ├── docker-compose.cdc.linux.yml │ ├── docker-compose.cdc.yml │ ├── docker-compose.darwin.yml │ ├── docker-compose.linux.yml │ ├── docker-compose.secondary-es.yml │ ├── docker-compose.windows.yml │ ├── docker-compose.yml │ ├── grafana │ │ └── provisioning │ │ │ ├── dashboards │ │ │ └── dashboard.yml │ │ │ ├── datasources │ │ │ └── prometheus.yml │ │ │ └── tempo │ │ │ └── tempo.yaml │ ├── mysql-init │ │ └── init.sql │ ├── prometheus-darwin │ │ └── prometheus.yml │ └── prometheus-linux │ │ └── prometheus.yml ├── github │ ├── docker-compose.yml │ ├── mysql-init │ │ └── init.sql │ └── postgresql-init │ │ └── init.sql └── protoc.sh ├── docker └── config_template.yaml ├── docs ├── Makefile ├── README.md ├── _assets │ ├── matching-context.d2 │ ├── matching-context.svg │ ├── retries.d2 │ ├── retries.svg │ └── temporal-high-level.svg ├── admin │ └── dlq.md ├── architecture │ ├── README.md │ ├── effect-package.md │ ├── history-service.md │ ├── in-memory-queue.md │ ├── matching-service.md │ ├── message-protocol.md │ ├── nexus.md │ ├── retry.md │ ├── speculative-workflow-task.md │ ├── workflow-lifecycle.md │ └── workflow-update.md ├── development │ ├── macos │ │ ├── cassandra.md │ │ ├── mysql.md │ │ └── postgresql.md │ ├── new-rpcs.md │ ├── run-dependencies-host.md │ ├── temporal-cla.md │ ├── testing.md │ ├── tls │ │ └── tls.md │ └── tracing.md └── worker-versioning.md ├── go.mod ├── go.sum ├── proto ├── api-linter.yaml ├── buf.work.yaml └── internal │ ├── buf.lock │ ├── buf.yaml │ └── temporal │ └── server │ └── api │ ├── adminservice │ └── v1 │ │ ├── request_response.proto │ │ └── service.proto │ ├── archiver │ └── v1 │ │ └── message.proto │ ├── checksum │ └── v1 │ │ └── message.proto │ ├── cli │ └── v1 │ │ └── message.proto │ ├── clock │ └── v1 │ │ └── message.proto │ ├── cluster │ └── v1 │ │ └── message.proto │ ├── common │ └── v1 │ │ └── dlq.proto │ ├── deployment │ └── v1 │ │ └── message.proto │ ├── enums │ └── v1 │ │ ├── cluster.proto │ │ ├── common.proto │ │ ├── dlq.proto │ │ ├── nexus.proto │ │ ├── predicate.proto │ │ ├── replication.proto │ │ ├── task.proto │ │ ├── workflow.proto │ │ └── workflow_task_type.proto │ ├── errordetails │ └── v1 │ │ └── message.proto │ ├── history │ └── v1 │ │ └── message.proto │ ├── historyservice │ └── v1 │ │ ├── request_response.proto │ │ └── service.proto │ ├── matchingservice │ └── v1 │ │ ├── request_response.proto │ │ └── service.proto │ ├── metrics │ └── v1 │ │ └── message.proto │ ├── namespace │ └── v1 │ │ └── message.proto │ ├── persistence │ └── v1 │ │ ├── chasm.proto │ │ ├── cluster_metadata.proto │ │ ├── executions.proto │ │ ├── history_tree.proto │ │ ├── hsm.proto │ │ ├── namespaces.proto │ │ ├── nexus.proto │ │ ├── predicates.proto │ │ ├── queue_metadata.proto │ │ ├── queues.proto │ │ ├── task_queues.proto │ │ ├── tasks.proto │ │ ├── update.proto │ │ └── workflow_mutable_state.proto │ ├── replication │ └── v1 │ │ └── message.proto │ ├── schedule │ └── v1 │ │ └── message.proto │ ├── taskqueue │ └── v1 │ │ └── message.proto │ ├── testservice │ └── v1 │ │ ├── request_response.proto │ │ └── service.proto │ ├── token │ └── v1 │ │ └── message.proto │ └── workflow │ └── v1 │ └── message.proto ├── schema ├── cassandra │ ├── README.md │ ├── temporal │ │ ├── keyspace.cql │ │ ├── schema.cql │ │ └── versioned │ │ │ ├── v1.0 │ │ │ ├── manifest.json │ │ │ └── schema.cql │ │ │ ├── v1.1 │ │ │ ├── cluster_metadata.cql │ │ │ └── manifest.json │ │ │ ├── v1.10 │ │ │ ├── manifest.json │ │ │ └── nexus_incoming_services.cql │ │ │ ├── v1.11 │ │ │ ├── manifest.json │ │ │ └── nexus_endpoints.cql │ │ │ ├── v1.12 │ │ │ ├── chasm_node_map.cql │ │ │ └── manifest.json │ │ │ ├── v1.2 │ │ │ ├── manifest.json │ │ │ └── queue.cql │ │ │ ├── v1.3 │ │ │ ├── manifest.json │ │ │ └── visibility.cql │ │ │ ├── v1.4 │ │ │ ├── cluster_metadata.cql │ │ │ ├── executions.cql │ │ │ └── manifest.json │ │ │ ├── v1.5 │ │ │ ├── event.cql │ │ │ ├── executions.cql │ │ │ └── manifest.json │ │ │ ├── v1.6 │ │ │ ├── cluster_metadata_info.cql │ │ │ ├── executions.cql │ │ │ └── manifest.json │ │ │ ├── v1.7 │ │ │ ├── executions.cql │ │ │ └── manifest.json │ │ │ ├── v1.8 │ │ │ ├── manifest.json │ │ │ └── task_queue_user_data.cql │ │ │ └── v1.9 │ │ │ ├── manifest.json │ │ │ └── queues.cql │ └── version.go ├── elasticsearch │ └── visibility │ │ ├── cluster_settings_v7.json │ │ ├── index_template_v7.json │ │ └── versioned │ │ ├── v0 │ │ └── index_template_v7.json │ │ ├── v1 │ │ ├── index_template_v7.json │ │ ├── reindex.json │ │ ├── reindex.painless │ │ ├── reindex.sh │ │ ├── rollback.json │ │ ├── rollback.painless │ │ └── rollback.sh │ │ ├── v2 │ │ ├── index_template_v7.json │ │ └── upgrade.sh │ │ ├── v3 │ │ ├── index_template_v7.json │ │ └── upgrade.sh │ │ ├── v4 │ │ ├── index_template_v7.json │ │ └── upgrade.sh │ │ ├── v5 │ │ ├── index_template_v7.json │ │ └── upgrade.sh │ │ ├── v6 │ │ ├── index_template_v7.json │ │ └── upgrade.sh │ │ ├── v7 │ │ ├── index_template_v7.json │ │ └── upgrade.sh │ │ ├── v8 │ │ ├── index_template_v7.json │ │ └── upgrade.sh │ │ └── v9 │ │ ├── index_template_v7.json │ │ └── upgrade.sh ├── embed.go ├── embed_test.go ├── mysql │ └── v8 │ │ ├── temporal │ │ ├── database.sql │ │ ├── schema.sql │ │ └── versioned │ │ │ ├── v1.0 │ │ │ ├── manifest.json │ │ │ └── schema.sql │ │ │ ├── v1.1 │ │ │ ├── cluster_metadata.sql │ │ │ └── manifest.json │ │ │ ├── v1.10 │ │ │ ├── manifest.json │ │ │ └── task_queue_user_data.sql │ │ │ ├── v1.11 │ │ │ ├── manifest.json │ │ │ └── queues.sql │ │ │ ├── v1.12 │ │ │ ├── manifest.json │ │ │ └── nexus_incoming_services.sql │ │ │ ├── v1.13 │ │ │ ├── manifest.json │ │ │ └── nexus_endpoints.sql │ │ │ ├── v1.14 │ │ │ ├── add_current_executions_start_time.sql │ │ │ └── manifest.json │ │ │ ├── v1.15 │ │ │ ├── add_current_executions_data.sql │ │ │ └── manifest.json │ │ │ ├── v1.16 │ │ │ ├── fix_data_encoding_column.sql │ │ │ └── manifest.json │ │ │ ├── v1.17 │ │ │ ├── add_chasm_node_maps.sql │ │ │ └── manifest.json │ │ │ ├── v1.2 │ │ │ ├── blob_size.sql │ │ │ ├── manifest.json │ │ │ └── queue.sql │ │ │ ├── v1.3 │ │ │ ├── manifest.json │ │ │ └── visibility_tasks.sql │ │ │ ├── v1.4 │ │ │ ├── cluster_metadata.sql │ │ │ └── manifest.json │ │ │ ├── v1.5 │ │ │ ├── cluster_membership.sql │ │ │ ├── event.sql │ │ │ ├── executions.sql │ │ │ └── manifest.json │ │ │ ├── v1.6 │ │ │ ├── manifest.json │ │ │ └── queue_metadata.sql │ │ │ ├── v1.7 │ │ │ ├── cluster_metadata_info.sql │ │ │ ├── manifest.json │ │ │ ├── no_start_version.sql │ │ │ └── tiered_storage_tasks.sql │ │ │ ├── v1.8 │ │ │ ├── alter_columns.sql │ │ │ ├── drop_unused_tasks_table.sql │ │ │ └── manifest.json │ │ │ └── v1.9 │ │ │ ├── history_tasks_table.sql │ │ │ └── manifest.json │ │ ├── version.go │ │ └── visibility │ │ ├── database.sql │ │ ├── schema.sql │ │ └── versioned │ │ ├── v1.0 │ │ ├── manifest.json │ │ └── schema.sql │ │ ├── v1.1 │ │ ├── index.sql │ │ └── manifest.json │ │ ├── v1.2 │ │ ├── advanced_visibility.sql │ │ └── manifest.json │ │ ├── v1.3 │ │ ├── add_build_ids_search_attribute.sql │ │ ├── add_history_size_bytes.sql │ │ └── manifest.json │ │ ├── v1.4 │ │ ├── add_execution_duration.sql │ │ ├── add_parent_workflow_info.sql │ │ ├── add_state_transition_count.sql │ │ └── manifest.json │ │ ├── v1.5 │ │ ├── add_root_workflow_info.sql │ │ └── manifest.json │ │ ├── v1.6 │ │ ├── fix_root_workflow_info.sql │ │ └── manifest.json │ │ ├── v1.7 │ │ ├── add_pause_info_search_attribute.sql │ │ └── manifest.json │ │ ├── v1.8 │ │ ├── add_deployment_search_attributes.sql │ │ └── manifest.json │ │ └── v1.9 │ │ ├── add_version_column.sql │ │ └── manifest.json ├── postgresql │ └── v12 │ │ ├── temporal │ │ ├── database.sql │ │ ├── schema.sql │ │ └── versioned │ │ │ ├── v1.0 │ │ │ ├── manifest.json │ │ │ └── schema.sql │ │ │ ├── v1.1 │ │ │ ├── cluster_metadata.sql │ │ │ └── manifest.json │ │ │ ├── v1.10 │ │ │ ├── manifest.json │ │ │ └── task_queue_user_data.sql │ │ │ ├── v1.11 │ │ │ ├── manifest.json │ │ │ └── queue_v2.sql │ │ │ ├── v1.12 │ │ │ ├── manifest.json │ │ │ └── nexus_incoming_services.sql │ │ │ ├── v1.13 │ │ │ ├── manifest.json │ │ │ └── nexus_endpoints.sql │ │ │ ├── v1.14 │ │ │ ├── add_current_executions_start_time.sql │ │ │ └── manifest.json │ │ │ ├── v1.15 │ │ │ ├── add_current_executions_data.sql │ │ │ └── manifest.json │ │ │ ├── v1.16 │ │ │ ├── fix_data_encoding_column.sql │ │ │ └── manifest.json │ │ │ ├── v1.17 │ │ │ ├── add_chasm_node_maps.sql │ │ │ └── manifest.json │ │ │ ├── v1.2 │ │ │ ├── manifest.json │ │ │ └── queue.sql │ │ │ ├── v1.3 │ │ │ ├── manifest.json │ │ │ └── visibility_tasks.sql │ │ │ ├── v1.4 │ │ │ ├── cluster_metadata.sql │ │ │ └── manifest.json │ │ │ ├── v1.5 │ │ │ ├── cluster_membership.sql │ │ │ ├── event.sql │ │ │ ├── executions.sql │ │ │ └── manifest.json │ │ │ ├── v1.6 │ │ │ ├── manifest.json │ │ │ └── queue_metadata.sql │ │ │ ├── v1.7 │ │ │ ├── cluster_metadata_info.sql │ │ │ ├── manifest.json │ │ │ ├── no_start_version.sql │ │ │ └── tiered_storage_tasks.sql │ │ │ ├── v1.8 │ │ │ ├── alter_columns.sql │ │ │ ├── drop_unused_tasks_table.sql │ │ │ └── manifest.json │ │ │ └── v1.9 │ │ │ ├── history_tasks_table.sql │ │ │ └── manifest.json │ │ ├── version.go │ │ └── visibility │ │ ├── database.sql │ │ ├── schema.sql │ │ └── versioned │ │ ├── v1.0 │ │ ├── manifest.json │ │ └── schema.sql │ │ ├── v1.1 │ │ ├── index.sql │ │ └── manifest.json │ │ ├── v1.2 │ │ ├── advanced_visibility.sql │ │ └── manifest.json │ │ ├── v1.3 │ │ ├── add_build_ids_search_attribute.sql │ │ ├── add_history_size_bytes.sql │ │ └── manifest.json │ │ ├── v1.4 │ │ ├── add_execution_duration.sql │ │ ├── add_parent_workflow_info.sql │ │ ├── add_state_transition_count.sql │ │ └── manifest.json │ │ ├── v1.5 │ │ ├── add_root_workflow_info.sql │ │ └── manifest.json │ │ ├── v1.6 │ │ ├── fix_root_workflow_info.sql │ │ └── manifest.json │ │ ├── v1.7 │ │ ├── add_pause_info_search_attribute.sql │ │ └── manifest.json │ │ ├── v1.8 │ │ ├── add_deployment_search_attributes.sql │ │ └── manifest.json │ │ └── v1.9 │ │ ├── add_version_column.sql │ │ └── manifest.json └── sqlite │ ├── LICENSE │ ├── setup.go │ ├── v3 │ ├── temporal │ │ ├── schema.sql │ │ └── versioned │ │ │ ├── v0.2 │ │ │ ├── manifest.json │ │ │ └── task_queue_user_data.sql │ │ │ ├── v0.3 │ │ │ ├── manifest.json │ │ │ └── queue_v2.sql │ │ │ ├── v0.4 │ │ │ ├── manifest.json │ │ │ └── nexus_incoming_services.sql │ │ │ ├── v0.5 │ │ │ ├── manifest.json │ │ │ └── nexus_endpoints.sql │ │ │ ├── v0.6 │ │ │ ├── add_current_executions_start_time.sql │ │ │ └── manifest.json │ │ │ ├── v0.7 │ │ │ ├── add_current_executions_data.sql │ │ │ └── manifest.json │ │ │ ├── v0.8 │ │ │ ├── fix_data_encoding_column.sql │ │ │ └── manifest.json │ │ │ └── v0.9 │ │ │ ├── add_chasm_node_maps.sql │ │ │ └── manifest.json │ └── visibility │ │ └── schema.sql │ └── version.go ├── service ├── frontend │ ├── admin_handler.go │ ├── admin_handler_test.go │ ├── configs │ │ ├── quotas.go │ │ └── quotas_test.go │ ├── errors.go │ ├── fx.go │ ├── fx_test.go │ ├── health_check.go │ ├── health_check_test.go │ ├── http_api_server.go │ ├── interface.go │ ├── namespace_handler.go │ ├── namespace_handler_mock.go │ ├── namespace_handler_test.go │ ├── nexus_endpoint_client.go │ ├── nexus_handler.go │ ├── nexus_handler_test.go │ ├── nexus_http_handler.go │ ├── nexus_http_response_writer.go │ ├── openapi_http_handler.go │ ├── operator_handler.go │ ├── operator_handler_test.go │ ├── overrides.go │ ├── overrides_test.go │ ├── protojson_marshaler.go │ ├── service.go │ ├── task_reachability.go │ ├── validators.go │ ├── version_checker.go │ ├── workflow_handler.go │ ├── workflow_handler_second_test.go │ └── workflow_handler_test.go ├── fx.go ├── history │ ├── README.md │ ├── api │ │ ├── activity_util.go │ │ ├── addtasks │ │ │ ├── api.go │ │ │ └── api_test.go │ │ ├── command_attr_validator.go │ │ ├── command_attr_validator_test.go │ │ ├── consistency_checker.go │ │ ├── consistency_checker_mock.go │ │ ├── consistency_checker_test.go │ │ ├── create_workflow_util.go │ │ ├── create_workflow_util_test.go │ │ ├── deletedlqtasks │ │ │ ├── api.go │ │ │ ├── api_test.go │ │ │ └── deletedlqtaskstest │ │ │ │ └── apitest.go │ │ ├── deleteworkflow │ │ │ └── api.go │ │ ├── describemutablestate │ │ │ └── api.go │ │ ├── describeworkflow │ │ │ └── api.go │ │ ├── forcedeleteworkflowexecution │ │ │ └── api.go │ │ ├── get_history_util.go │ │ ├── get_workflow_util.go │ │ ├── getdlqtasks │ │ │ ├── api.go │ │ │ ├── api_test.go │ │ │ └── getdlqtaskstest │ │ │ │ └── apitest.go │ │ ├── getworkflowexecutionhistory │ │ │ └── api.go │ │ ├── getworkflowexecutionhistoryreverse │ │ │ └── api.go │ │ ├── getworkflowexecutionrawhistory │ │ │ ├── api.go │ │ │ └── api_test.go │ │ ├── getworkflowexecutionrawhistoryv2 │ │ │ └── api.go │ │ ├── isactivitytaskvalid │ │ │ ├── api.go │ │ │ └── api_test.go │ │ ├── isworkflowtaskvalid │ │ │ ├── api.go │ │ │ └── api_test.go │ │ ├── listqueues │ │ │ ├── api.go │ │ │ ├── api_test.go │ │ │ └── listqueuestest │ │ │ │ └── apitest.go │ │ ├── listtasks │ │ │ ├── api.go │ │ │ └── api_test.go │ │ ├── multioperation │ │ │ └── api.go │ │ ├── namespace.go │ │ ├── pauseactivity │ │ │ ├── api.go │ │ │ └── api_test.go │ │ ├── pollupdate │ │ │ ├── api.go │ │ │ └── api_test.go │ │ ├── queryworkflow │ │ │ └── api.go │ │ ├── reapplyevents │ │ │ └── api.go │ │ ├── recordactivitytaskheartbeat │ │ │ └── api.go │ │ ├── recordactivitytaskstarted │ │ │ └── api.go │ │ ├── recordchildworkflowcompleted │ │ │ ├── api.go │ │ │ └── api_test.go │ │ ├── recordworkflowtaskstarted │ │ │ └── api.go │ │ ├── refreshworkflow │ │ │ └── api.go │ │ ├── removesignalmutablestate │ │ │ └── api.go │ │ ├── replication │ │ │ ├── generate_task.go │ │ │ ├── get_dlq_tasks.go │ │ │ ├── get_tasks.go │ │ │ ├── status.go │ │ │ └── sync_workflow_state.go │ │ ├── replication_util.go │ │ ├── replicationadmin │ │ │ ├── get_dlq.go │ │ │ ├── merge_dlq.go │ │ │ └── purge_dlq.go │ │ ├── requestcancelworkflow │ │ │ └── api.go │ │ ├── resetactivity │ │ │ └── api.go │ │ ├── resetstickytaskqueue │ │ │ └── api.go │ │ ├── resetworkflow │ │ │ ├── api.go │ │ │ └── api_test.go │ │ ├── respondactivitytaskcanceled │ │ │ └── api.go │ │ ├── respondactivitytaskcompleted │ │ │ └── api.go │ │ ├── respondactivitytaskfailed │ │ │ ├── api.go │ │ │ └── api_test.go │ │ ├── respondworkflowtaskcompleted │ │ │ ├── api.go │ │ │ ├── api_test.go │ │ │ ├── workflow_size_checker.go │ │ │ ├── workflow_size_checker_test.go │ │ │ ├── workflow_task_completed_handler.go │ │ │ └── workflow_task_completed_handler_test.go │ │ ├── respondworkflowtaskfailed │ │ │ └── api.go │ │ ├── retry_util.go │ │ ├── scheduleworkflowtask │ │ │ └── api.go │ │ ├── signal_workflow_util.go │ │ ├── signalwithstartworkflow │ │ │ ├── api.go │ │ │ ├── convert.go │ │ │ ├── signal_with_start_workflow.go │ │ │ └── signal_with_start_workflow_test.go │ │ ├── signalworkflow │ │ │ ├── api.go │ │ │ └── api_test.go │ │ ├── startworkflow │ │ │ └── api.go │ │ ├── task_category.go │ │ ├── task_category_test.go │ │ ├── terminateworkflow │ │ │ └── api.go │ │ ├── token.go │ │ ├── trim_history_util.go │ │ ├── unpauseactivity │ │ │ └── api.go │ │ ├── update_workflow_util.go │ │ ├── updateactivityoptions │ │ │ ├── api.go │ │ │ └── api_test.go │ │ ├── updateworkflow │ │ │ └── api.go │ │ ├── updateworkflowoptions │ │ │ ├── api.go │ │ │ └── api_test.go │ │ ├── verifychildworkflowcompletionrecorded │ │ │ └── api.go │ │ ├── verifyfirstworkflowtaskscheduled │ │ │ ├── api.go │ │ │ └── api_test.go │ │ ├── workflow_id_dedup.go │ │ ├── workflow_id_dedup_test.go │ │ └── workflow_lease.go │ ├── archival │ │ ├── archiver.go │ │ ├── archiver_mock.go │ │ ├── archiver_test.go │ │ └── fx.go │ ├── archival_queue_factory.go │ ├── archival_queue_factory_test.go │ ├── archival_queue_task_executor.go │ ├── archival_queue_task_executor_test.go │ ├── chasm_engine.go │ ├── chasm_engine_test.go │ ├── circuitbreakerpool │ │ ├── circuit_breaker_factory.go │ │ └── fx.go │ ├── configs │ │ ├── config.go │ │ ├── quotas.go │ │ ├── quotas_test.go │ │ └── task.go │ ├── consts │ │ └── const.go │ ├── deletemanager │ │ ├── delete_manager.go │ │ ├── delete_manager_mock.go │ │ └── delete_manager_test.go │ ├── events │ │ ├── cache.go │ │ ├── cache_test.go │ │ ├── events_cache_mock.go │ │ ├── fx.go │ │ ├── notifier.go │ │ └── notifier_test.go │ ├── fx.go │ ├── handler.go │ ├── handler_test.go │ ├── history_engine.go │ ├── history_engine2_test.go │ ├── history_engine3_eventsv2_test.go │ ├── history_engine_factory.go │ ├── history_engine_test.go │ ├── history_test.go │ ├── historybuilder │ │ ├── event_factory.go │ │ ├── event_store.go │ │ ├── history_builder.go │ │ ├── history_builder_categorization_test.go │ │ └── history_builder_test.go │ ├── hsm │ │ ├── events.go │ │ ├── executor.go │ │ ├── hsmtest │ │ │ ├── backend.go │ │ │ ├── sm.go │ │ │ └── task.go │ │ ├── registry.go │ │ ├── remote_methods.go │ │ ├── sm.go │ │ ├── sm_test.go │ │ ├── tasks.go │ │ ├── tree.go │ │ └── tree_test.go │ ├── interfaces │ │ ├── chasm_tree.go │ │ ├── chasm_tree_mock.go │ │ ├── engine.go │ │ ├── engine_mock.go │ │ ├── mutable_state.go │ │ ├── mutable_state_mock.go │ │ ├── query_register.go │ │ ├── replication_stream.go │ │ ├── shard_context.go │ │ ├── shard_context_mock.go │ │ ├── transaction_policy.go │ │ ├── workflow_context.go │ │ ├── workflow_context_mock.go │ │ └── workflow_task_info.go │ ├── memory_scheduled_queue_factory.go │ ├── ndc │ │ ├── activity_state_replicator.go │ │ ├── activity_state_replicator_mock.go │ │ ├── activity_state_replicator_test.go │ │ ├── branch_manager.go │ │ ├── branch_manager_mock.go │ │ ├── branch_manager_test.go │ │ ├── buffer_event_flusher.go │ │ ├── buffer_event_flusher_mock.go │ │ ├── buffer_event_flusher_test.go │ │ ├── conflict_resolver.go │ │ ├── conflict_resolver_mock.go │ │ ├── conflict_resolver_test.go │ │ ├── constants.go │ │ ├── events_reapplier.go │ │ ├── events_reapplier_mock.go │ │ ├── events_reapplier_test.go │ │ ├── history_importer.go │ │ ├── history_replicator.go │ │ ├── hsm_state_replicator.go │ │ ├── hsm_state_replicator_mock.go │ │ ├── hsm_state_replicator_test.go │ │ ├── mutable_state_initializer.go │ │ ├── mutable_state_mapper.go │ │ ├── mutable_state_mapper_test.go │ │ ├── replication_task.go │ │ ├── replication_task_test.go │ │ ├── resetter.go │ │ ├── resetter_test.go │ │ ├── state_rebuilder.go │ │ ├── state_rebuilder_mock.go │ │ ├── state_rebuilder_test.go │ │ ├── transaction_manager.go │ │ ├── transaction_manager_existing_workflow.go │ │ ├── transaction_manager_existing_workflow_mock.go │ │ ├── transaction_manager_existing_workflow_test.go │ │ ├── transaction_manager_mock.go │ │ ├── transaction_manager_new_workflow.go │ │ ├── transaction_manager_new_workflow_mock.go │ │ ├── transaction_manager_new_workflow_test.go │ │ ├── transaction_manager_test.go │ │ ├── workflow.go │ │ ├── workflow_mock.go │ │ ├── workflow_resetter.go │ │ ├── workflow_resetter_mock.go │ │ ├── workflow_resetter_test.go │ │ ├── workflow_state_replicator.go │ │ ├── workflow_state_replicator_mock.go │ │ ├── workflow_state_replicator_test.go │ │ └── workflow_test.go │ ├── ndc_standby_task_util.go │ ├── ndc_task_util.go │ ├── outbound_queue_active_task_executor.go │ ├── outbound_queue_factory.go │ ├── outbound_queue_standby_task_executor.go │ ├── queue_factory_base.go │ ├── queue_factory_base_test.go │ ├── queues │ │ ├── action.go │ │ ├── action_pending_task_count.go │ │ ├── action_reader_stuck.go │ │ ├── action_slice_count.go │ │ ├── action_slice_predicate.go │ │ ├── active_standby_executor.go │ │ ├── active_standby_executor_test.go │ │ ├── alerts.go │ │ ├── convert.go │ │ ├── convert_test.go │ │ ├── dlq_writer.go │ │ ├── dlq_writer_test.go │ │ ├── executable.go │ │ ├── executable_factory.go │ │ ├── executable_mock.go │ │ ├── executable_test.go │ │ ├── grouper.go │ │ ├── grouper_test.go │ │ ├── iterator.go │ │ ├── iterator_test.go │ │ ├── memory_scheduled_queue.go │ │ ├── memory_scheduled_queue_test.go │ │ ├── metrics.go │ │ ├── metrics_test.go │ │ ├── mitigator.go │ │ ├── mitigator_test.go │ │ ├── monitor.go │ │ ├── monitor_test.go │ │ ├── priority_assigner.go │ │ ├── priority_assigner_test.go │ │ ├── queue.go │ │ ├── queue_base.go │ │ ├── queue_base_test.go │ │ ├── queue_immediate.go │ │ ├── queue_immediate_test.go │ │ ├── queue_mock.go │ │ ├── queue_scheduled.go │ │ ├── queue_scheduled_test.go │ │ ├── queuestest │ │ │ └── fake_queue_writer.go │ │ ├── range.go │ │ ├── range_test.go │ │ ├── reader.go │ │ ├── reader_group.go │ │ ├── reader_group_test.go │ │ ├── reader_quotas.go │ │ ├── reader_test.go │ │ ├── rescheduler.go │ │ ├── rescheduler_mock.go │ │ ├── rescheduler_test.go │ │ ├── scheduler.go │ │ ├── scheduler_mock.go │ │ ├── scheduler_monitor.go │ │ ├── scheduler_quotas.go │ │ ├── scheuduler_monitor_test.go │ │ ├── scope.go │ │ ├── scope_test.go │ │ ├── slice.go │ │ ├── slice_test.go │ │ ├── speculative_workflow_task_timeout_executable.go │ │ ├── speculative_workflow_task_timeout_queue.go │ │ ├── test_util.go │ │ ├── tracker.go │ │ ├── util.go │ │ └── util_test.go │ ├── replication │ │ ├── ack_manager.go │ │ ├── ack_manager_mock.go │ │ ├── ack_manager_test.go │ │ ├── batchable_task.go │ │ ├── batchable_task_mock.go │ │ ├── batchable_task_test.go │ │ ├── bi_direction_stream.go │ │ ├── bi_direction_stream_test.go │ │ ├── dlq_handler.go │ │ ├── dlq_handler_mock.go │ │ ├── dlq_handler_test.go │ │ ├── dlq_writer.go │ │ ├── dlq_writer_test.go │ │ ├── eager_namespace_refresher.go │ │ ├── eager_namespace_refresher_mock.go │ │ ├── eager_namespace_refresher_test.go │ │ ├── eventhandler │ │ │ ├── event_importer.go │ │ │ ├── event_importer_mock.go │ │ │ ├── event_importer_test.go │ │ │ ├── history_events_handler.go │ │ │ ├── history_events_handler_mock.go │ │ │ ├── history_events_handler_test.go │ │ │ ├── remote_history_paginated_fetcher.go │ │ │ ├── remote_history_paginated_fetcher_mock.go │ │ │ ├── remote_history_paginated_fetcher_test.go │ │ │ ├── resend_handler.go │ │ │ ├── resend_handler_mock.go │ │ │ └── resend_handler_test.go │ │ ├── executable_activity_state_task.go │ │ ├── executable_activity_state_task_test.go │ │ ├── executable_backfill_history_events_task.go │ │ ├── executable_backfill_history_events_task_test.go │ │ ├── executable_history_task.go │ │ ├── executable_history_task_test.go │ │ ├── executable_noop_task.go │ │ ├── executable_noop_task_test.go │ │ ├── executable_sync_hsm_task.go │ │ ├── executable_sync_hsm_task_test.go │ │ ├── executable_sync_versioned_transition_task.go │ │ ├── executable_task.go │ │ ├── executable_task_converter.go │ │ ├── executable_task_mock.go │ │ ├── executable_task_test.go │ │ ├── executable_task_tool_box.go │ │ ├── executable_task_tracker.go │ │ ├── executable_task_tracker_mock.go │ │ ├── executable_task_tracker_test.go │ │ ├── executable_unknown_task.go │ │ ├── executable_unknown_task_test.go │ │ ├── executable_verify_versioned_transition_task.go │ │ ├── executable_verify_versioned_transition_task_test.go │ │ ├── executable_workflow_state_task.go │ │ ├── executable_workflow_state_task_test.go │ │ ├── fx.go │ │ ├── grpc_stream_client.go │ │ ├── metrics.go │ │ ├── noop_dlq_writer.go │ │ ├── poller_manager.go │ │ ├── poller_manager_test.go │ │ ├── progress_cache.go │ │ ├── progress_cache_mock.go │ │ ├── progress_cache_test.go │ │ ├── raw_task_converter.go │ │ ├── raw_task_converter_mock.go │ │ ├── raw_task_converter_test.go │ │ ├── sequential_batch_queue.go │ │ ├── sequential_batch_queue_test.go │ │ ├── sequential_queue.go │ │ ├── stream.go │ │ ├── stream_receiver.go │ │ ├── stream_receiver_flow_controller.go │ │ ├── stream_receiver_flow_controller_mock.go │ │ ├── stream_receiver_flow_controller_test.go │ │ ├── stream_receiver_mock.go │ │ ├── stream_receiver_monitor.go │ │ ├── stream_receiver_monitor_test.go │ │ ├── stream_receiver_test.go │ │ ├── stream_sender.go │ │ ├── stream_sender_flow_controller.go │ │ ├── stream_sender_flow_controller_mock.go │ │ ├── stream_sender_flow_controller_test.go │ │ ├── stream_sender_mock.go │ │ ├── stream_sender_test.go │ │ ├── stream_test.go │ │ ├── sync_state_retriever.go │ │ ├── sync_state_retriever_mock.go │ │ ├── sync_state_retriever_test.go │ │ ├── task_executor.go │ │ ├── task_executor_mock.go │ │ ├── task_executor_test.go │ │ ├── task_fetcher.go │ │ ├── task_fetcher_mock.go │ │ ├── task_fetcher_test.go │ │ ├── task_processor.go │ │ ├── task_processor_manager.go │ │ ├── task_processor_manager_test.go │ │ ├── task_processor_mock.go │ │ └── task_processor_test.go │ ├── service.go │ ├── shard │ │ ├── context_factory.go │ │ ├── context_factory_mock.go │ │ ├── context_impl.go │ │ ├── context_test.go │ │ ├── context_testutil.go │ │ ├── context_util.go │ │ ├── context_util_test.go │ │ ├── controller.go │ │ ├── controller_impl.go │ │ ├── controller_mock.go │ │ ├── controller_test.go │ │ ├── engine_factory.go │ │ ├── engine_factory_mock.go │ │ ├── fx.go │ │ ├── ownership.go │ │ ├── ownership_based_quota_calculator.go │ │ ├── ownership_based_quota_scaler.go │ │ ├── ownership_based_quota_scaler_test.go │ │ ├── ownership_test.go │ │ ├── task_key_generator.go │ │ ├── task_key_generator_test.go │ │ ├── task_key_manager.go │ │ ├── task_key_manager_test.go │ │ ├── task_request_tracker.go │ │ └── task_request_tracker_test.go │ ├── statemachine_environment.go │ ├── statemachine_environment_test.go │ ├── tasks │ │ ├── activity_replication_task.go │ │ ├── activity_retry_timer.go │ │ ├── activity_task.go │ │ ├── activity_task_timer.go │ │ ├── archive_execution_task.go │ │ ├── archive_execution_task_test.go │ │ ├── category.go │ │ ├── chasm_task.go │ │ ├── child_workflow_task.go │ │ ├── close_task.go │ │ ├── close_visibility_task.go │ │ ├── delete_execution_task.go │ │ ├── delete_visibility_task.go │ │ ├── delete_workflow_execution_stage.go │ │ ├── fake_task.go │ │ ├── history_replication_task.go │ │ ├── key.go │ │ ├── key_test.go │ │ ├── predicates.go │ │ ├── predicates_test.go │ │ ├── requst_cancel_task.go │ │ ├── reset_task.go │ │ ├── signal_task.go │ │ ├── start_visibility_task.go │ │ ├── state_machine_task.go │ │ ├── sync_hsm_task.go │ │ ├── sync_versioned_transition_task.go │ │ ├── sync_workflow_state_task.go │ │ ├── task.go │ │ ├── task_category_registry.go │ │ ├── task_mock.go │ │ ├── upsert_visibility_task.go │ │ ├── user_timer.go │ │ ├── utils.go │ │ ├── workflow_cleanup_timer.go │ │ ├── workflow_delay_timer.go │ │ ├── workflow_execution_timer.go │ │ ├── workflow_run_timer.go │ │ ├── workflow_task.go │ │ └── workflow_task_timer.go │ ├── tests │ │ └── vars.go │ ├── timer_queue_active_task_executor.go │ ├── timer_queue_active_task_executor_test.go │ ├── timer_queue_factory.go │ ├── timer_queue_standby_task_executor.go │ ├── timer_queue_standby_task_executor_test.go │ ├── timer_queue_task_executor_base.go │ ├── timer_queue_task_executor_base_test.go │ ├── transfer_queue_active_task_executor.go │ ├── transfer_queue_active_task_executor_test.go │ ├── transfer_queue_factory.go │ ├── transfer_queue_standby_task_executor.go │ ├── transfer_queue_standby_task_executor_test.go │ ├── transfer_queue_task_executor_base.go │ ├── vclock │ │ └── vclock.go │ ├── visibility_queue_factory.go │ ├── visibility_queue_task_executor.go │ ├── visibility_queue_task_executor_test.go │ ├── worker_versioning_util.go │ ├── workflow │ │ ├── activity.go │ │ ├── activity_test.go │ │ ├── cache │ │ │ ├── cache.go │ │ │ ├── cache_mock.go │ │ │ ├── cache_test.go │ │ │ ├── export_testing.go │ │ │ └── fx.go │ │ ├── checksum.go │ │ ├── command_handler.go │ │ ├── context.go │ │ ├── context_test.go │ │ ├── fx.go │ │ ├── matcher │ │ │ ├── activity_evaluator.go │ │ │ ├── activity_evaluator_test.go │ │ │ ├── activity_matcher.go │ │ │ ├── errors.go │ │ │ ├── errors_test.go │ │ │ ├── evaluator.go │ │ │ ├── mutable_state_evaluator.go │ │ │ ├── mutable_state_evaluator_test.go │ │ │ ├── mutable_state_matcher.go │ │ │ └── mutable_state_matcher_test.go │ │ ├── metrics.go │ │ ├── mutable_state_impl.go │ │ ├── mutable_state_impl_restart_activity_test.go │ │ ├── mutable_state_impl_test.go │ │ ├── mutable_state_rebuilder.go │ │ ├── mutable_state_rebuilder_mock.go │ │ ├── mutable_state_rebuilder_test.go │ │ ├── mutable_state_state_status.go │ │ ├── mutable_state_util.go │ │ ├── noop_chasm_tree.go │ │ ├── query.go │ │ ├── query_registry.go │ │ ├── query_registry_test.go │ │ ├── query_test.go │ │ ├── relocatable_attributes_fetcher.go │ │ ├── relocatable_attributes_fetcher_test.go │ │ ├── retry.go │ │ ├── retry_test.go │ │ ├── state_machine_definition.go │ │ ├── state_machine_timers.go │ │ ├── state_machine_timers_test.go │ │ ├── state_transition_history.go │ │ ├── state_transition_history_test.go │ │ ├── task_generator.go │ │ ├── task_generator_mock.go │ │ ├── task_generator_provider.go │ │ ├── task_generator_test.go │ │ ├── task_refresher.go │ │ ├── task_refresher_mock.go │ │ ├── task_refresher_test.go │ │ ├── test_util.go │ │ ├── timer_sequence.go │ │ ├── timer_sequence_mock.go │ │ ├── timer_sequence_test.go │ │ ├── transaction.go │ │ ├── transaction_impl.go │ │ ├── transaction_mock.go │ │ ├── transaction_test.go │ │ ├── update │ │ │ ├── README.md │ │ │ ├── abort_reason.go │ │ │ ├── abort_reason_test.go │ │ │ ├── errors_failures.go │ │ │ ├── export_test.go │ │ │ ├── registry.go │ │ │ ├── registry_test.go │ │ │ ├── state.go │ │ │ ├── status.go │ │ │ ├── store.go │ │ │ ├── store_mock_test.go │ │ │ ├── update.go │ │ │ ├── update_test.go │ │ │ ├── util.go │ │ │ ├── validation.go │ │ │ └── version.go │ │ ├── util.go │ │ ├── workflow_task_state_machine.go │ │ ├── workflow_task_state_machine_mock.go │ │ └── workflow_test │ │ │ └── mutable_state_impl_test.go │ ├── workflow_rebuilder.go │ └── workflow_rebuilder_mock.go ├── matching │ ├── README.md │ ├── ack_manager.go │ ├── ack_manager_test.go │ ├── backlog_age_tracker.go │ ├── backlog_manager.go │ ├── backlog_manager_test.go │ ├── config.go │ ├── configs │ │ ├── quotas.go │ │ └── quotas_test.go │ ├── db.go │ ├── deployment_util.go │ ├── forwarder.go │ ├── forwarder_test.go │ ├── fx.go │ ├── handler.go │ ├── liveness.go │ ├── liveness_test.go │ ├── loadcause_string_gen.go │ ├── matcher.go │ ├── matcher_data.go │ ├── matcher_data_test.go │ ├── matcher_test.go │ ├── matching_engine.go │ ├── matching_engine_interfaces.go │ ├── matching_engine_test.go │ ├── nexus_endpoint_client.go │ ├── physical_task_queue_key.go │ ├── physical_task_queue_key_test.go │ ├── physical_task_queue_manager.go │ ├── physical_task_queue_manager_interface.go │ ├── physical_task_queue_manager_mock.go │ ├── physical_task_queue_manager_test.go │ ├── poller_history.go │ ├── pri_backlog_manager.go │ ├── pri_forwarder.go │ ├── pri_matcher.go │ ├── pri_metrics_handler.go │ ├── pri_task_reader.go │ ├── pri_task_writer.go │ ├── reachability.go │ ├── reachability_test.go │ ├── service.go │ ├── task.go │ ├── task_gc.go │ ├── task_queue_partition_manager.go │ ├── task_queue_partition_manager_interface.go │ ├── task_queue_partition_manager_mock.go │ ├── task_queue_partition_manager_test.go │ ├── task_reader.go │ ├── task_tracker.go │ ├── task_tracker_test.go │ ├── task_validation.go │ ├── task_validation_test.go │ ├── task_writer.go │ ├── unloadcause_string_gen.go │ ├── user_data_manager.go │ ├── user_data_manager_test.go │ ├── version_rule_helper_test.go │ ├── version_rule_helpers.go │ ├── version_rule_test.go │ ├── version_sets.go │ ├── version_sets_merge.go │ ├── version_sets_merge_test.go │ └── version_sets_test.go └── worker │ ├── README.md │ ├── addsearchattributes │ ├── fx.go │ └── workflow.go │ ├── batcher │ ├── activities.go │ ├── activities_test.go │ ├── fx.go │ ├── workflow.go │ └── workflow_test.go │ ├── common │ ├── fx.go │ ├── interface.go │ └── interface_mock.go │ ├── deletenamespace │ ├── activities.go │ ├── activities_test.go │ ├── deleteexecutions │ │ ├── activities.go │ │ ├── config.go │ │ ├── workflow.go │ │ └── workflow_test.go │ ├── errors │ │ └── errors.go │ ├── fx.go │ ├── reclaimresources │ │ ├── activities.go │ │ ├── activities_test.go │ │ ├── workflow.go │ │ └── workflow_test.go │ ├── workflow.go │ └── workflow_test.go │ ├── deployment │ ├── deployment_activities.go │ ├── deployment_client.go │ ├── deployment_reachability.go │ ├── deployment_reachability_test.go │ ├── deployment_series_activities.go │ ├── deployment_series_workflow.go │ ├── deployment_series_workflow_test.go │ ├── deployment_util.go │ ├── deployment_util_test.go │ ├── deployment_workflow.go │ ├── deployment_workflow_test.go │ └── fx.go │ ├── dlq │ ├── workflow.go │ └── workflow_test.go │ ├── fx.go │ ├── migration │ ├── activities.go │ ├── activities_test.go │ ├── catchup_workflow.go │ ├── catchup_workflow_test.go │ ├── force_replication_workflow.go │ ├── force_replication_workflow_test.go │ ├── fx.go │ ├── handover_workflow.go │ └── handover_workflow_test.go │ ├── parentclosepolicy │ ├── client.go │ ├── client_mock.go │ ├── processor.go │ ├── workflow.go │ └── workflow_test.go │ ├── pernamespaceworker.go │ ├── pernamespaceworker_test.go │ ├── replicator │ ├── replication_message_processor.go │ ├── replicator.go │ └── replicator_test.go │ ├── scanner │ ├── build_ids │ │ ├── scavenger.go │ │ └── scavenger_test.go │ ├── executions │ │ ├── history_event_id_validator.go │ │ ├── interfaces.go │ │ ├── mutable_state_validator.go │ │ ├── scavenger.go │ │ └── task.go │ ├── executor │ │ ├── executor.go │ │ ├── executor_test.go │ │ └── runq.go │ ├── history │ │ ├── scavenger.go │ │ └── scavenger_test.go │ ├── scanner.go │ ├── scanner_test.go │ ├── taskqueue │ │ ├── db.go │ │ ├── handler.go │ │ ├── mocks_test.go │ │ ├── scavenger.go │ │ └── scavenger_test.go │ ├── workflow.go │ └── workflow_test.go │ ├── scheduler │ ├── activities.go │ ├── buffer.go │ ├── buffer_test.go │ ├── calendar.go │ ├── calendar_test.go │ ├── fx.go │ ├── query.go │ ├── query_test.go │ ├── replay_test.go │ ├── responsebuilder_test.go │ ├── spec.go │ ├── spec_test.go │ ├── testdata │ │ ├── generate_history.sh │ │ ├── replay_recent_actions_includes_status.json.gz │ │ ├── replay_v1.19.1.json.gz │ │ ├── replay_v1.20.4.json.gz │ │ ├── replay_v1.21.3.json.gz │ │ ├── replay_v1.21.5.json.gz │ │ ├── replay_v1.22-pre.json.gz │ │ ├── replay_v1.22.0.json.gz │ │ ├── replay_v1.23-pre.json.gz │ │ ├── replay_with_incremental_backfill.json.gz │ │ ├── replay_with_proto_cache.json.gz │ │ └── replay_with_use_last_action.json.gz │ ├── workflow.go │ └── workflow_test.go │ ├── service.go │ ├── worker.go │ └── workerdeployment │ ├── activities.go │ ├── client.go │ ├── fx.go │ ├── replaytester │ ├── generate_history.sh │ ├── replay_test.go │ ├── testdata │ │ ├── replay_deployment-workflow_initial.json.gz │ │ ├── replay_deployment-workflow_maprange.json.gz │ │ └── replay_worker_deployment_wf_1748123053.json.gz │ ├── worker │ │ └── worker.go │ └── workflow.go │ ├── util.go │ ├── util_test.go │ ├── version_activities.go │ ├── version_workflow.go │ ├── version_workflow_test.go │ ├── workflow.go │ └── workflow_test.go ├── temporal ├── cluster_metadata_loader.go ├── cluster_metadata_loader_test.go ├── environment │ ├── env.go │ └── env_test.go ├── fx.go ├── fx_test.go ├── interrupt.go ├── server.go ├── server_impl.go ├── server_option.go ├── server_options.go └── server_test.go ├── temporaltest ├── LICENSE ├── README.md ├── internal │ └── lite_server.go ├── logger.go ├── options.go ├── server.go └── server_test.go ├── tests ├── acquire_shard_test.go ├── activity_api_batch_unpause_test.go ├── activity_api_pause_test.go ├── activity_api_reset_test.go ├── activity_api_rules_test.go ├── activity_api_update_test.go ├── activity_test.go ├── add_tasks_test.go ├── admin_test.go ├── advanced_visibility_test.go ├── archival_test.go ├── callbacks_test.go ├── cancel_workflow_test.go ├── child_workflow_test.go ├── client_data_converter_test.go ├── client_misc_test.go ├── continue_as_new_test.go ├── cron_test.go ├── describe_task_queue_old_test.go ├── describe_task_queue_test.go ├── describe_test.go ├── dlq_test.go ├── eager_workflow_start_test.go ├── gethistory_test.go ├── http_api_test.go ├── links_test.go ├── max_buffered_event_test.go ├── namespace_delete_test.go ├── namespace_interceptor_test.go ├── ndc │ ├── cluster_config.go │ ├── ndc_test.go │ ├── replication_migration_back_test.go │ ├── replication_task_batching_test.go │ ├── replication_test.go │ ├── test_data.go │ └── testevents │ │ └── migration_back_forth.json ├── nexus_api_test.go ├── nexus_endpoint_test.go ├── nexus_test_base.go ├── nexus_workflow_test.go ├── poller_scaling_test.go ├── priority_fairness_test.go ├── purge_dlq_tasks_api_test.go ├── query_workflow_test.go ├── relay_task_test.go ├── reset_workflow_test.go ├── schedule_test.go ├── signal_workflow_test.go ├── sizelimit_test.go ├── stickytq_test.go ├── task_queue_test.go ├── testcore │ ├── constants.go │ ├── context.go │ ├── dynamic_config_overrides.go │ ├── flag.go │ ├── functional_test_base.go │ ├── functional_test_base_test.go │ ├── onebox.go │ ├── taskpoller.go │ ├── test_cluster.go │ ├── test_data_converter.go │ └── utils.go ├── testutils │ ├── certificate.go │ ├── io.go │ ├── source_root.go │ ├── source_root_test.go │ └── tls.go ├── tls_test.go ├── transient_task_test.go ├── update_workflow_sdk_test.go ├── update_workflow_suite_base.go ├── update_workflow_test.go ├── user_metadata_test.go ├── user_timers_test.go ├── versioning_3_test.go ├── versioning_test.go ├── worker_deployment_test.go ├── worker_deployment_version_test.go ├── workflow_buffered_events_test.go ├── workflow_delete_execution_test.go ├── workflow_failures_test.go ├── workflow_memo_test.go ├── workflow_reset_test.go ├── workflow_reset_with_child_test.go ├── workflow_task_test.go ├── workflow_test.go ├── workflow_timer_test.go ├── workflow_visibility_test.go └── xdc │ ├── activity_api_test.go │ ├── base.go │ ├── failover_test.go │ ├── history_replication_dlq_test.go │ ├── history_replication_signals_and_updates_test.go │ ├── nexus_request_forwarding_test.go │ ├── nexus_state_replication_test.go │ ├── stream_based_replication_test.go │ ├── user_data_replication_test.go │ └── visibility_test.go └── tools ├── cassandra ├── README.md ├── cqlclient.go ├── cqlclient_tests.go ├── handler.go ├── handler_test.go ├── main.go ├── setup_task_tests.go ├── update_task_tests.go └── version_tests.go ├── common └── schema │ ├── handler.go │ ├── handler_test.go │ ├── mock_db.go │ ├── setuptask.go │ ├── test │ ├── dbtest.go │ ├── setuptest.go │ └── updatetest.go │ ├── types.go │ ├── updatetask.go │ ├── updatetask_test.go │ ├── version.go │ └── version_test.go ├── sql ├── README.md ├── clitest │ ├── conn_tests.go │ ├── handler_tests.go │ ├── setup_task_tests.go │ ├── update_task_tests.go │ └── version_tests.go ├── conn.go ├── handler.go └── main.go ├── tdbg ├── app.go ├── app_test.go ├── commands.go ├── commands_test.go ├── decode_commands.go ├── defs.go ├── dlq_job_service.go ├── dlq_service.go ├── dlq_service_test.go ├── dlq_v1_service.go ├── dlq_v2_service.go ├── factory.go ├── factory_test.go ├── flags.go ├── prompter.go ├── prompter_test.go ├── task_encoder.go ├── task_encoder_test.go ├── task_queue_commands.go ├── task_queue_commands_test.go ├── tdbg_commands.go ├── tdbgtest │ ├── app.go │ ├── output_parsing.go │ └── output_parsing_test.go ├── testdata │ ├── 4096b-rsa-example-cert.pem │ └── cert.pem ├── util.go └── util_test.go ├── testrunner ├── junit.go ├── junit_test.go ├── log.go ├── log_test.go ├── testdata │ ├── junit-attempt-1.xml │ ├── junit-attempt-2.xml │ ├── junit-timeout-output.xml │ ├── timeout-input.log │ └── timeout-output.log ├── testrunner.go └── testrunner_test.go └── tests ├── cql_cli_test.go ├── mysql_cli_test.go ├── postgresql_cli_test.go └── test_data.go /.dockerignore: -------------------------------------------------------------------------------- 1 | .coverage 2 | .testoutput 3 | .github 4 | .idea 5 | .vscode 6 | *.md 7 | 8 | develop/docker-compose 9 | 10 | .git 11 | 12 | # exclude binaries from the docker build context 13 | tdbg 14 | temporal-server 15 | temporal-cassandra-tool 16 | temporal-sql-tool 17 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.png filter=lfs diff=lfs merge=lfs -text 2 | *.jpg filter=lfs diff=lfs merge=lfs -text 3 | -------------------------------------------------------------------------------- /.github/.codecov.yml: -------------------------------------------------------------------------------- 1 | # see https://docs.codecov.com/docs/ignoring-paths 2 | ignore: 3 | - "**/*_gen.go" 4 | - "**/*_mock.go" 5 | - "**/*.pb.go" 6 | - "**/pb.mock.go" 7 | - "api" 8 | - "cmd" 9 | - "common/testing" 10 | - "tests" 11 | - "tools" 12 | 13 | # disable pull request comments 14 | comment: false 15 | 16 | # disable GitHub checks 17 | github_checks: false 18 | 19 | # disable GitHub status 20 | coverage: 21 | status: 22 | project: off 23 | patch: off -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Syntax is here: 2 | # https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax 3 | 4 | * @temporalio/server 5 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Report a bug or unexpected behavior with Temporal 4 | title: '' 5 | labels: potential-bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Expected Behavior 11 | 12 | 13 | ## Actual Behavior 14 | 15 | 16 | ## Steps to Reproduce the Problem 17 | 18 | 1. 19 | 1. 20 | 1. 21 | 22 | ## Specifications 23 | 24 | - Version: 25 | - Platform: 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea or enhancement for Temporal 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## What changed? 2 | _Describe what has changed in this PR._ 3 | 4 | ## Why? 5 | _Tell your future self why have you made these changes._ 6 | 7 | ## How did you test it? 8 | - [ ] built 9 | - [ ] run locally and tested manually 10 | - [ ] covered by existing tests 11 | - [ ] added new unit test(s) 12 | - [ ] added new functional test(s) 13 | 14 | ## Potential risks 15 | _Any change is risky. Identify all risks you are aware of. If none, remove this section._ 16 | -------------------------------------------------------------------------------- /.github/actionlint-matcher.json: -------------------------------------------------------------------------------- 1 | { 2 | "problemMatcher": [ 3 | { 4 | "owner": "actionlint", 5 | "pattern": [ 6 | { 7 | "regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*: (?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)* \\[(.+?)\\]$", 8 | "file": 1, 9 | "line": 2, 10 | "column": 3, 11 | "message": 4, 12 | "code": 5 13 | } 14 | ] 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /.github/workflows/goreleaser.yml: -------------------------------------------------------------------------------- 1 | name: goreleaser 2 | 3 | on: 4 | release: 5 | types: 6 | - released 7 | 8 | permissions: 9 | contents: write 10 | 11 | jobs: 12 | goreleaser: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v4 17 | with: 18 | fetch-depth: 0 19 | 20 | - name: Set up Go 21 | uses: actions/setup-go@v5 22 | with: 23 | go-version-file: 'go.mod' 24 | check-latest: true 25 | 26 | - name: Run GoReleaser 27 | uses: goreleaser/goreleaser-action@v5 28 | with: 29 | version: latest 30 | args: release --clean 31 | env: 32 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 33 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | name: Stale Pull Requests 2 | 3 | on: 4 | schedule: 5 | - cron: '0 0 * * *' 6 | 7 | permissions: 8 | pull-requests: write 9 | 10 | jobs: 11 | stale_prs: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: label stale pull requests 15 | uses: actions/stale@v9 16 | with: 17 | days-before-close: -1 # ie disabled 18 | days-before-stale: 120 19 | days-before-issue-stale: -1 # ie disabled 20 | stale-pr-label: stale 21 | stale-pr-message: 'This PR was marked as stale. Please update or close it.' 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .tmp/ 2 | .bin/ 3 | .stamp/ 4 | 5 | .idea/ 6 | .vscode/settings.json 7 | .vscode 8 | *.code-workspace 9 | .DS_Store 10 | .coverage 11 | .testoutput 12 | 13 | *.out 14 | *.test 15 | *.xml 16 | *.swp 17 | /*.iml 18 | *.cov 19 | *.html 20 | /test.log 21 | 22 | # Executables produced by temporal repo 23 | /temporal-* 24 | /tctl* 25 | /tdbg 26 | 27 | # proto image 28 | /proto/image.bin 29 | # api+google proto dependencies 30 | /proto/api.binpb 31 | 32 | # Goreleaser 33 | /dist 34 | 35 | # direnv 36 | .envrc 37 | 38 | # Git SPR: https://github.com/ejoffe/spr 39 | .spr.yml 40 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "develop/docker-compose/grafana/provisioning/temporalio-dashboards"] 2 | path = develop/docker-compose/grafana/provisioning/temporalio-dashboards 3 | url = https://github.com/temporalio/dashboards 4 | -------------------------------------------------------------------------------- /api/adminservicemock/v1/service.pb.mock.go: -------------------------------------------------------------------------------- 1 | // Code generated by MockGen. DO NOT EDIT. 2 | // Source: api/adminservice/v1/service.pb.go 3 | // 4 | // Generated by this command: 5 | // 6 | // mockgen -package adminservicemock -source api/adminservice/v1/service.pb.go -destination api.new/temporal/server/api/adminservicemock/v1/service.pb.mock.go 7 | // 8 | 9 | // Package adminservicemock is a generated GoMock package. 10 | package adminservicemock 11 | -------------------------------------------------------------------------------- /api/enums/v1/workflow_task_type.go-helpers.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go-helpers. DO NOT EDIT. 2 | package enums 3 | 4 | import ( 5 | "fmt" 6 | ) 7 | 8 | var ( 9 | WorkflowTaskType_shorthandValue = map[string]int32{ 10 | "Unspecified": 0, 11 | "Normal": 1, 12 | "Transient": 2, 13 | "Speculative": 3, 14 | } 15 | ) 16 | 17 | // WorkflowTaskTypeFromString parses a WorkflowTaskType value from either the protojson 18 | // canonical SCREAMING_CASE enum or the traditional temporal PascalCase enum to WorkflowTaskType 19 | func WorkflowTaskTypeFromString(s string) (WorkflowTaskType, error) { 20 | if v, ok := WorkflowTaskType_value[s]; ok { 21 | return WorkflowTaskType(v), nil 22 | } else if v, ok := WorkflowTaskType_shorthandValue[s]; ok { 23 | return WorkflowTaskType(v), nil 24 | } 25 | return WorkflowTaskType(0), fmt.Errorf("%s is not a valid WorkflowTaskType", s) 26 | } 27 | -------------------------------------------------------------------------------- /api/historyservicemock/v1/service.pb.mock.go: -------------------------------------------------------------------------------- 1 | // Code generated by MockGen. DO NOT EDIT. 2 | // Source: api/historyservice/v1/service.pb.go 3 | // 4 | // Generated by this command: 5 | // 6 | // mockgen -package historyservicemock -source api/historyservice/v1/service.pb.go -destination api.new/temporal/server/api/historyservicemock/v1/service.pb.mock.go 7 | // 8 | 9 | // Package historyservicemock is a generated GoMock package. 10 | package historyservicemock 11 | -------------------------------------------------------------------------------- /api/matchingservicemock/v1/service.pb.mock.go: -------------------------------------------------------------------------------- 1 | // Code generated by MockGen. DO NOT EDIT. 2 | // Source: api/matchingservice/v1/service.pb.go 3 | // 4 | // Generated by this command: 5 | // 6 | // mockgen -package matchingservicemock -source api/matchingservice/v1/service.pb.go -destination api.new/temporal/server/api/matchingservicemock/v1/service.pb.mock.go 7 | // 8 | 9 | // Package matchingservicemock is a generated GoMock package. 10 | package matchingservicemock 11 | -------------------------------------------------------------------------------- /api/testservicemock/v1/service.pb.mock.go: -------------------------------------------------------------------------------- 1 | // Code generated by MockGen. DO NOT EDIT. 2 | // Source: api/testservice/v1/service.pb.go 3 | // 4 | // Generated by this command: 5 | // 6 | // mockgen -package testservicemock -source api/testservice/v1/service.pb.go -destination api.new/temporal/server/api/testservicemock/v1/service.pb.mock.go 7 | // 8 | 9 | // Package testservicemock is a generated GoMock package. 10 | package testservicemock 11 | -------------------------------------------------------------------------------- /chasm/component_field_option.go: -------------------------------------------------------------------------------- 1 | package chasm 2 | 3 | type ( 4 | componentFieldOptions struct { 5 | detached bool 6 | } 7 | 8 | ComponentFieldOption func(*componentFieldOptions) 9 | ) 10 | 11 | func ComponentFieldDetached() ComponentFieldOption { 12 | return func(o *componentFieldOptions) { 13 | o.detached = true 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /chasm/field_type.go: -------------------------------------------------------------------------------- 1 | package chasm 2 | 3 | type fieldType int 4 | 5 | const ( 6 | fieldTypeUnspecified fieldType = iota 7 | fieldTypeComponent 8 | fieldTypePointer 9 | fieldTypeData 10 | ) 11 | -------------------------------------------------------------------------------- /chasm/library.go: -------------------------------------------------------------------------------- 1 | //go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination library_mock.go 2 | 3 | package chasm 4 | 5 | type ( 6 | Library interface { 7 | Name() string 8 | Components() []*RegistrableComponent 9 | Tasks() []*RegistrableTask 10 | // Service() 11 | 12 | mustEmbedUnimplementedLibrary() 13 | } 14 | 15 | UnimplementedLibrary struct{} 16 | 17 | namer interface { 18 | Name() string 19 | } 20 | ) 21 | 22 | func (UnimplementedLibrary) Components() []*RegistrableComponent { 23 | return nil 24 | } 25 | 26 | func (UnimplementedLibrary) Tasks() []*RegistrableTask { 27 | return nil 28 | } 29 | 30 | func (UnimplementedLibrary) mustEmbedUnimplementedLibrary() {} 31 | 32 | func fullyQualifiedName(libName, name string) string { 33 | return libName + "." + name 34 | } 35 | -------------------------------------------------------------------------------- /chasm/map.go: -------------------------------------------------------------------------------- 1 | package chasm 2 | 3 | // mapKeyTypes must match actual Map key type definition. 4 | const mapKeyTypes = "string | int | int8 | int32 | int64 | uint | uint8 | uint32 | uint64 | bool" 5 | 6 | type Map[K string | int | int8 | int32 | int64 | uint | uint8 | uint32 | uint64 | bool, T any] map[K]Field[T] 7 | -------------------------------------------------------------------------------- /chasm/path_encoder.go: -------------------------------------------------------------------------------- 1 | package chasm 2 | 3 | import "strings" 4 | 5 | var _ NodePathEncoder = (*defaultPathEncoder)(nil) 6 | 7 | var DefaultPathEncoder NodePathEncoder = &defaultPathEncoder{} 8 | 9 | type defaultPathEncoder struct{} 10 | 11 | // TODO: Have a real implementation for DefaultPathEncoder 12 | // that handles special characters in the path and support 13 | // getting all immedidate children of a collection node. 14 | 15 | func (e *defaultPathEncoder) Encode( 16 | _ *Node, 17 | path []string, 18 | ) (string, error) { 19 | return strings.Join(path, "/"), nil 20 | } 21 | 22 | func (e *defaultPathEncoder) Decode( 23 | encodedPath string, 24 | ) ([]string, error) { 25 | if encodedPath == "" { 26 | return []string{}, nil 27 | } 28 | return strings.Split(encodedPath, "/"), nil 29 | } 30 | -------------------------------------------------------------------------------- /chasm/task.go: -------------------------------------------------------------------------------- 1 | //go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination task_mock.go 2 | 3 | package chasm 4 | 5 | import ( 6 | "context" 7 | "time" 8 | ) 9 | 10 | type ( 11 | TaskAttributes struct { 12 | ScheduledTime time.Time 13 | Destination string 14 | } 15 | 16 | SideEffectTaskExecutor[C any, T any] interface { 17 | Execute(context.Context, ComponentRef, T) error 18 | } 19 | 20 | PureTaskExecutor[C any, T any] interface { 21 | Execute(Context, C, T) error 22 | } 23 | 24 | TaskValidator[C any, T any] interface { 25 | Validate(Context, C, T) (bool, error) 26 | } 27 | ) 28 | 29 | var TaskScheduledTimeImmediate = time.Time{} 30 | -------------------------------------------------------------------------------- /chasm/test_task_test.go: -------------------------------------------------------------------------------- 1 | // TODO: move this to chasm_test package 2 | package chasm 3 | 4 | import ( 5 | commonpb "go.temporal.io/api/common/v1" 6 | ) 7 | 8 | type ( 9 | TestSideEffectTask = commonpb.Payload 10 | 11 | TestOutboundSideEffectTask struct{} 12 | 13 | TestPureTask struct { 14 | Payload *commonpb.Payload 15 | } 16 | ) 17 | -------------------------------------------------------------------------------- /client/frontend/retryable_client.go: -------------------------------------------------------------------------------- 1 | package frontend 2 | 3 | import ( 4 | "go.temporal.io/api/workflowservice/v1" 5 | "go.temporal.io/server/common/backoff" 6 | ) 7 | 8 | var _ workflowservice.WorkflowServiceClient = (*retryableClient)(nil) 9 | 10 | type retryableClient struct { 11 | client workflowservice.WorkflowServiceClient 12 | policy backoff.RetryPolicy 13 | isRetryable backoff.IsRetryable 14 | } 15 | 16 | // NewRetryableClient creates a new instance of workflowservice.WorkflowServiceClient with retry policy 17 | func NewRetryableClient(client workflowservice.WorkflowServiceClient, policy backoff.RetryPolicy, isRetryable backoff.IsRetryable) workflowservice.WorkflowServiceClient { 18 | return &retryableClient{ 19 | client: client, 20 | policy: policy, 21 | isRetryable: isRetryable, 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /client/matching/retryable_client.go: -------------------------------------------------------------------------------- 1 | package matching 2 | 3 | import ( 4 | "go.temporal.io/server/api/matchingservice/v1" 5 | "go.temporal.io/server/common/backoff" 6 | ) 7 | 8 | var _ matchingservice.MatchingServiceClient = (*retryableClient)(nil) 9 | 10 | type retryableClient struct { 11 | client matchingservice.MatchingServiceClient 12 | policy backoff.RetryPolicy 13 | isRetryable backoff.IsRetryable 14 | } 15 | 16 | // NewRetryableClient creates a new instance of matchingservice.MatchingServiceClient with retry policy 17 | func NewRetryableClient(client matchingservice.MatchingServiceClient, policy backoff.RetryPolicy, isRetryable backoff.IsRetryable) matchingservice.MatchingServiceClient { 18 | return &retryableClient{ 19 | client: client, 20 | policy: policy, 21 | isRetryable: isRetryable, 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /cmd/tools/cassandra/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "os" 5 | 6 | "go.temporal.io/server/tools/cassandra" 7 | ) 8 | 9 | func main() { 10 | if err := cassandra.RunTool(os.Args); err != nil { 11 | os.Exit(1) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /cmd/tools/getproto/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | # Run getproto (go) in a loop until it successfully resolves all imports 6 | while :; do 7 | out=$(go run ./cmd/tools/getproto "$@") 8 | ret=$? 9 | if [ "$out" != "" ]; then 10 | exit $ret 11 | fi 12 | done 13 | -------------------------------------------------------------------------------- /cmd/tools/sql/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "os" 5 | 6 | _ "go.temporal.io/server/common/persistence/sql/sqlplugin/mysql" // needed to load mysql plugin 7 | _ "go.temporal.io/server/common/persistence/sql/sqlplugin/postgresql" // needed to load postgresql plugin 8 | _ "go.temporal.io/server/common/persistence/sql/sqlplugin/sqlite" // needed to load sqlite plugin 9 | "go.temporal.io/server/tools/sql" 10 | ) 11 | 12 | func main() { 13 | if err := sql.RunTool(os.Args); err != nil { 14 | os.Exit(1) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /cmd/tools/tdbg/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "os" 5 | 6 | "go.temporal.io/server/tools/tdbg" 7 | ) 8 | 9 | func main() { 10 | app := tdbg.NewCliApp() 11 | if err := app.Run(os.Args); err != nil { 12 | os.Exit(1) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /cmd/tools/test-runner/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "go.temporal.io/server/tools/testrunner" 5 | ) 6 | 7 | func main() { 8 | testrunner.Main() 9 | } 10 | -------------------------------------------------------------------------------- /common/aggregate/bench_test.go: -------------------------------------------------------------------------------- 1 | package aggregate 2 | 3 | import ( 4 | "math/rand" 5 | "testing" 6 | "time" 7 | ) 8 | 9 | // BenchmarkArrayMovingWindowAvg 10 | // BenchmarkArrayMovingWindowAvg-10 17021074 66.27 ns/op 11 | 12 | const ( 13 | testWindowSize = 10 * time.Millisecond 14 | testBufferSize = 200 15 | ) 16 | 17 | func BenchmarkArrayMovingWindowAvg(b *testing.B) { 18 | avg := NewMovingWindowAvgImpl(testWindowSize, testBufferSize) 19 | for i := 0; i < b.N; i++ { 20 | avg.Record(rand.Int63()) 21 | if i%10 == 0 { 22 | avg.Average() 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /common/aggregate/noop_moving_window_average.go: -------------------------------------------------------------------------------- 1 | package aggregate 2 | 3 | var NoopMovingWindowAverage MovingWindowAverage = newNoopMovingWindowAverage() 4 | 5 | type ( 6 | noopMovingWindowAverage struct{} 7 | ) 8 | 9 | func newNoopMovingWindowAverage() *noopMovingWindowAverage { return &noopMovingWindowAverage{} } 10 | 11 | func (a *noopMovingWindowAverage) Record(_ int64) {} 12 | 13 | func (a *noopMovingWindowAverage) Average() float64 { return 0 } 14 | -------------------------------------------------------------------------------- /common/archiver/s3store/mocks/generate.go: -------------------------------------------------------------------------------- 1 | //go:generate mockgen -package "$GOPACKAGE" -destination s3api.go github.com/aws/aws-sdk-go/service/s3/s3iface S3API 2 | 3 | package mocks 4 | -------------------------------------------------------------------------------- /common/archiver/s3store/util_test.go: -------------------------------------------------------------------------------- 1 | package s3store 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestConstructVisibilitySearchPrefix(t *testing.T) { 10 | t.Parallel() 11 | assert.Equal( 12 | t, 13 | constructVisibilitySearchPrefix( 14 | "path", 15 | "namespaceID", 16 | ), 17 | "path/namespaceID/visibility", 18 | ) 19 | } 20 | 21 | func TestConstructIndexedVisibilitySearchPrefix(t *testing.T) { 22 | t.Parallel() 23 | assert.Equal( 24 | t, 25 | constructIndexedVisibilitySearchPrefix( 26 | "/path", 27 | "namespaceID", 28 | "primaryIndexKey", 29 | "primaryIndexValue", 30 | "secondaryIndexType", 31 | ), 32 | "path/namespaceID/visibility/primaryIndexKey/primaryIndexValue/secondaryIndexType", 33 | ) 34 | } 35 | -------------------------------------------------------------------------------- /common/auth/testdata/localhost.cnf: -------------------------------------------------------------------------------- 1 | [ req ] 2 | default_bits = 2048 3 | prompt = no 4 | default_md = sha256 5 | distinguished_name = dn 6 | req_extensions = req_ext 7 | 8 | [ dn ] 9 | CN = localhost 10 | 11 | [ req_ext ] 12 | subjectAltName = @alt_names 13 | 14 | [ alt_names ] 15 | DNS.1 = localhost 16 | IP.1 = 127.0.0.1 17 | # Add more SANs if needed 18 | -------------------------------------------------------------------------------- /common/authorization/noop_authorizer.go: -------------------------------------------------------------------------------- 1 | package authorization 2 | 3 | import "context" 4 | 5 | type noopAuthorizer struct{} 6 | 7 | // NewNoopAuthorizer creates a no-op authorizer 8 | func NewNoopAuthorizer() Authorizer { 9 | return &noopAuthorizer{} 10 | } 11 | 12 | func (a *noopAuthorizer) Authorize(_ context.Context, _ *Claims, _ *CallTarget) (Result, error) { 13 | return Result{Decision: DecisionAllow}, nil 14 | } 15 | -------------------------------------------------------------------------------- /common/authorization/token_key_provider.go: -------------------------------------------------------------------------------- 1 | package authorization 2 | 3 | import ( 4 | "context" 5 | "crypto/ecdsa" 6 | "crypto/rsa" 7 | 8 | "github.com/golang-jwt/jwt/v4" 9 | ) 10 | 11 | // @@@SNIPSTART temporal-common-authorization-tokenkeyprovider-interface 12 | // Provides keys for validating JWT tokens 13 | type TokenKeyProvider interface { 14 | EcdsaKey(alg string, kid string) (*ecdsa.PublicKey, error) 15 | HmacKey(alg string, kid string) ([]byte, error) 16 | RsaKey(alg string, kid string) (*rsa.PublicKey, error) 17 | SupportedMethods() []string 18 | Close() 19 | } 20 | 21 | // RawTokenKeyProvider is a TokenKeyProvider that provides keys for validating JWT tokens 22 | type RawTokenKeyProvider interface { 23 | GetKey(ctx context.Context, token *jwt.Token) (interface{}, error) 24 | SupportedMethods() []string 25 | Close() 26 | } 27 | 28 | // @@@SNIPEND 29 | -------------------------------------------------------------------------------- /common/cluster/clustertest/test_metadata.go: -------------------------------------------------------------------------------- 1 | package clustertest 2 | 3 | import ( 4 | "go.temporal.io/server/common/cluster" 5 | "go.temporal.io/server/common/log" 6 | ) 7 | 8 | // NewMetadataForTest returns a new [cluster.Metadata] instance for testing. 9 | func NewMetadataForTest( 10 | config *cluster.Config, 11 | ) cluster.Metadata { 12 | return cluster.NewMetadata( 13 | config.EnableGlobalNamespace, 14 | config.FailoverVersionIncrement, 15 | config.MasterClusterName, 16 | config.CurrentClusterName, 17 | config.ClusterInformation, 18 | nil, 19 | nil, 20 | log.NewNoopLogger(), 21 | ) 22 | } 23 | -------------------------------------------------------------------------------- /common/cluster/fx.go: -------------------------------------------------------------------------------- 1 | package cluster 2 | 3 | import ( 4 | "context" 5 | 6 | "go.temporal.io/server/common/pingable" 7 | "go.uber.org/fx" 8 | ) 9 | 10 | var MetadataLifetimeHooksModule = fx.Options( 11 | fx.Provide(NewMetadataFromConfig), 12 | fx.Invoke(MetadataLifetimeHooks), 13 | fx.Provide(fx.Annotate( 14 | func(p Metadata) pingable.Pingable { return p }, 15 | fx.ResultTags(`group:"deadlockDetectorRoots"`), 16 | )), 17 | ) 18 | 19 | func MetadataLifetimeHooks( 20 | lc fx.Lifecycle, 21 | clusterMetadata Metadata, 22 | ) { 23 | lc.Append( 24 | fx.Hook{ 25 | OnStart: func(context.Context) error { 26 | clusterMetadata.Start() 27 | return nil 28 | }, 29 | OnStop: func(context.Context) error { 30 | clusterMetadata.Stop() 31 | return nil 32 | }, 33 | }, 34 | ) 35 | } 36 | -------------------------------------------------------------------------------- /common/collection/iterator.go: -------------------------------------------------------------------------------- 1 | package collection 2 | 3 | type ( 4 | // Iterator represents the interface for iterator 5 | Iterator[V any] interface { 6 | // HasNext return whether this iterator has next value 7 | HasNext() bool 8 | // Next returns the next item and error 9 | Next() (V, error) 10 | } 11 | ) 12 | -------------------------------------------------------------------------------- /common/collection/oncemap_test.go: -------------------------------------------------------------------------------- 1 | package collection 2 | 3 | import ( 4 | "sync/atomic" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func TestOnceMap(t *testing.T) { 11 | counter := atomic.Int32{} 12 | m := NewOnceMap(func(k string) int { 13 | return int(counter.Add(1)) 14 | }) 15 | 16 | foo1 := m.Get("foo") 17 | foo2 := m.Get("foo") 18 | 19 | require.Equal(t, 1, foo1) 20 | require.Equal(t, 1, foo2) 21 | 22 | bar1 := m.Get("bar") 23 | bar2 := m.Get("bar") 24 | 25 | require.Equal(t, 2, bar1) 26 | require.Equal(t, 2, bar2) 27 | } 28 | -------------------------------------------------------------------------------- /common/collection/util.go: -------------------------------------------------------------------------------- 1 | package collection 2 | 3 | import ( 4 | "encoding/binary" 5 | "encoding/hex" 6 | ) 7 | 8 | // UUIDHashCode is a hash function for hashing string uuid 9 | // if the uuid is malformed, then the hash function always 10 | // returns 0 as the hash value 11 | func UUIDHashCode(input interface{}) uint32 { 12 | key, ok := input.(string) 13 | if !ok { 14 | return 0 15 | } 16 | if len(key) != UUIDStringLength { 17 | return 0 18 | } 19 | // Use the first 4 bytes of the uuid as the hash 20 | b, err := hex.DecodeString(key[:8]) 21 | if err != nil { 22 | return 0 23 | } 24 | return binary.BigEndian.Uint32(b) 25 | } 26 | -------------------------------------------------------------------------------- /common/config/config_test.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestToString(t *testing.T) { 10 | var cfg Config 11 | err := Load("", "../../config", "", &cfg) 12 | assert.NoError(t, err) 13 | assert.NotEmpty(t, cfg.String()) 14 | } 15 | -------------------------------------------------------------------------------- /common/config/fx.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "go.temporal.io/server/common/primitives" 5 | "go.uber.org/fx" 6 | ) 7 | 8 | // ServicePortMap contains the gRPC ports for our services. 9 | type ServicePortMap map[primitives.ServiceName]int 10 | 11 | var Module = fx.Provide( 12 | provideRPCConfig, 13 | provideMembershipConfig, 14 | provideServicePortMap, 15 | ) 16 | 17 | func provideRPCConfig(cfg *Config, svcName primitives.ServiceName) *RPC { 18 | c := cfg.Services[string(svcName)].RPC 19 | 20 | return &c 21 | } 22 | 23 | func provideMembershipConfig(cfg *Config) *Membership { 24 | return &cfg.Global.Membership 25 | } 26 | 27 | func provideServicePortMap(cfg *Config) ServicePortMap { 28 | servicePortMap := make(ServicePortMap) 29 | for sn, sc := range cfg.Services { 30 | servicePortMap[primitives.ServiceName(sn)] = sc.RPC.GRPCPort 31 | } 32 | 33 | return servicePortMap 34 | } 35 | -------------------------------------------------------------------------------- /common/daemon.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | const ( 4 | // used for background threads 5 | 6 | // DaemonStatusInitialized coroutine pool initialized 7 | DaemonStatusInitialized int32 = 0 8 | // DaemonStatusStarted coroutine pool started 9 | DaemonStatusStarted int32 = 1 10 | // DaemonStatusStopped coroutine pool stopped 11 | DaemonStatusStopped int32 = 2 12 | ) 13 | -------------------------------------------------------------------------------- /common/deadlock/fx.go: -------------------------------------------------------------------------------- 1 | package deadlock 2 | 3 | import ( 4 | "go.uber.org/fx" 5 | ) 6 | 7 | var Module = fx.Options( 8 | fx.Provide(NewDeadlockDetector), 9 | fx.Invoke(func(lc fx.Lifecycle, dd *deadlockDetector) { 10 | lc.Append(fx.StartStopHook(dd.Start, dd.Stop)) 11 | }), 12 | ) 13 | -------------------------------------------------------------------------------- /common/debug/debug.go: -------------------------------------------------------------------------------- 1 | //go:build TEMPORAL_DEBUG 2 | 3 | package debug 4 | 5 | const ( 6 | Enabled = true 7 | 8 | TimeoutMultiplier = 100 9 | ) 10 | -------------------------------------------------------------------------------- /common/debug/not_debug.go: -------------------------------------------------------------------------------- 1 | //go:build !TEMPORAL_DEBUG 2 | 3 | package debug 4 | 5 | const ( 6 | Enabled = false 7 | 8 | TimeoutMultiplier = 1 9 | ) 10 | -------------------------------------------------------------------------------- /common/dynamicconfig/fx.go: -------------------------------------------------------------------------------- 1 | package dynamicconfig 2 | 3 | import ( 4 | "go.temporal.io/server/common/log" 5 | "go.temporal.io/server/common/pingable" 6 | "go.uber.org/fx" 7 | ) 8 | 9 | var Module = fx.Options( 10 | fx.Provide(func(client Client, logger log.Logger, lc fx.Lifecycle) *Collection { 11 | col := NewCollection(client, logger) 12 | lc.Append(fx.StartStopHook(col.Start, col.Stop)) 13 | return col 14 | }), 15 | fx.Provide(fx.Annotate( 16 | func(c *Collection) pingable.Pingable { return c }, 17 | fx.ResultTags(`group:"deadlockDetectorRoots"`), 18 | )), 19 | ) 20 | -------------------------------------------------------------------------------- /common/effect/README.md: -------------------------------------------------------------------------------- 1 | See [docs/architecture/effect-package.md](../../docs/architecture/effect-package.md). -------------------------------------------------------------------------------- /common/effect/controller.go: -------------------------------------------------------------------------------- 1 | package effect 2 | 3 | import "context" 4 | 5 | type Controller interface { 6 | OnAfterCommit(func(context.Context)) 7 | OnAfterRollback(func(context.Context)) 8 | } 9 | -------------------------------------------------------------------------------- /common/effect/immediate.go: -------------------------------------------------------------------------------- 1 | package effect 2 | 3 | import "context" 4 | 5 | type immediate struct{ context.Context } 6 | 7 | // Immediate returns an effects.Controller that executes effects immediately upon 8 | // insertion. Useful in contexts where you don't actually want to delay effect 9 | // application and in tests. 10 | func Immediate(ctx context.Context) Controller { return immediate{ctx} } 11 | 12 | func (i immediate) OnAfterCommit(effect func(context.Context)) { effect(i) } 13 | func (i immediate) OnAfterRollback(func(context.Context)) {} 14 | -------------------------------------------------------------------------------- /common/effect/immediate_test.go: -------------------------------------------------------------------------------- 1 | package effect_test 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/require" 8 | "go.temporal.io/server/common/effect" 9 | ) 10 | 11 | func TestImmediate(t *testing.T) { 12 | var i int 13 | immediate := effect.Immediate(context.TODO()) 14 | immediate.OnAfterCommit(func(context.Context) { i = 1 }) 15 | require.Equal(t, i, 1, "commit func should have run") 16 | 17 | immediate.OnAfterRollback(func(context.Context) { i = 2 }) 18 | require.Equal(t, i, 1, "rollback func should not run") 19 | } 20 | -------------------------------------------------------------------------------- /common/future/future.go: -------------------------------------------------------------------------------- 1 | package future 2 | 3 | import "context" 4 | 5 | type ( 6 | Future[T any] interface { 7 | Get(ctx context.Context) (T, error) 8 | Ready() bool 9 | } 10 | ) 11 | -------------------------------------------------------------------------------- /common/future/ready_future_impl.go: -------------------------------------------------------------------------------- 1 | package future 2 | 3 | import ( 4 | "context" 5 | ) 6 | 7 | type ( 8 | ReadyFutureImpl[T any] struct { 9 | value T 10 | err error 11 | } 12 | ) 13 | 14 | func NewReadyFuture[T any]( 15 | value T, 16 | err error, 17 | ) *ReadyFutureImpl[T] { 18 | return &ReadyFutureImpl[T]{ 19 | value: value, 20 | err: err, 21 | } 22 | } 23 | 24 | func (f *ReadyFutureImpl[T]) Get( 25 | _ context.Context, 26 | ) (T, error) { 27 | return f.value, f.err 28 | } 29 | 30 | func (f *ReadyFutureImpl[T]) Ready() bool { 31 | return true 32 | } 33 | -------------------------------------------------------------------------------- /common/goro/package.go: -------------------------------------------------------------------------------- 1 | // Package goro provides utilities for spawning and subsequently managing the 2 | // liftime(s) of one or more goroutines. This package relies heavily on the 3 | // context package to provide consistent cancellation semantics for long-lived 4 | // goroutines. The goal of this package is to provide a unified way to cancel 5 | // and wait on running goroutines as is often seen in "service" or "daemon" 6 | // types with Start()/Stop() lifecycle functions and to unify the multiplicity 7 | // of approaches that have been adopted over time. 8 | // 9 | // Note: If you're looking for a short-lived (e.g. request-scoped) group of 10 | // transient goroutines, you probably want `errgroup.Group` from 11 | // https://golang.org/x/sync/errgroup. 12 | package goro 13 | -------------------------------------------------------------------------------- /common/locks/condition_variable.go: -------------------------------------------------------------------------------- 1 | package locks 2 | 3 | type ( 4 | // ConditionVariable is the interface for condition variable 5 | ConditionVariable interface { 6 | // Signal wakes one goroutine waiting on this condition variable, if there is any. 7 | Signal() 8 | // Broadcast wakes all goroutines waiting on this condition variable. 9 | Broadcast() 10 | // Wait atomically unlocks user provided lock and suspends execution of the calling goroutine. 11 | // After later resuming execution, Wait locks c.L before returning. 12 | // Wait can be awoken by Broadcast, Signal or user provided interrupt channel. 13 | Wait(interrupt <-chan struct{}) 14 | } 15 | ) 16 | -------------------------------------------------------------------------------- /common/locks/lock.go: -------------------------------------------------------------------------------- 1 | package locks 2 | 3 | type ( 4 | // Locker is the interface for lock 5 | Locker interface { 6 | // Lock locks 7 | Lock() 8 | // Unlock unlocks 9 | Unlock() 10 | } 11 | ) 12 | -------------------------------------------------------------------------------- /common/locks/priority_semaphore.go: -------------------------------------------------------------------------------- 1 | package locks 2 | 3 | import "context" 4 | 5 | type ( 6 | PrioritySemaphore interface { 7 | Acquire(ctx context.Context, priority Priority, n int) error 8 | TryAcquire(n int) bool 9 | Release(n int) 10 | } 11 | ) 12 | -------------------------------------------------------------------------------- /common/log/noop_logger.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "go.temporal.io/server/common/log/tag" 5 | ) 6 | 7 | type ( 8 | noopLogger struct{} 9 | ) 10 | 11 | // NewNoopLogger return a noopLogger 12 | func NewNoopLogger() *noopLogger { 13 | return &noopLogger{} 14 | } 15 | 16 | func (n *noopLogger) Debug(string, ...tag.Tag) {} 17 | func (n *noopLogger) Info(string, ...tag.Tag) {} 18 | func (n *noopLogger) Warn(string, ...tag.Tag) {} 19 | func (n *noopLogger) Error(string, ...tag.Tag) {} 20 | func (n *noopLogger) DPanic(string, ...tag.Tag) {} 21 | func (n *noopLogger) Panic(string, ...tag.Tag) {} 22 | func (n *noopLogger) Fatal(string, ...tag.Tag) {} 23 | func (n *noopLogger) With(...tag.Tag) Logger { 24 | return n 25 | } 26 | -------------------------------------------------------------------------------- /common/log/panic_test.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/assert" 8 | ) 9 | 10 | func TestCapturePanic(t *testing.T) { 11 | fooErr := testCapture("foo") 12 | assert.Error(t, fooErr) 13 | assert.Equal(t, "panic: foo", fooErr.Error()) 14 | 15 | barErr := testCapture(fmt.Errorf("error: %v", "bar")) 16 | assert.Error(t, barErr) 17 | assert.Equal(t, "error: bar", barErr.Error()) 18 | } 19 | 20 | func testCapture(panicObj interface{}) (retErr error) { 21 | defer CapturePanic(NewNoopLogger(), &retErr) 22 | 23 | testPanic(panicObj) 24 | return nil 25 | } 26 | 27 | func testPanic(panicObj interface{}) { 28 | panic(panicObj) 29 | } 30 | -------------------------------------------------------------------------------- /common/log/tag/interface.go: -------------------------------------------------------------------------------- 1 | package tag 2 | 3 | type ( 4 | // Implement Tag interface to supply custom tags to Logger interface implementation. 5 | Tag interface { 6 | Key() string 7 | Value() interface{} 8 | } 9 | ) 10 | -------------------------------------------------------------------------------- /common/log/tag/tags_test.go: -------------------------------------------------------------------------------- 1 | package tag 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "testing" 7 | 8 | "github.com/stretchr/testify/assert" 9 | "go.temporal.io/api/serviceerror" 10 | ) 11 | 12 | func TestErrorType(t *testing.T) { 13 | testData := []struct { 14 | err error 15 | expectedResult string 16 | }{ 17 | {serviceerror.NewInvalidArgument(""), "serviceerror.InvalidArgument"}, 18 | {errors.New("test"), "errors.errorString"}, 19 | {fmt.Errorf("test"), "errors.errorString"}, 20 | } 21 | 22 | for id, data := range testData { 23 | assert.Equal(t, data.expectedResult, ServiceErrorType(data.err).Value().(string), "Unexpected error type in index %d", id) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /common/membership/hostinfo_provider.go: -------------------------------------------------------------------------------- 1 | package membership 2 | 3 | type ( 4 | hostInfoProvider struct { 5 | hostInfo HostInfo 6 | } 7 | ) 8 | 9 | func NewHostInfoProvider(hostInfo HostInfo) *hostInfoProvider { 10 | return &hostInfoProvider{ 11 | hostInfo: hostInfo, 12 | } 13 | } 14 | 15 | func (hip *hostInfoProvider) HostInfo() HostInfo { 16 | return hip.hostInfo 17 | } 18 | -------------------------------------------------------------------------------- /common/membership/ringpop/fx.go: -------------------------------------------------------------------------------- 1 | package ringpop 2 | 3 | import ( 4 | "go.temporal.io/server/common/membership" 5 | "go.uber.org/fx" 6 | ) 7 | 8 | // MembershipModule provides membership objects given the types in factoryParams. 9 | var MembershipModule = fx.Provide( 10 | provideFactory, 11 | provideMembership, 12 | provideHostInfoProvider, 13 | ) 14 | 15 | func provideFactory(lc fx.Lifecycle, params factoryParams) (*factory, error) { 16 | f, err := newFactory(params) 17 | if err != nil { 18 | return nil, err 19 | } 20 | lc.Append(fx.StopHook(f.closeTChannel)) 21 | return f, nil 22 | } 23 | 24 | func provideMembership(lc fx.Lifecycle, f *factory) membership.Monitor { 25 | m := f.getMonitor() 26 | lc.Append(fx.StopHook(m.Stop)) 27 | return m 28 | } 29 | 30 | func provideHostInfoProvider(lc fx.Lifecycle, f *factory) (membership.HostInfoProvider, error) { 31 | return f.getHostInfoProvider() 32 | } 33 | -------------------------------------------------------------------------------- /common/metrics/consts.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | type MetricUnit string 4 | 5 | // MetricUnit supported values 6 | // Values are pulled from https://pkg.go.dev/golang.org/x/exp/event#Unit 7 | const ( 8 | Dimensionless = "1" 9 | Milliseconds = "ms" 10 | Bytes = "By" 11 | Seconds = "s" 12 | ) 13 | -------------------------------------------------------------------------------- /common/metrics/defs_base.go: -------------------------------------------------------------------------------- 1 | //go:build !TEMPORAL_DEBUG 2 | 3 | package metrics 4 | 5 | // metricDefinition contains the definition for a metric 6 | type metricDefinition struct { 7 | name string 8 | description string 9 | unit MetricUnit 10 | } 11 | 12 | func newMetricDefinition(name string, opts ...Option) metricDefinition { 13 | d := metricDefinition{ 14 | name: name, 15 | description: "", 16 | unit: "", 17 | } 18 | for _, opt := range opts { 19 | opt.apply(&d) 20 | } 21 | return d 22 | } 23 | 24 | func (md metricDefinition) Name() string { 25 | return md.name 26 | } 27 | 28 | func (md metricDefinition) Unit() MetricUnit { 29 | return md.unit 30 | } 31 | -------------------------------------------------------------------------------- /common/metrics/fx.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | import ( 4 | "context" 5 | 6 | "go.uber.org/fx" 7 | ) 8 | 9 | var RuntimeMetricsReporterModule = fx.Options( 10 | RuntimeMetricsReporterLifetimeHooksModule, 11 | ) 12 | var RuntimeMetricsReporterLifetimeHooksModule = fx.Options( 13 | fx.Invoke(RuntimeMetricsReporterLifetimeHooks), 14 | ) 15 | 16 | func RuntimeMetricsReporterLifetimeHooks( 17 | lc fx.Lifecycle, 18 | reporter *RuntimeMetricsReporter, 19 | ) { 20 | lc.Append( 21 | fx.Hook{ 22 | OnStart: func(context.Context) error { 23 | reporter.Start() 24 | return nil 25 | }, 26 | OnStop: func(context.Context) error { 27 | reporter.Stop() 28 | return nil 29 | }, 30 | }, 31 | ) 32 | } 33 | -------------------------------------------------------------------------------- /common/metrics/option.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | // Option is used to configure a metric definition. Note that options are currently only supported when using the 4 | // Prometheus reporter with the OpenTelemetry framework. 5 | type Option interface { 6 | apply(m *metricDefinition) 7 | } 8 | 9 | // WithDescription sets the description, or "help text", of a metric. See [ServiceRequests] for an example. 10 | type WithDescription string 11 | 12 | func (h WithDescription) apply(m *metricDefinition) { 13 | m.description = string(h) 14 | } 15 | 16 | // WithUnit sets the unit of a metric. See NewBytesHistogramDef for an example. 17 | type WithUnit MetricUnit 18 | 19 | func (h WithUnit) apply(m *metricDefinition) { 20 | m.unit = MetricUnit(h) 21 | } 22 | -------------------------------------------------------------------------------- /common/namespace/const.go: -------------------------------------------------------------------------------- 1 | package namespace 2 | 3 | import "time" 4 | 5 | const ( 6 | // MinRetentionGlobal is a hard limit for the minimun retention duration for global 7 | // namespaces (to allow time for replication). 8 | MinRetentionGlobal = 1 * 24 * time.Hour 9 | 10 | // MinRetentionLocal is a hard limit for the minimun retention duration for local 11 | // namespaces. Allow short values but disallow zero to avoid confusion with 12 | // interpreting zero as infinite. 13 | MinRetentionLocal = 1 * time.Hour 14 | ) 15 | -------------------------------------------------------------------------------- /common/namespace/nsmanager/errors.go: -------------------------------------------------------------------------------- 1 | package nsmanager 2 | 3 | import ( 4 | "go.temporal.io/api/serviceerror" 5 | ) 6 | 7 | var ( 8 | errActiveClusterNotInClusters = serviceerror.NewInvalidArgument("Active cluster is not contained in all clusters.") 9 | errInvalidArchivalConfig = serviceerror.NewInvalidArgument("Invalid to enable archival without specifying a uri.") 10 | ) 11 | -------------------------------------------------------------------------------- /common/namespace/nsregistry/fx.go: -------------------------------------------------------------------------------- 1 | package nsregistry 2 | 3 | import ( 4 | "go.temporal.io/server/common/namespace" 5 | "go.uber.org/fx" 6 | ) 7 | 8 | var RegistryLifetimeHooksModule = fx.Options( 9 | fx.Invoke(RegistryLifetimeHooks), 10 | ) 11 | 12 | func RegistryLifetimeHooks( 13 | lc fx.Lifecycle, 14 | registry namespace.Registry, 15 | ) { 16 | lc.Append(fx.StartStopHook(registry.Start, registry.Stop)) 17 | } 18 | -------------------------------------------------------------------------------- /common/nexus/routes_test.go: -------------------------------------------------------------------------------- 1 | package nexus_test 2 | 3 | import ( 4 | "fmt" 5 | 6 | "go.temporal.io/server/common/nexus" 7 | ) 8 | 9 | func ExampleRouteDispatchNexusTaskByNamespaceAndTaskQueue() { 10 | path := nexus.RouteDispatchNexusTaskByNamespaceAndTaskQueue. 11 | Path(nexus.NamespaceAndTaskQueue{ 12 | Namespace: "TEST-NAMESPACE", 13 | TaskQueue: "TEST-TASK-QUEUE", 14 | }) 15 | fmt.Println(path) 16 | // Output: namespaces/TEST-NAMESPACE/task-queues/TEST-TASK-QUEUE/nexus-services 17 | } 18 | 19 | func ExampleRouteDispatchNexusTaskByEndpoint() { 20 | path := nexus.RouteDispatchNexusTaskByEndpoint. 21 | Path("TEST-ENDPOINT") 22 | fmt.Println(path) 23 | // Output: nexus/endpoints/TEST-ENDPOINT/services 24 | } 25 | -------------------------------------------------------------------------------- /common/nexus/util.go: -------------------------------------------------------------------------------- 1 | package nexus 2 | 3 | import ( 4 | "strconv" 5 | "time" 6 | ) 7 | 8 | // FormatDuration converts a duration into a string representation in millisecond resolution. 9 | // TODO: replace this with the version exported from the Nexus SDK 10 | func FormatDuration(d time.Duration) string { 11 | return strconv.FormatInt(d.Milliseconds(), 10) + "ms" 12 | } 13 | -------------------------------------------------------------------------------- /common/persistence/client/abstract_data_store_factory.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "go.temporal.io/server/common/config" 5 | "go.temporal.io/server/common/log" 6 | "go.temporal.io/server/common/metrics" 7 | "go.temporal.io/server/common/persistence" 8 | "go.temporal.io/server/common/resolver" 9 | ) 10 | 11 | type ( 12 | 13 | // AbstractDataStoreFactory creates a DataStoreFactory, can be used to implement custom datastore support outside 14 | // of the Temporal core. 15 | AbstractDataStoreFactory interface { 16 | NewFactory( 17 | cfg config.CustomDatastoreConfig, 18 | r resolver.ServiceResolver, 19 | clusterName string, 20 | logger log.Logger, 21 | metricsHandler metrics.Handler, 22 | ) persistence.DataStoreFactory 23 | } 24 | ) 25 | -------------------------------------------------------------------------------- /common/persistence/cluster_metadata.go: -------------------------------------------------------------------------------- 1 | package persistence 2 | 3 | // GetOrUseDefaultActiveCluster return the current cluster name or use the input if valid 4 | func GetOrUseDefaultActiveCluster(currentClusterName string, activeClusterName string) string { 5 | if len(activeClusterName) == 0 { 6 | return currentClusterName 7 | } 8 | return activeClusterName 9 | } 10 | 11 | // GetOrUseDefaultClusters return the current cluster or use the input if valid 12 | func GetOrUseDefaultClusters(currentClusterName string, clusters []string) []string { 13 | if len(clusters) == 0 { 14 | return []string{currentClusterName} 15 | } 16 | return clusters 17 | } 18 | -------------------------------------------------------------------------------- /common/persistence/data_blob.go: -------------------------------------------------------------------------------- 1 | package persistence 2 | 3 | import ( 4 | commonpb "go.temporal.io/api/common/v1" 5 | enumspb "go.temporal.io/api/enums/v1" 6 | ) 7 | 8 | // NewDataBlob returns a new DataBlob 9 | // TODO: return an UnknowEncodingType error with the actual type string when encodingTypeStr is invalid 10 | func NewDataBlob(data []byte, encodingTypeStr string) *commonpb.DataBlob { 11 | if len(data) == 0 { 12 | return nil 13 | } 14 | 15 | encodingType, err := enumspb.EncodingTypeFromString(encodingTypeStr) 16 | if err != nil { 17 | // encodingTypeStr not valid, an error will be returned on deserialization 18 | encodingType = enumspb.ENCODING_TYPE_UNSPECIFIED 19 | } 20 | 21 | return &commonpb.DataBlob{ 22 | Data: data, 23 | EncodingType: encodingType, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /common/persistence/error_type.go: -------------------------------------------------------------------------------- 1 | package persistence 2 | 3 | import "go.temporal.io/api/serviceerror" 4 | 5 | func OperationPossiblySucceeded(err error) bool { 6 | switch err.(type) { 7 | case *CurrentWorkflowConditionFailedError, 8 | *WorkflowConditionFailedError, 9 | *ConditionFailedError, 10 | *ShardOwnershipLostError, 11 | *InvalidPersistenceRequestError, 12 | *TransactionSizeLimitError, 13 | *AppendHistoryTimeoutError, // this means task operations is not started 14 | *serviceerror.ResourceExhausted, 15 | *serviceerror.NotFound, 16 | *serviceerror.NamespaceNotFound: 17 | // Persistence failure that means that write was definitely not committed. 18 | return false 19 | default: 20 | return true 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /common/persistence/faultinjection/fault_generator.go: -------------------------------------------------------------------------------- 1 | package faultinjection 2 | 3 | type ( 4 | faultGenerator interface { 5 | generate(methodName string) *fault 6 | } 7 | ) 8 | -------------------------------------------------------------------------------- /common/persistence/noop_health_signal_aggregator.go: -------------------------------------------------------------------------------- 1 | package persistence 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | var NoopHealthSignalAggregator HealthSignalAggregator = newNoopSignalAggregator() 8 | 9 | type ( 10 | noopSignalAggregator struct{} 11 | ) 12 | 13 | func newNoopSignalAggregator() *noopSignalAggregator { return &noopSignalAggregator{} } 14 | 15 | func (a *noopSignalAggregator) Start() {} 16 | 17 | func (a *noopSignalAggregator) Stop() {} 18 | 19 | func (a *noopSignalAggregator) Record(_ int32, _ string, _ time.Duration, _ error) {} 20 | 21 | func (a *noopSignalAggregator) AverageLatency() float64 { 22 | return 0 23 | } 24 | 25 | func (*noopSignalAggregator) ErrorRatio() float64 { 26 | return 0 27 | } 28 | -------------------------------------------------------------------------------- /common/persistence/nosql/nosqlplugin/cassandra/gocql/iter.go: -------------------------------------------------------------------------------- 1 | package gocql 2 | 3 | import ( 4 | "github.com/gocql/gocql" 5 | ) 6 | 7 | type iter struct { 8 | session *session 9 | gocqlIter *gocql.Iter 10 | } 11 | 12 | func newIter(session *session, gocqlIter *gocql.Iter) *iter { 13 | return &iter{ 14 | session: session, 15 | gocqlIter: gocqlIter, 16 | } 17 | } 18 | 19 | func (it *iter) Scan(dest ...interface{}) bool { 20 | return it.gocqlIter.Scan(dest...) 21 | } 22 | 23 | func (it *iter) MapScan(m map[string]interface{}) bool { 24 | return it.gocqlIter.MapScan(m) 25 | } 26 | 27 | func (it *iter) PageState() []byte { 28 | return it.gocqlIter.PageState() 29 | } 30 | 31 | func (it *iter) Close() (retError error) { 32 | defer func() { it.session.handleError(retError) }() 33 | 34 | return it.gocqlIter.Close() 35 | } 36 | -------------------------------------------------------------------------------- /common/persistence/nosql/nosqlplugin/cassandra/gocql/uuid.go: -------------------------------------------------------------------------------- 1 | package gocql 2 | 3 | import ( 4 | "github.com/gocql/gocql" 5 | ) 6 | 7 | func UUIDToString( 8 | item interface{}, 9 | ) string { 10 | return item.(gocql.UUID).String() 11 | } 12 | 13 | func UUIDsToStringSlice( 14 | item interface{}, 15 | ) []string { 16 | uuids := item.([]gocql.UUID) 17 | results := make([]string, len(uuids)) 18 | for i, uuid := range uuids { 19 | results[i] = uuid.String() 20 | } 21 | return results 22 | } 23 | -------------------------------------------------------------------------------- /common/persistence/schema/version_reader.go: -------------------------------------------------------------------------------- 1 | package schema 2 | 3 | type ( 4 | VersionReader interface { 5 | // ReadSchemaVersion returns the current schema version for the keyspace 6 | ReadSchemaVersion(dbName string) (string, error) 7 | } 8 | ) 9 | -------------------------------------------------------------------------------- /common/persistence/sql/sqlplugin/postgresql/driver/pgx.go: -------------------------------------------------------------------------------- 1 | package driver 2 | 3 | import ( 4 | "github.com/jackc/pgx/v5/pgconn" 5 | _ "github.com/jackc/pgx/v5/stdlib" // register pgx driver for sqlx 6 | "github.com/jmoiron/sqlx" 7 | ) 8 | 9 | type PGXDriver struct{} 10 | 11 | func (p *PGXDriver) CreateConnection(dsn string) (*sqlx.DB, error) { 12 | return sqlx.Connect("pgx", dsn) 13 | } 14 | 15 | func (p *PGXDriver) IsDupEntryError(err error) bool { 16 | pgxErr, ok := err.(*pgconn.PgError) 17 | return ok && pgxErr.Code == dupEntryCode 18 | } 19 | 20 | func (p *PGXDriver) IsDupDatabaseError(err error) bool { 21 | pqErr, ok := err.(*pgconn.PgError) 22 | return ok && pqErr.Code == dupDatabaseCode 23 | } 24 | 25 | func (p *PGXDriver) IsConnNeedsRefreshError(err error) bool { 26 | pqErr, ok := err.(*pgconn.PgError) 27 | if !ok { 28 | return false 29 | } 30 | return isConnNeedsRefreshError(pqErr.Code, pqErr.Message) 31 | } 32 | -------------------------------------------------------------------------------- /common/persistence/sql/sqlplugin/postgresql/driver/pq.go: -------------------------------------------------------------------------------- 1 | package driver 2 | 3 | import ( 4 | "github.com/jmoiron/sqlx" 5 | "github.com/lib/pq" 6 | ) 7 | 8 | type PQDriver struct{} 9 | 10 | func (p *PQDriver) CreateConnection(dsn string) (*sqlx.DB, error) { 11 | return sqlx.Connect("postgres", dsn) 12 | } 13 | 14 | func (p *PQDriver) IsDupEntryError(err error) bool { 15 | pqErr, ok := err.(*pq.Error) 16 | return ok && pqErr.Code == dupEntryCode 17 | } 18 | 19 | func (p *PQDriver) IsDupDatabaseError(err error) bool { 20 | pqErr, ok := err.(*pq.Error) 21 | return ok && pqErr.Code == dupDatabaseCode 22 | } 23 | 24 | func (p *PQDriver) IsConnNeedsRefreshError(err error) bool { 25 | pqErr, ok := err.(*pq.Error) 26 | if !ok { 27 | return false 28 | } 29 | return isConnNeedsRefreshError(string(pqErr.Code), pqErr.Message) 30 | } 31 | -------------------------------------------------------------------------------- /common/persistence/sql/sqlplugin/tests/context.go: -------------------------------------------------------------------------------- 1 | package tests 2 | 3 | import ( 4 | "context" 5 | "time" 6 | 7 | "go.temporal.io/server/common/debug" 8 | ) 9 | 10 | const ( 11 | executionTimeout = 2 * time.Second * debug.TimeoutMultiplier 12 | visibilityTimeout = 4 * time.Second * debug.TimeoutMultiplier 13 | ) 14 | 15 | func newExecutionContext() context.Context { 16 | ctx := context.Background() 17 | ctx, _ = context.WithTimeout(ctx, executionTimeout) 18 | return ctx 19 | } 20 | 21 | func newVisibilityContext() context.Context { 22 | ctx := context.Background() 23 | ctx, _ = context.WithTimeout(ctx, visibilityTimeout) 24 | return ctx 25 | } 26 | -------------------------------------------------------------------------------- /common/persistence/sql/sqlplugin/util.go: -------------------------------------------------------------------------------- 1 | package sqlplugin 2 | 3 | import "strings" 4 | 5 | func appendPrefix(prefix string, fields []string) []string { 6 | out := make([]string, len(fields)) 7 | for i, field := range fields { 8 | out[i] = prefix + field 9 | } 10 | return out 11 | } 12 | 13 | func BuildNamedPlaceholder(fields ...string) string { 14 | return strings.Join(appendPrefix(":", fields), ", ") 15 | } 16 | -------------------------------------------------------------------------------- /common/persistence/sql/sqlplugin/visibility_test.go: -------------------------------------------------------------------------------- 1 | package sqlplugin 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/require" 7 | ) 8 | 9 | func TestDbFields_LastField_Version(t *testing.T) { 10 | lastField := DbFields[len(DbFields)-1] 11 | require.Equal(t, VersionColumnName, lastField) 12 | } 13 | -------------------------------------------------------------------------------- /common/persistence/visibility/store/elasticsearch/client/bulk_service.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "context" 5 | ) 6 | 7 | type ( 8 | BulkService interface { 9 | Do(ctx context.Context) error 10 | NumberOfActions() int 11 | Add(request *BulkableRequest) 12 | } 13 | ) 14 | -------------------------------------------------------------------------------- /common/persistence/visibility/store/elasticsearch/client/logger.go: -------------------------------------------------------------------------------- 1 | package client 2 | 3 | import ( 4 | "fmt" 5 | 6 | "go.temporal.io/server/common/log" 7 | ) 8 | 9 | type ( 10 | errorLogger struct { 11 | log.Logger 12 | } 13 | 14 | infoLogger struct { 15 | log.Logger 16 | } 17 | ) 18 | 19 | func newErrorLogger(logger log.Logger) *errorLogger { 20 | return &errorLogger{logger} 21 | } 22 | 23 | func (l *errorLogger) Printf(format string, v ...interface{}) { 24 | l.Error(fmt.Sprintf(format, v...)) 25 | } 26 | 27 | func newInfoLogger(logger log.Logger) *infoLogger { 28 | return &infoLogger{logger} 29 | } 30 | 31 | func (l *infoLogger) Printf(format string, v ...interface{}) { 32 | l.Info(fmt.Sprintf(format, v...)) 33 | } 34 | -------------------------------------------------------------------------------- /common/persistence/visibility/store/elasticsearch/visibility_store_validation_test.go: -------------------------------------------------------------------------------- 1 | package elasticsearch 2 | 3 | import ( 4 | "math" 5 | "testing" 6 | "time" 7 | 8 | "github.com/stretchr/testify/assert" 9 | "go.temporal.io/api/serviceerror" 10 | ) 11 | 12 | func TestValidationDatetime(t *testing.T) { 13 | store := VisibilityStore{} 14 | 15 | // valid datetime 16 | _, err := store.ValidateCustomSearchAttributes(map[string]any{ 17 | "CustomDatetimeField": time.Now(), 18 | }) 19 | assert.NoError(t, err) 20 | 21 | // invalid out of range datetime 22 | _, err = store.ValidateCustomSearchAttributes(map[string]any{ 23 | "CustomDatetimeField": time.Unix(0, math.MaxInt64).Add(time.Hour), 24 | }) 25 | assert.Error(t, err) 26 | assert.IsType(t, &serviceerror.InvalidArgument{}, err) 27 | assert.Contains(t, err.Error(), "Visibility store validation errors") 28 | } 29 | -------------------------------------------------------------------------------- /common/persistence/visibility/store/errors.go: -------------------------------------------------------------------------------- 1 | package store 2 | 3 | import ( 4 | "strings" 5 | 6 | "go.temporal.io/api/serviceerror" 7 | ) 8 | 9 | func NewVisibilityStoreInvalidValuesError(errs []error) error { 10 | var sb strings.Builder 11 | sb.WriteString("Visibility store validation errors: ") 12 | for i, err := range errs { 13 | if i > 0 { 14 | sb.WriteString(", ") 15 | } 16 | sb.WriteString("[") 17 | sb.WriteString(err.Error()) 18 | sb.WriteString("]") 19 | } 20 | 21 | return serviceerror.NewInvalidArgument(sb.String()) 22 | } 23 | -------------------------------------------------------------------------------- /common/persistence/visibility/store/query/interceptors.go: -------------------------------------------------------------------------------- 1 | package query 2 | 3 | type ( 4 | FieldNameInterceptor interface { 5 | Name(name string, usage FieldNameUsage) (string, error) 6 | } 7 | FieldValuesInterceptor interface { 8 | Values(name string, fieldName string, values ...interface{}) ([]interface{}, error) 9 | } 10 | 11 | NopFieldNameInterceptor struct{} 12 | 13 | NopFieldValuesInterceptor struct{} 14 | 15 | FieldNameUsage int 16 | ) 17 | 18 | const ( 19 | FieldNameFilter FieldNameUsage = iota 20 | FieldNameSorter 21 | FieldNameGroupBy 22 | ) 23 | 24 | func (n *NopFieldNameInterceptor) Name(name string, _ FieldNameUsage) (string, error) { 25 | return name, nil 26 | } 27 | 28 | func (n *NopFieldValuesInterceptor) Values(_ string, _ string, values ...interface{}) ([]interface{}, error) { 29 | return values, nil 30 | } 31 | -------------------------------------------------------------------------------- /common/persistence/visibility/store/query/util.go: -------------------------------------------------------------------------------- 1 | package query 2 | 3 | import ( 4 | "strconv" 5 | "time" 6 | 7 | "go.temporal.io/server/common/primitives/timestamp" 8 | ) 9 | 10 | func ParseExecutionDurationStr(durationStr string) (time.Duration, error) { 11 | if durationNanos, err := strconv.ParseInt(durationStr, 10, 64); err == nil { 12 | return time.Duration(durationNanos), nil 13 | } 14 | 15 | // To support durations passed as golang durations such as "300ms", "-1.5h" or "2h45m". 16 | // Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". 17 | // Custom timestamp.ParseDuration also supports "d" as additional unit for days. 18 | if duration, err := timestamp.ParseDuration(durationStr); err == nil { 19 | return duration, nil 20 | } 21 | 22 | // To support "hh:mm:ss" durations. 23 | return timestamp.ParseHHMMSSDuration(durationStr) 24 | } 25 | -------------------------------------------------------------------------------- /common/persistence/visibility/store/sql/pagination_token.go: -------------------------------------------------------------------------------- 1 | package sql 2 | 3 | import ( 4 | "encoding/json" 5 | "time" 6 | ) 7 | 8 | type ( 9 | pageToken struct { 10 | CloseTime time.Time 11 | StartTime time.Time 12 | RunID string 13 | } 14 | ) 15 | 16 | func deserializePageToken(data []byte) (*pageToken, error) { 17 | if len(data) == 0 { 18 | return nil, nil 19 | } 20 | var token *pageToken 21 | err := json.Unmarshal(data, &token) 22 | return token, err 23 | } 24 | 25 | func serializePageToken(token *pageToken) ([]byte, error) { 26 | data, err := json.Marshal(token) 27 | return data, err 28 | } 29 | -------------------------------------------------------------------------------- /common/pprof/fx.go: -------------------------------------------------------------------------------- 1 | package pprof 2 | 3 | import ( 4 | "context" 5 | 6 | "go.uber.org/fx" 7 | ) 8 | 9 | // Requires *config.PProf available in container. 10 | var Module = fx.Options( 11 | fx.Provide(NewInitializer), 12 | fx.Invoke(LifetimeHooks), 13 | ) 14 | 15 | func LifetimeHooks( 16 | lc fx.Lifecycle, 17 | pprof *PProfInitializerImpl, 18 | ) { 19 | lc.Append( 20 | fx.Hook{ 21 | OnStart: func(context.Context) error { 22 | return pprof.Start() 23 | }, 24 | // todo: refactor pprof to gracefully shutdown http server 25 | // OnStop: func(ctx context.Context) error { 26 | // pprof.Stop() 27 | // return nil 28 | // }, 29 | }, 30 | ) 31 | } 32 | -------------------------------------------------------------------------------- /common/predicates/empty.go: -------------------------------------------------------------------------------- 1 | package predicates 2 | 3 | import ( 4 | enumsspb "go.temporal.io/server/api/enums/v1" 5 | persistencespb "go.temporal.io/server/api/persistence/v1" 6 | ) 7 | 8 | type ( 9 | EmptyImpl[T any] struct{} 10 | ) 11 | 12 | var EmptyPredicateProtoSize = (&persistencespb.Predicate{ 13 | PredicateType: enumsspb.PREDICATE_TYPE_EMPTY, 14 | Attributes: &persistencespb.Predicate_EmptyPredicateAttributes{ 15 | EmptyPredicateAttributes: &persistencespb.EmptyPredicateAttributes{}, 16 | }, 17 | }).Size() 18 | 19 | func Empty[T any]() Predicate[T] { 20 | return &EmptyImpl[T]{} 21 | } 22 | 23 | func (n *EmptyImpl[T]) Test(t T) bool { 24 | return false 25 | } 26 | 27 | func (n *EmptyImpl[T]) Equals( 28 | predicate Predicate[T], 29 | ) bool { 30 | _, ok := predicate.(*EmptyImpl[T]) 31 | return ok 32 | } 33 | 34 | func (*EmptyImpl[T]) Size() int { 35 | return EmptyPredicateProtoSize 36 | } 37 | -------------------------------------------------------------------------------- /common/predicates/not.go: -------------------------------------------------------------------------------- 1 | package predicates 2 | 3 | type ( 4 | NotImpl[T any] struct { 5 | Predicate Predicate[T] 6 | } 7 | ) 8 | 9 | func Not[T any]( 10 | predicate Predicate[T], 11 | ) Predicate[T] { 12 | switch p := predicate.(type) { 13 | case *NotImpl[T]: 14 | return p.Predicate 15 | case *UniversalImpl[T]: 16 | return Empty[T]() 17 | case *EmptyImpl[T]: 18 | return Universal[T]() 19 | default: 20 | return &NotImpl[T]{ 21 | Predicate: predicate, 22 | } 23 | } 24 | } 25 | 26 | func (n *NotImpl[T]) Test(t T) bool { 27 | return !n.Predicate.Test(t) 28 | } 29 | 30 | func (n *NotImpl[T]) Equals( 31 | predicate Predicate[T], 32 | ) bool { 33 | notPredicate, ok := predicate.(*NotImpl[T]) 34 | if !ok { 35 | return false 36 | } 37 | return n.Predicate.Equals(notPredicate.Predicate) 38 | } 39 | 40 | func (n *NotImpl[T]) Size() int { 41 | return n.Predicate.Size() + EmptyPredicateProtoSize 42 | } 43 | -------------------------------------------------------------------------------- /common/predicates/predicates.go: -------------------------------------------------------------------------------- 1 | package predicates 2 | 3 | type ( 4 | Predicate[T any] interface { 5 | // Test checks if the given entity statisfy the predicate or not 6 | Test(T) bool 7 | 8 | // Equals recursively checks if the given Predicate has the same 9 | // structure and value as the caller Predicate 10 | // NOTE: the result will contain false negatives, meaning even if 11 | // two predicates are mathmatically equivalent, Equals may still 12 | // return false. 13 | Equals(Predicate[T]) bool 14 | 15 | // Size gets the estimated size in bytes of this predicate. 16 | // Implementation may keep this estimate rough and mostly account for elements that may take up considerable 17 | // space such as strings and slices. 18 | Size() int 19 | } 20 | ) 21 | -------------------------------------------------------------------------------- /common/predicates/predicates_test.go: -------------------------------------------------------------------------------- 1 | package predicates 2 | 3 | import ( 4 | "maps" 5 | "strconv" 6 | ) 7 | 8 | var _ Predicate[int] = (*testPredicate)(nil) 9 | 10 | type ( 11 | testPredicate struct { 12 | nums map[int]struct{} 13 | } 14 | ) 15 | 16 | func newTestPredicate(nums ...int) *testPredicate { 17 | numsMap := make(map[int]struct{}, len(nums)) 18 | for _, x := range nums { 19 | numsMap[x] = struct{}{} 20 | } 21 | return &testPredicate{ 22 | nums: numsMap, 23 | } 24 | } 25 | 26 | func (p *testPredicate) Test(x int) bool { 27 | _, ok := p.nums[x] 28 | return ok 29 | } 30 | 31 | func (p *testPredicate) Equals(predicate Predicate[int]) bool { 32 | testPrediate, ok := predicate.(*testPredicate) 33 | if !ok { 34 | return false 35 | } 36 | 37 | return maps.Equal(p.nums, testPrediate.nums) 38 | } 39 | 40 | func (p *testPredicate) Size() int { 41 | return strconv.IntSize / 8 * len(p.nums) 42 | } 43 | -------------------------------------------------------------------------------- /common/predicates/universal.go: -------------------------------------------------------------------------------- 1 | package predicates 2 | 3 | type ( 4 | UniversalImpl[T any] struct{} 5 | ) 6 | 7 | func Universal[T any]() Predicate[T] { 8 | return &UniversalImpl[T]{} 9 | } 10 | 11 | func (a *UniversalImpl[T]) Test(t T) bool { 12 | return true 13 | } 14 | 15 | func (a *UniversalImpl[T]) Equals( 16 | predicate Predicate[T], 17 | ) bool { 18 | _, ok := predicate.(*UniversalImpl[T]) 19 | return ok 20 | } 21 | 22 | func (*UniversalImpl[T]) Size() int { 23 | return EmptyPredicateProtoSize 24 | } 25 | -------------------------------------------------------------------------------- /common/primitives/README.MD: -------------------------------------------------------------------------------- 1 | The primitives package is meant to contain definitions and constants 2 | that are widely used throughout this repository. 3 | 4 | There should serve as the root package in that there should be no imports of any other Temporal package. -------------------------------------------------------------------------------- /common/primitives/constants.go: -------------------------------------------------------------------------------- 1 | package primitives 2 | 3 | import ( 4 | "time" 5 | 6 | "go.temporal.io/server/common/debug" 7 | ) 8 | 9 | const ( 10 | // DefaultTransactionSizeLimit is the largest allowed transaction size to persistence 11 | DefaultTransactionSizeLimit = 4 * 1024 * 1024 12 | ) 13 | 14 | const ( 15 | // DefaultWorkflowTaskTimeout sets the Default Workflow Task timeout for a Workflow 16 | DefaultWorkflowTaskTimeout = 10 * time.Second * debug.TimeoutMultiplier 17 | ) 18 | 19 | const ( 20 | // GetHistoryMaxPageSize is the max page size for get history 21 | GetHistoryMaxPageSize = 256 22 | // ReadDLQMessagesPageSize is the max page size for read DLQ messages 23 | ReadDLQMessagesPageSize = 1000 24 | ) 25 | 26 | const ( 27 | DefaultHistoryMaxAutoResetPoints = 20 28 | ) 29 | 30 | const ( 31 | ScheduleWorkflowIDPrefix = "temporal-sys-scheduler:" 32 | ) 33 | -------------------------------------------------------------------------------- /common/primitives/namespaces.go: -------------------------------------------------------------------------------- 1 | package primitives 2 | 3 | import "time" 4 | 5 | // Namespace-related constants. 6 | // This was flagged by salus as potentially hardcoded credentials. This is a false positive by the scanner and should be 7 | // disregarded. 8 | // #nosec 9 | const ( 10 | // SystemLocalNamespace is namespace name for temporal system workflows running in local cluster 11 | SystemLocalNamespace = "temporal-system" 12 | // SystemNamespaceID is namespace id for all temporal system workflows 13 | SystemNamespaceID = "32049b68-7872-4094-8e63-d0dd59896a83" 14 | // SystemNamespaceRetention is retention config for all temporal system workflows 15 | SystemNamespaceRetention = time.Hour * 24 * 7 16 | ) 17 | -------------------------------------------------------------------------------- /common/primitives/role.go: -------------------------------------------------------------------------------- 1 | package primitives 2 | 3 | type ServiceName string 4 | 5 | // These constants represent service roles 6 | const ( 7 | AllServices ServiceName = "all" 8 | FrontendService ServiceName = "frontend" 9 | InternalFrontendService ServiceName = "internal-frontend" 10 | HistoryService ServiceName = "history" 11 | MatchingService ServiceName = "matching" 12 | WorkerService ServiceName = "worker" 13 | ServerService ServiceName = "server" 14 | UnitTestService ServiceName = "unittest" 15 | ) 16 | -------------------------------------------------------------------------------- /common/primitives/task_queues.go: -------------------------------------------------------------------------------- 1 | package primitives 2 | 3 | // These are task queue names for internal task queues. 4 | const ( 5 | DefaultWorkerTaskQueue = "default-worker-tq" 6 | PerNSWorkerTaskQueue = "temporal-sys-per-ns-tq" 7 | 8 | MigrationActivityTQ = "temporal-sys-migration-activity-tq" 9 | AddSearchAttributesActivityTQ = "temporal-sys-add-search-attributes-activity-tq" 10 | DeleteNamespaceActivityTQ = "temporal-sys-delete-namespace-activity-tq" 11 | DLQActivityTQ = "temporal-sys-dlq-activity-tq" 12 | ) 13 | -------------------------------------------------------------------------------- /common/priorities/priority_util.go: -------------------------------------------------------------------------------- 1 | package priorities 2 | 3 | import ( 4 | "cmp" 5 | 6 | commonpb "go.temporal.io/api/common/v1" 7 | ) 8 | 9 | func Merge( 10 | base *commonpb.Priority, 11 | override *commonpb.Priority, 12 | ) *commonpb.Priority { 13 | if base == nil || override == nil { 14 | return cmp.Or(override, base) 15 | } 16 | 17 | return &commonpb.Priority{ 18 | PriorityKey: cmp.Or(override.PriorityKey, base.PriorityKey), 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/quotas/bench_test.go: -------------------------------------------------------------------------------- 1 | package quotas 2 | 3 | import ( 4 | "testing" 5 | "time" 6 | ) 7 | 8 | // BenchmarkRateLimiter 9 | // BenchmarkRateLimiter-16 8445120 125 ns/op 10 | // BenchmarkDynamicRateLimiter 11 | // BenchmarkDynamicRateLimiter-16 8629598 132 ns/op 12 | 13 | const ( 14 | testRate = 2000.0 15 | testBurst = 4000 16 | ) 17 | 18 | func BenchmarkRateLimiter(b *testing.B) { 19 | limiter := NewRateLimiter(testRate, testBurst) 20 | for n := 0; n < b.N; n++ { 21 | limiter.Allow() 22 | } 23 | } 24 | 25 | func BenchmarkDynamicRateLimiter(b *testing.B) { 26 | limiter := NewDynamicRateLimiter( 27 | NewRateBurst( 28 | func() float64 { return testRate }, 29 | func() int { return testBurst }, 30 | ), 31 | time.Minute, 32 | ) 33 | for n := 0; n < b.N; n++ { 34 | limiter.Allow() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /common/quotas/calculator/calculator.go: -------------------------------------------------------------------------------- 1 | package calculator 2 | 3 | type ( 4 | Calculator interface { 5 | GetQuota() float64 6 | } 7 | 8 | NamespaceCalculator interface { 9 | GetQuota(namespace string) float64 10 | } 11 | ) 12 | -------------------------------------------------------------------------------- /common/quotas/noop_request_rate_limiter_impl.go: -------------------------------------------------------------------------------- 1 | package quotas 2 | 3 | import ( 4 | "context" 5 | "time" 6 | ) 7 | 8 | type ( 9 | // NoopRequestRateLimiterImpl is a no-op implementation for RequestRateLimiter 10 | NoopRequestRateLimiterImpl struct{} 11 | ) 12 | 13 | var NoopRequestRateLimiter RequestRateLimiter = &NoopRequestRateLimiterImpl{} 14 | 15 | func (r *NoopRequestRateLimiterImpl) Allow( 16 | _ time.Time, 17 | _ Request, 18 | ) bool { 19 | return true 20 | } 21 | 22 | func (r *NoopRequestRateLimiterImpl) Reserve( 23 | _ time.Time, 24 | _ Request, 25 | ) Reservation { 26 | return NoopReservation 27 | } 28 | 29 | func (r *NoopRequestRateLimiterImpl) Wait( 30 | _ context.Context, 31 | _ Request, 32 | ) error { 33 | return nil 34 | } 35 | -------------------------------------------------------------------------------- /common/quotas/noop_request_rate_limiter_impl_test.go: -------------------------------------------------------------------------------- 1 | package quotas_test 2 | 3 | import ( 4 | "context" 5 | "testing" 6 | "time" 7 | 8 | "github.com/stretchr/testify/assert" 9 | "go.temporal.io/server/common/quotas" 10 | ) 11 | 12 | func TestNoopRequestRateLimiterImpl(t *testing.T) { 13 | t.Parallel() 14 | 15 | testNoopRequestRateLimiterImpl(t, quotas.NoopRequestRateLimiter) 16 | } 17 | 18 | func testNoopRequestRateLimiterImpl(t *testing.T, rl quotas.RequestRateLimiter) { 19 | assert.True(t, rl.Allow(time.Now(), quotas.Request{})) 20 | assert.Equal(t, quotas.NoopReservation, rl.Reserve(time.Now(), quotas.Request{})) 21 | assert.NoError(t, rl.Wait(context.Background(), quotas.Request{})) 22 | } 23 | -------------------------------------------------------------------------------- /common/quotas/quotastest/fake_instance_counter.go: -------------------------------------------------------------------------------- 1 | package quotastest 2 | 3 | // NewFakeMemberCounter returns a new fake quotas.MemberCounter that always returns numInstances. 4 | func NewFakeMemberCounter(numInstances int) memberCounter { 5 | return memberCounter{numInstances: numInstances} 6 | } 7 | 8 | type memberCounter struct { 9 | numInstances int 10 | } 11 | 12 | func (c memberCounter) AvailableMemberCount() int { 13 | return c.numInstances 14 | } 15 | -------------------------------------------------------------------------------- /common/quotas/request.go: -------------------------------------------------------------------------------- 1 | package quotas 2 | 3 | type ( 4 | Request struct { 5 | API string 6 | Token int 7 | Caller string 8 | CallerType string 9 | CallerSegment int32 10 | Initiation string 11 | } 12 | ) 13 | 14 | func NewRequest( 15 | api string, 16 | token int, 17 | caller string, 18 | callerType string, 19 | callerSegment int32, 20 | initiation string, 21 | ) Request { 22 | return Request{ 23 | API: api, 24 | Token: token, 25 | Caller: caller, 26 | CallerType: callerType, 27 | CallerSegment: callerSegment, 28 | Initiation: initiation, 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /common/resolver/noop_resolver.go: -------------------------------------------------------------------------------- 1 | package resolver 2 | 3 | type ( 4 | NoopResolver struct { 5 | } 6 | ) 7 | 8 | func NewNoopResolver() *NoopResolver { 9 | return &NoopResolver{} 10 | } 11 | 12 | func (c *NoopResolver) Resolve(service string) []string { 13 | return []string{service} 14 | } 15 | -------------------------------------------------------------------------------- /common/resolver/service_resolver.go: -------------------------------------------------------------------------------- 1 | //go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination service_resolver_mock.go 2 | 3 | package resolver 4 | 5 | type ( 6 | // ServiceResolver interface can be implemented to support custom name resolving 7 | // for any dependency service. 8 | ServiceResolver interface { 9 | // Resolve implementation should return list of addresses for the service 10 | // (not necessary IP addresses but addresses that service dependency library accepts). 11 | Resolve(service string) []string 12 | } 13 | ) 14 | -------------------------------------------------------------------------------- /common/rpc/encryption/local_store_cert_provider_test.go: -------------------------------------------------------------------------------- 1 | package encryption 2 | 3 | import ( 4 | "errors" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/assert" 8 | ) 9 | 10 | func TestAppendError(t *testing.T) { 11 | assert := assert.New(t) 12 | err1 := errors.New("error1") 13 | err2 := errors.New("error2") 14 | 15 | err := appendError(nil, err1) 16 | assert.Equal(err1, err) 17 | assert.Equal("error1", err.Error()) 18 | err = appendError(err1, nil) 19 | assert.Equal(err1, err) 20 | assert.Equal("error1", err.Error()) 21 | 22 | err = appendError(err1, err2) 23 | assert.Equal(err2, errors.Unwrap(err)) 24 | assert.Equal("error1, error2", err.Error()) 25 | } 26 | -------------------------------------------------------------------------------- /common/rpc/interceptor/service_error_interceptor.go: -------------------------------------------------------------------------------- 1 | package interceptor 2 | 3 | import ( 4 | "context" 5 | "errors" 6 | 7 | "go.temporal.io/api/serviceerror" 8 | "go.temporal.io/server/common/persistence/serialization" 9 | "google.golang.org/grpc" 10 | ) 11 | 12 | func ServiceErrorInterceptor( 13 | ctx context.Context, 14 | req interface{}, 15 | _ *grpc.UnaryServerInfo, 16 | handler grpc.UnaryHandler, 17 | ) (interface{}, error) { 18 | 19 | resp, err := handler(ctx, req) 20 | 21 | var deserializationError *serialization.DeserializationError 22 | var serializationError *serialization.SerializationError 23 | // convert serialization errors to be captured as serviceerrors across gRPC calls 24 | if errors.As(err, &deserializationError) || errors.As(err, &serializationError) { 25 | err = serviceerror.NewDataLoss(err.Error()) 26 | } 27 | return resp, serviceerror.ToStatus(err).Err() 28 | } 29 | -------------------------------------------------------------------------------- /common/rpc/request_issues_test.go: -------------------------------------------------------------------------------- 1 | package rpc_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | "github.com/stretchr/testify/require" 8 | "go.temporal.io/server/common/rpc" 9 | "google.golang.org/grpc/codes" 10 | "google.golang.org/grpc/status" 11 | ) 12 | 13 | func TestRequestIssues(t *testing.T) { 14 | t.Parallel() 15 | var issues rpc.RequestIssues 16 | err := issues.GetError() 17 | require.NoError(t, err) 18 | issues.Append("issue 1") 19 | issues.Appendf("issue %d", 2) 20 | issues.Append("issue 3") 21 | err = issues.GetError() 22 | require.Error(t, err) 23 | assert.ErrorContains(t, err, "issue 1, issue 2, issue 3") 24 | assert.Equal(t, codes.InvalidArgument, status.Code(err)) 25 | } 26 | -------------------------------------------------------------------------------- /common/sdk/converter.go: -------------------------------------------------------------------------------- 1 | package sdk 2 | 3 | import ( 4 | "go.temporal.io/sdk/converter" 5 | ) 6 | 7 | var ( 8 | // PreferProtoDataConverter is like the default data converter defined in the SDK, except 9 | // that it prefers encoding proto messages with the binary encoding instead of json. 10 | PreferProtoDataConverter = converter.NewCompositeDataConverter( 11 | converter.NewNilPayloadConverter(), 12 | converter.NewByteSlicePayloadConverter(), 13 | converter.NewProtoPayloadConverter(), 14 | converter.NewProtoJSONPayloadConverter(), 15 | converter.NewJSONPayloadConverter(), 16 | ) 17 | ) 18 | -------------------------------------------------------------------------------- /common/searchattribute/defs_test.go: -------------------------------------------------------------------------------- 1 | package searchattribute 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | // This test is to make sure all system search attributes have a corresponding 10 | // column name in SQL DB. 11 | // If this test is failing, make sure that you updated the SQL DB schemas, and 12 | // you mapped the search attribute constant to the column name. 13 | func TestValidateSqlDbSystemNameToColNameMap(t *testing.T) { 14 | s := assert.New(t) 15 | s.Contains(sqlDbSystemNameToColName, NamespaceID) 16 | for key := range system { 17 | s.Contains(sqlDbSystemNameToColName, key) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /common/searchattribute/event.go: -------------------------------------------------------------------------------- 1 | // Generates event helper functions for setting and getting search attributes on history events. 2 | //go:generate go run ../../cmd/tools/gensearchattributehelpers 3 | 4 | package searchattribute 5 | -------------------------------------------------------------------------------- /common/searchattribute/system_provider.go: -------------------------------------------------------------------------------- 1 | package searchattribute 2 | 3 | type ( 4 | SystemProvider struct{} 5 | ) 6 | 7 | func NewSystemProvider() *SystemProvider { 8 | return &SystemProvider{} 9 | } 10 | 11 | func (s *SystemProvider) GetSearchAttributes(_ string, _ bool) (NameTypeMap, error) { 12 | return NameTypeMap{}, nil 13 | } 14 | -------------------------------------------------------------------------------- /common/serviceerror/convert_test.go: -------------------------------------------------------------------------------- 1 | package serviceerror 2 | 3 | import ( 4 | "errors" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/assert" 8 | "go.temporal.io/api/serviceerror" 9 | ) 10 | 11 | func TestFromToStatus(t *testing.T) { 12 | err := &ShardOwnershipLost{ 13 | Message: "mess", 14 | OwnerHost: "owner", 15 | CurrentHost: "current", 16 | } 17 | 18 | st := serviceerror.ToStatus(err) 19 | err1 := FromStatus(st) 20 | var solErr *ShardOwnershipLost 21 | if !errors.As(err1, &solErr) { 22 | assert.Fail(t, "Returned error is not of type *ShardOwnershipLost") 23 | } 24 | assert.Equal(t, err.Message, solErr.Message) 25 | assert.Equal(t, err.OwnerHost, solErr.OwnerHost) 26 | } 27 | -------------------------------------------------------------------------------- /common/serviceerror/service_error_with_dpanic.go: -------------------------------------------------------------------------------- 1 | package serviceerror 2 | 3 | import ( 4 | "go.temporal.io/api/serviceerror" 5 | "go.temporal.io/server/common/log" 6 | ) 7 | 8 | // NewInternalErrorWithDPanic is a wrapper for service error that will panic if it's in dev environment 9 | func NewInternalErrorWithDPanic(logger log.Logger, msg string) error { 10 | logger.DPanic(msg) 11 | return serviceerror.NewInternal(msg) 12 | } 13 | -------------------------------------------------------------------------------- /common/shuffle/shuffle.go: -------------------------------------------------------------------------------- 1 | package shuffle 2 | 3 | import ( 4 | "math/rand" 5 | ) 6 | 7 | func String(str string) string { 8 | return string(Bytes([]byte(str))) 9 | } 10 | 11 | func Bytes(slice []byte) []byte { 12 | result := make([]byte, len(slice)) 13 | copy(result, slice) 14 | 15 | rand.Shuffle(len(result), func(i, j int) { 16 | result[i], result[j] = result[j], result[i] 17 | }) 18 | return result 19 | } 20 | -------------------------------------------------------------------------------- /common/tasks/scheduler.go: -------------------------------------------------------------------------------- 1 | package tasks 2 | 3 | //go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination scheduler_mock.go 4 | type ( 5 | // Scheduler is the generic interface for scheduling & processing tasks 6 | Scheduler[T Task] interface { 7 | Submit(task T) 8 | TrySubmit(task T) bool 9 | Start() 10 | Stop() 11 | } 12 | ) 13 | -------------------------------------------------------------------------------- /common/tasks/sequential_task_queue.go: -------------------------------------------------------------------------------- 1 | package tasks 2 | 3 | type ( 4 | SequentialTaskQueueFactory[T Task] func(task T) SequentialTaskQueue[T] 5 | 6 | SequentialTaskQueue[T Task] interface { 7 | // ID return the ID of the queue, as well as the tasks inside (same) 8 | ID() interface{} 9 | // Add push a task to the task set 10 | Add(T) 11 | // Remove pop a task from the task set 12 | Remove() T 13 | // IsEmpty indicate if the task set is empty 14 | IsEmpty() bool 15 | // Len return the size of the queue 16 | Len() int 17 | } 18 | ) 19 | -------------------------------------------------------------------------------- /common/tasks/sequential_task_queue_test.go: -------------------------------------------------------------------------------- 1 | package tasks 2 | 3 | type testSequentialTaskQueue[T Task] struct { 4 | q chan T 5 | id int 6 | } 7 | 8 | func newTestSequentialTaskQueue[T Task](id, capacity int) SequentialTaskQueue[T] { 9 | return &testSequentialTaskQueue[T]{ 10 | q: make(chan T, capacity), 11 | id: id, 12 | } 13 | } 14 | 15 | func (s *testSequentialTaskQueue[T]) ID() interface{} { 16 | return s.id 17 | } 18 | 19 | func (s *testSequentialTaskQueue[T]) Add(task T) { 20 | s.q <- task 21 | } 22 | 23 | func (s *testSequentialTaskQueue[T]) Remove() T { 24 | select { 25 | case t := <-s.q: 26 | return t 27 | default: 28 | var emptyT T 29 | return emptyT 30 | } 31 | } 32 | 33 | func (s *testSequentialTaskQueue[T]) IsEmpty() bool { 34 | return len(s.q) == 0 35 | } 36 | 37 | func (s *testSequentialTaskQueue[T]) Len() int { 38 | return len(s.q) 39 | } 40 | -------------------------------------------------------------------------------- /common/tasks/state.go: -------------------------------------------------------------------------------- 1 | package tasks 2 | 3 | // State represents the current state of a task 4 | type State int 5 | 6 | const ( 7 | // TaskStatePending is the state for a task when it's waiting to be processed or currently being processed 8 | TaskStatePending State = iota + 1 9 | // TaskStateAborted is the state for a task when its executor shuts down 10 | TaskStateAborted 11 | // TaskStateCancelled is the state for a task when its execution has request to be cancelled 12 | TaskStateCancelled 13 | // TaskStateAcked is the state for a task if it has been successfully completed 14 | TaskStateAcked 15 | // TaskStateNacked is the state for a task if it can not be processed 16 | TaskStateNacked 17 | ) 18 | -------------------------------------------------------------------------------- /common/telemetry/export_test.go: -------------------------------------------------------------------------------- 1 | package telemetry 2 | 3 | type ( 4 | OTLPGRPCSpanExporter = otlpGrpcSpanExporter 5 | OTLPGRPCMetricExporter = otlpGrpcMetricExporter 6 | PrivateExportConfig = exportConfig 7 | ) 8 | -------------------------------------------------------------------------------- /common/telemetry/tags.go: -------------------------------------------------------------------------------- 1 | package telemetry 2 | 3 | const ( 4 | ComponentPersistence = "persistence" 5 | ComponentQueueArchival = "queue.archival" 6 | ComponentQueueMemory = "queue.memory" 7 | ComponentQueueOutbound = "queue.outbound" 8 | ComponentQueueTimer = "queue.timer" 9 | ComponentQueueTransfer = "queue.transfer" 10 | ComponentQueueVisibility = "queue.visibility" 11 | ComponentUpdateRegistry = "update.registry" 12 | 13 | WorkflowIDKey = "temporalWorkflowID" 14 | WorkflowRunIDKey = "temporalRunID" 15 | ) 16 | -------------------------------------------------------------------------------- /common/testing/fakedata/fakedata_test.go: -------------------------------------------------------------------------------- 1 | package fakedata_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | "github.com/stretchr/testify/require" 8 | "go.temporal.io/server/common/testing/fakedata" 9 | ) 10 | 11 | type Failure struct { 12 | Cause *Failure 13 | Message string 14 | } 15 | 16 | func TestCircularReference(t *testing.T) { 17 | var failure Failure 18 | err := fakedata.FakeStruct(&failure) 19 | require.NoError(t, err, "should not fail to generate fake data for struct with circular reference") 20 | assert.NotEmpty(t, failure.Message) 21 | require.NotNil(t, failure.Cause, "should fake data for reference to field of same type") 22 | assert.NotEmpty(t, failure.Cause.Message) 23 | require.Nil(t, failure.Cause.Cause, "should avoid infinite recursion") 24 | } 25 | -------------------------------------------------------------------------------- /common/testing/mockapi/generate.go: -------------------------------------------------------------------------------- 1 | //go:generate mockgen -package workflowservicemock -destination workflowservicemock/v1/service_grpc.pb.mock.go go.temporal.io/api/workflowservice/v1 WorkflowServiceClient 2 | //go:generate mockgen -package operatorservicemock -destination operatorservicemock/v1/service_grpc.pb.mock.go go.temporal.io/api/operatorservice/v1 OperatorServiceClient 3 | 4 | package mockapi 5 | -------------------------------------------------------------------------------- /common/testing/mocksdk/generate.go: -------------------------------------------------------------------------------- 1 | //go:generate ./generate.sh 2 | 3 | package mocksdk 4 | -------------------------------------------------------------------------------- /common/testing/mocksdk/generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # These mocks need to be manually fixed up after generation because gomock 4 | # uses the types in the internal package instead of the public type aliases. 5 | mockgen -package "$GOPACKAGE" go.temporal.io/sdk/client Client | \ 6 | sed -e 's,internal,client,g' | \ 7 | goimports > client_mock.go 8 | 9 | mockgen -package "$GOPACKAGE" go.temporal.io/sdk/worker Worker | \ 10 | sed -e 's,internal.RegisterWorkflowOptions,workflow.RegisterOptions,g' \ 11 | -e 's,internal.RegisterActivityOptions,activity.RegisterOptions,g' \ 12 | -e 's,internal "go.temporal.io/sdk/internal",activity "go.temporal.io/sdk/activity"\n\tworkflow "go.temporal.io/sdk/workflow",' | \ 13 | goimports > worker_mock.go 14 | 15 | mockgen -package "$GOPACKAGE" go.temporal.io/sdk/client WorkflowRun | \ 16 | sed -e 's,internal,client,g' | \ 17 | goimports > workflowrun_mock.go 18 | -------------------------------------------------------------------------------- /common/testing/nettest/listener.go: -------------------------------------------------------------------------------- 1 | package nettest 2 | 3 | import "net" 4 | 5 | // NewListener returns a net.Listener which uses the given Pipe to simulate a network connection. 6 | func NewListener(pipe *Pipe) *PipeListener { 7 | return &PipeListener{ 8 | Pipe: pipe, 9 | done: make(chan struct{}), 10 | } 11 | } 12 | 13 | // PipeListener is a net.Listener which uses a Pipe to simulate a network connection. 14 | type PipeListener struct { 15 | *Pipe 16 | // We cancel calls to Accept using the done channel so that tests don't hang if they're broken. 17 | done chan struct{} 18 | } 19 | 20 | var _ net.Listener = (*PipeListener)(nil) 21 | 22 | func (t *PipeListener) Accept() (net.Conn, error) { 23 | return t.Pipe.Accept(t.done) 24 | } 25 | 26 | func (t *PipeListener) Close() error { 27 | close(t.done) 28 | return nil 29 | } 30 | 31 | func (t *PipeListener) Addr() net.Addr { 32 | return &net.TCPAddr{} 33 | } 34 | -------------------------------------------------------------------------------- /common/testing/nettest/package.go: -------------------------------------------------------------------------------- 1 | // Package nettest provides an in-memory socket, Pipe. It can be used in place of net.Dial and net.Listen for faster and 2 | // more hermetic tests. 3 | package nettest 4 | -------------------------------------------------------------------------------- /common/testing/protoutils/any.go: -------------------------------------------------------------------------------- 1 | package protoutils 2 | 3 | import ( 4 | "reflect" 5 | 6 | "github.com/stretchr/testify/require" 7 | "google.golang.org/protobuf/proto" 8 | "google.golang.org/protobuf/types/known/anypb" 9 | ) 10 | 11 | func UnmarshalAny[T proto.Message](t require.TestingT, a *anypb.Any) T { 12 | if th, ok := t.(interface{ Helper() }); ok { 13 | th.Helper() 14 | } 15 | pb := new(T) 16 | ppb := reflect.ValueOf(pb).Elem() 17 | pbNew := reflect.New(reflect.TypeOf(pb).Elem().Elem()) 18 | ppb.Set(pbNew) 19 | 20 | require.NoError(t, a.UnmarshalTo(*pb)) 21 | return *pb 22 | } 23 | 24 | func MarshalAny(t require.TestingT, pb proto.Message) *anypb.Any { 25 | if th, ok := t.(interface{ Helper() }); ok { 26 | th.Helper() 27 | } 28 | a, err := anypb.New(pb) 29 | require.NoError(t, err) 30 | return a 31 | } 32 | -------------------------------------------------------------------------------- /common/testing/temporalapi/public_methods.go: -------------------------------------------------------------------------------- 1 | package temporalapi 2 | 3 | import ( 4 | "reflect" 5 | "regexp" 6 | ) 7 | 8 | var publicMethodRgx = regexp.MustCompile("^[A-Z]") 9 | 10 | // WalkExportedMethods calls the provided callback on each method declared as public on the 11 | // specified object. 12 | // This prevents the `mustEmbedUnimplementedFooBarBaz` method required by the GRPC v2 13 | // gateway from polluting our tests. 14 | func WalkExportedMethods(obj any, cb func(reflect.Method)) { 15 | v := reflect.ValueOf(obj) 16 | if !v.IsValid() { 17 | return 18 | } 19 | 20 | t := v.Type() 21 | if t.Kind() == reflect.Pointer { 22 | t = t.Elem() 23 | } 24 | for i := 0; i < t.NumMethod(); i++ { 25 | if publicMethodRgx.MatchString(t.Method(i).Name) { 26 | cb(t.Method(i)) 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /common/testing/testhooks/key.go: -------------------------------------------------------------------------------- 1 | package testhooks 2 | 3 | type Key int 4 | 5 | const ( 6 | MatchingDisableSyncMatch Key = iota 7 | MatchingLBForceReadPartition 8 | MatchingLBForceWritePartition 9 | UpdateWithStartInBetweenLockAndStart 10 | TaskQueuesInDeploymentSyncBatchSize 11 | ) 12 | -------------------------------------------------------------------------------- /common/testing/testvars/const.go: -------------------------------------------------------------------------------- 1 | package testvars 2 | 3 | type Global struct { 4 | } 5 | 6 | func newGlobal() Global { 7 | return Global{} 8 | } 9 | 10 | func (c Global) ClusterName() string { 11 | return "active" 12 | } 13 | 14 | func (c Global) RemoteClusterName() string { 15 | return "standby" 16 | } 17 | -------------------------------------------------------------------------------- /common/testing/testvars/hash.go: -------------------------------------------------------------------------------- 1 | package testvars 2 | 3 | import ( 4 | "hash/fnv" 5 | ) 6 | 7 | func hash(s string) uint32 { 8 | h := fnv.New32a() 9 | _, _ = h.Write([]byte(s)) 10 | return h.Sum32() 11 | } 12 | -------------------------------------------------------------------------------- /common/testing/testvars/rand.go: -------------------------------------------------------------------------------- 1 | package testvars 2 | 3 | import ( 4 | "math" 5 | "math/rand" 6 | ) 7 | 8 | func randInt(testHash uint32, hashLen, padLen, randomLen int) int { 9 | testID := int(testHash) % int(math.Pow10(hashLen)) 10 | pad := int(math.Pow10(padLen + randomLen)) 11 | random := rand.Int() % int(math.Pow10(randomLen)) 12 | return testID*pad + random 13 | } 14 | 15 | func randString(n int) string { 16 | const letterBytes = "abcdefghijklmnopqrstuvwxyz" 17 | b := make([]byte, n) 18 | for i := range b { 19 | b[i] = letterBytes[rand.Intn(len(letterBytes))] 20 | } 21 | return string(b) 22 | } 23 | -------------------------------------------------------------------------------- /common/timer/gate.go: -------------------------------------------------------------------------------- 1 | package timer 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | type ( 8 | // Gate interface 9 | Gate interface { 10 | // FireCh return the channel which will be fired when time is up 11 | FireCh() <-chan struct{} 12 | // FireAfter check will the timer get fired after a certain time 13 | FireAfter(now time.Time) bool 14 | // Update the timer gate, return true if update is a success. 15 | // Success means timer is idle or timer is set with a sooner time to fire 16 | Update(nextTime time.Time) bool 17 | // Close shutdown the timer 18 | Close() 19 | } 20 | ) 21 | -------------------------------------------------------------------------------- /common/util/strings.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import "unicode/utf8" 4 | 5 | // TruncateUTF8 truncates s to no more than n _bytes_, and returns a valid utf-8 string as long 6 | // as the input is a valid utf-8 string. 7 | // Note that truncation pays attention to codepoints only! This may truncate in the middle of a 8 | // grapheme cluster. 9 | func TruncateUTF8(s string, n int) string { 10 | if len(s) <= n { 11 | return s 12 | } else if n <= 0 { 13 | return "" 14 | } 15 | for n > 0 && !utf8.RuneStart(s[n]) { 16 | n-- 17 | } 18 | return s[:n] 19 | } 20 | -------------------------------------------------------------------------------- /common/util/strings_test.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestTruncateUTF8(t *testing.T) { 10 | s := "hello \u2603!!!" 11 | assert.Equal(t, 12, len(s)) 12 | assert.Equal(t, "hello \u2603!!!", TruncateUTF8(s, 20)) 13 | assert.Equal(t, "hello \u2603!!!", TruncateUTF8(s, 12)) 14 | assert.Equal(t, "hello \u2603!!", TruncateUTF8(s, 11)) 15 | assert.Equal(t, "hello \u2603!", TruncateUTF8(s, 10)) 16 | assert.Equal(t, "hello \u2603", TruncateUTF8(s, 9)) 17 | assert.Equal(t, "hello ", TruncateUTF8(s, 8)) 18 | assert.Equal(t, "hello ", TruncateUTF8(s, 7)) 19 | assert.Equal(t, "hello ", TruncateUTF8(s, 6)) 20 | assert.Equal(t, "hello", TruncateUTF8(s, 5)) 21 | assert.Equal(t, "", TruncateUTF8(s, 0)) 22 | assert.Equal(t, "", TruncateUTF8(s, -3)) 23 | } 24 | -------------------------------------------------------------------------------- /components/callbacks/metrics.go: -------------------------------------------------------------------------------- 1 | package callbacks 2 | 3 | import "go.temporal.io/server/common/metrics" 4 | 5 | var RequestCounter = metrics.NewCounterDef( 6 | "callback_outbound_requests", 7 | metrics.WithDescription("The number of callback outbound requests made by the history service."), 8 | ) 9 | var RequestLatencyHistogram = metrics.NewTimerDef( 10 | "callback_outbound_latency", 11 | metrics.WithDescription("Latency histogram of outbound callback requests made by the history service."), 12 | ) 13 | -------------------------------------------------------------------------------- /config/development.yaml: -------------------------------------------------------------------------------- 1 | development-sqlite.yaml -------------------------------------------------------------------------------- /config/dynamicconfig/docker.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temporalio/temporal/70a4b914511bf7c77de91fc63581032a49810e18/config/dynamicconfig/docker.yaml -------------------------------------------------------------------------------- /develop/docker-compose/README.md: -------------------------------------------------------------------------------- 1 | # Temporal Server `docker compose` files for server development 2 | 3 | These `docker compose` files run Temporal server development dependencies. Basically, they run everything you need to run 4 | Temporal server besides a server itself which you suppose to run locally on the host in your favorite IDE or as binary. 5 | 6 | You are not supposed to use these files directly. Please use [Makefile](../../Makefile) targets instead. To start dependencies: 7 | 8 | ```bash 9 | make start-dependencies 10 | ``` 11 | 12 | To stop dependencies: 13 | 14 | ```bash 15 | make stop-dependencies 16 | ``` 17 | 18 | See [CONTRIBUTING.md](../../CONTRIBUTING.md) for details. 19 | -------------------------------------------------------------------------------- /develop/docker-compose/docker-compose.cdc.darwin.yml: -------------------------------------------------------------------------------- 1 | # Overrides for CDC for MacOS (Darwin) users. 2 | services: 3 | temporal-ui-standby: 4 | environment: 5 | - TEMPORAL_ADDRESS=host.docker.internal:8233 6 | ports: 7 | - "8081:8081" 8 | networks: 9 | - temporal-dev-network 10 | temporal-ui-other: 11 | environment: 12 | - TEMPORAL_ADDRESS=host.docker.internal:9233 13 | ports: 14 | - "8082:8082" 15 | networks: 16 | - temporal-dev-network 17 | -------------------------------------------------------------------------------- /develop/docker-compose/docker-compose.cdc.linux.yml: -------------------------------------------------------------------------------- 1 | # Overrides for CDC for Linux users. 2 | services: 3 | temporal-ui-standby: 4 | environment: 5 | - TEMPORAL_ADDRESS=localhost:8233 6 | network_mode: host 7 | temporal-ui-other: 8 | environment: 9 | - TEMPORAL_ADDRESS=localhost:9233 10 | network_mode: host 11 | -------------------------------------------------------------------------------- /develop/docker-compose/docker-compose.cdc.yml: -------------------------------------------------------------------------------- 1 | # Adds CDC dependencies to main docker-compose files. 2 | # Include platform specific file also: 3 | # docker-compose -f docker-compose.yml -f docker-compose.linux.yml -f docker-compose.cdc.yml -f docker-compose.cdc.linux.yml up 4 | services: 5 | temporal-ui-standby: 6 | image: temporalio/ui:latest 7 | container_name: temporal-dev-ui-standby 8 | environment: 9 | - TEMPORAL_UI_PORT=8081 10 | temporal-ui-other: 11 | image: temporalio/ui:latest 12 | container_name: temporal-dev-ui-other 13 | environment: 14 | - TEMPORAL_UI_PORT=8082 15 | -------------------------------------------------------------------------------- /develop/docker-compose/docker-compose.darwin.yml: -------------------------------------------------------------------------------- 1 | # Overrides for Mac/Darwin users. 2 | services: 3 | prometheus: 4 | volumes: 5 | - ./prometheus-darwin:/etc/prometheus 6 | ports: 7 | - "9090:9090" 8 | networks: 9 | - temporal-dev-network 10 | grafana: 11 | ports: 12 | - "3000:3000" 13 | networks: 14 | - temporal-dev-network 15 | tempo: 16 | depends_on: 17 | - grafana 18 | ports: 19 | - "3200:3200" # tempo 20 | - "4317:4317" # otlp grpc 21 | - "4318:4318" # otlp http 22 | networks: 23 | - temporal-dev-network 24 | temporal-ui: 25 | environment: 26 | - TEMPORAL_ADDRESS=host.docker.internal:7233 27 | ports: 28 | - "8080:8080" 29 | networks: 30 | - temporal-dev-network 31 | -------------------------------------------------------------------------------- /develop/docker-compose/docker-compose.linux.yml: -------------------------------------------------------------------------------- 1 | # Overrides for Linux users. 2 | services: 3 | prometheus: 4 | network_mode: host 5 | volumes: 6 | - ./prometheus-linux:/etc/prometheus 7 | grafana: 8 | network_mode: host 9 | tempo: 10 | depends_on: 11 | - grafana 12 | network_mode: host 13 | temporal-ui: 14 | environment: 15 | - TEMPORAL_ADDRESS=localhost:7233 16 | network_mode: host 17 | -------------------------------------------------------------------------------- /develop/docker-compose/docker-compose.windows.yml: -------------------------------------------------------------------------------- 1 | # Overrides for Windows users. 2 | services: 3 | prometheus: 4 | volumes: 5 | - ./prometheus-darwin:/etc/prometheus 6 | ports: 7 | - "9090:9090" 8 | networks: 9 | - temporal-dev-network 10 | grafana: 11 | ports: 12 | - "3000:3000" 13 | networks: 14 | - temporal-dev-network 15 | tempo: 16 | depends_on: 17 | - grafana 18 | ports: 19 | - "3200:3200" # tempo 20 | - "4317:4317" # otlp grpc 21 | networks: 22 | - temporal-dev-network 23 | temporal-ui: 24 | environment: 25 | - TEMPORAL_ADDRESS=host.docker.internal:7233 26 | ports: 27 | - "8080:8080" 28 | networks: 29 | - temporal-dev-network 30 | -------------------------------------------------------------------------------- /develop/docker-compose/grafana/provisioning/dashboards/dashboard.yml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | providers: 4 | - name: "Temporal" 5 | orgId: 1 6 | folder: '' 7 | type: file 8 | disableDeletion: false 9 | editable: true 10 | options: 11 | path: /etc/grafana/provisioning/temporalio-dashboards 12 | -------------------------------------------------------------------------------- /develop/docker-compose/grafana/provisioning/datasources/prometheus.yml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | datasources: 3 | - name: Prometheus-Linux 4 | type: prometheus 5 | url: http://localhost:9090 6 | access: proxy 7 | isDefault: true 8 | - name: Prometheus-Darwin 9 | type: prometheus 10 | url: http://prometheus:9090 11 | access: proxy 12 | isDefault: false 13 | - name: Tempo-Linux 14 | type: tempo 15 | access: proxy 16 | url: http://localhost:3200 17 | isDefault: false 18 | - name: Tempo-Darwin 19 | type: tempo 20 | access: proxy 21 | url: http://tempo:3200 22 | isDefault: false -------------------------------------------------------------------------------- /develop/docker-compose/mysql-init/init.sql: -------------------------------------------------------------------------------- 1 | CREATE USER 'temporal'@'%' IDENTIFIED BY 'temporal'; 2 | GRANT ALL PRIVILEGES ON *.* TO 'temporal'@'%'; 3 | FLUSH PRIVILEGES; -------------------------------------------------------------------------------- /develop/docker-compose/prometheus-darwin/prometheus.yml: -------------------------------------------------------------------------------- 1 | # https://dev.to/ablx/minimal-prometheus-setup-with-docker-compose-56mp 2 | global: 3 | scrape_interval: 5s 4 | scrape_timeout: 5s 5 | 6 | scrape_configs: 7 | - job_name: services 8 | metrics_path: /metrics 9 | static_configs: 10 | - targets: 11 | # port should match value from server config listenAddress. 12 | - host.docker.internal:8000 13 | - job_name: tempo 14 | static_configs: 15 | - targets: 16 | - host.docker.internal:3200 -------------------------------------------------------------------------------- /develop/docker-compose/prometheus-linux/prometheus.yml: -------------------------------------------------------------------------------- 1 | # https://dev.to/ablx/minimal-prometheus-setup-with-docker-compose-56mp 2 | global: 3 | scrape_interval: 5s 4 | scrape_timeout: 5s 5 | 6 | scrape_configs: 7 | - job_name: services 8 | metrics_path: /metrics 9 | static_configs: 10 | - targets: 11 | # port should match value from server config listenAddress. 12 | - localhost:8000 13 | - job_name: tempo 14 | static_configs: 15 | - targets: 16 | - localhost:3200 -------------------------------------------------------------------------------- /develop/github/mysql-init/init.sql: -------------------------------------------------------------------------------- 1 | CREATE USER 'temporal'@'%' IDENTIFIED BY 'temporal'; 2 | GRANT ALL PRIVILEGES ON *.* TO 'temporal'@'%'; 3 | FLUSH PRIVILEGES; -------------------------------------------------------------------------------- /develop/github/postgresql-init/init.sql: -------------------------------------------------------------------------------- 1 | ALTER USER temporal WITH SUPERUSER; -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | .DEFAULT_GOAL := update-diagrams 2 | COLOR := "\e[1;36m%s\e[0m\n" 3 | DIAGRAMS := $(wildcard ./_assets/*.d2) 4 | 5 | install-d2: 6 | @printf $(COLOR) "Install d2..." 7 | @go install oss.terrastruct.com/d2@v0.6.3 8 | 9 | update-diagrams: install-d2 10 | @printf $(COLOR) "Update diagrams" 11 | $(foreach DIAGRAM, $(DIAGRAMS), $(shell d2 --layout elk --theme 7 --dark-theme 200 $(DIAGRAM) $(NEWLINE))) 12 | -------------------------------------------------------------------------------- /docs/development/macos/cassandra.md: -------------------------------------------------------------------------------- 1 | # Run Cassandra v3.11 on macOS 2 | 3 | ### Install 4 | ```bash 5 | brew install cassandra@3.11 6 | ``` 7 | 8 | For MacBook with ARM chip, you need to replace the JNA library with a recent version. 9 | 1. Locate the JNA file (`find $(brew --prefix) -name "jna-*.jar"`) and remove it. 10 | 2. Download a recent version of JNA jar file (5.8+) from [Maven](https://search.maven.org/artifact/net.java.dev.jna/jna). 11 | 3. Move the file you downloaded to the folder in step 1. 12 | 13 | ### Start 14 | ```bash 15 | cassandra -f 16 | ``` 17 | 18 | ### Post Installation 19 | Verify Cassandra v3.11 is running and accessible: 20 | ```bash 21 | cqlsh 22 | ``` -------------------------------------------------------------------------------- /docs/development/new-rpcs.md: -------------------------------------------------------------------------------- 1 | ## Adding new RPCs 2 | 3 | Adding new RPCs to any of the server roles is currently a little involved. 4 | Here's a list of what you'll need to modify: 5 | 6 | 1. Add RPC definitions to proto files. Either in the `api` repo (for frontend) 7 | or here in `proto/internal` (for history/matching). 8 | 2. Update `go.temporal.io/api` to pick up the new generated files (for frontend) 9 | or generate them here with `make proto` (for history/matching). 10 | 3. Add metric scope defs for client-side metrics to `common/metrics/defs.go` 11 | (this is going away soon). 12 | 4. `make service-clients` to generate wrappers in `client`. 13 | 5. For frontend: add definitions to `service/frontend/redirection_interceptor.go`. 14 | 6. Add your new methods to `service//configs/quotas.go`. 15 | 7. Finally, implement your new methods in the RPC handler. 16 | 17 | -------------------------------------------------------------------------------- /docs/development/run-dependencies-host.md: -------------------------------------------------------------------------------- 1 | ## Run Temporal dependencies on the host 2 | 3 | ### macOS 4 | While developing Temporal server you may want to run its dependencies locally. One of the reason might be 5 | a bad docker file system performance on macOS. Please follow the doc for the database you use: 6 | [Cassandra](macos/cassandra.md), [MySQL](macos/mysql.md), or [PostgreSQL](macos/postgresql.md). 7 | 8 | ### Linux 9 | Linux users should use `docker compose` as described in the [contribution guide](../../CONTRIBUTING.md). -------------------------------------------------------------------------------- /proto/buf.work.yaml: -------------------------------------------------------------------------------- 1 | # Generated by "buf config migrate-v1beta1". Edit as necessary, and 2 | # remove this comment when you're finished. 3 | # 4 | # This workspace file points to the roots found in your 5 | # previous "buf.yaml" configuration. 6 | version: v1 7 | directories: 8 | - internal 9 | -------------------------------------------------------------------------------- /proto/internal/buf.lock: -------------------------------------------------------------------------------- 1 | # Generated by buf. DO NOT EDIT. 2 | version: v1 3 | deps: 4 | - remote: buf.build 5 | owner: googleapis 6 | repository: googleapis 7 | commit: b30c5775bfb3485d9da2e87b26590ac9 8 | -------------------------------------------------------------------------------- /proto/internal/buf.yaml: -------------------------------------------------------------------------------- 1 | # Generated by "buf config migrate-v1beta1". Edit as necessary, and 2 | # remove this comment when you're finished. 3 | # 4 | # This module represents the "internal" root found in 5 | # the previous configuration. 6 | version: v1 7 | deps: 8 | - buf.build/googleapis/googleapis 9 | breaking: 10 | use: 11 | - WIRE 12 | # Uncomment this to temporarily ignore specific files or directories: 13 | ignore: 14 | # example: - temporal/server/api/.../message.proto 15 | - temporal/server/api/persistence/v1/chasm.proto 16 | 17 | lint: 18 | use: 19 | - DEFAULT 20 | except: 21 | - PACKAGE_SAME_JAVA_MULTIPLE_FILES 22 | - PACKAGE_SAME_JAVA_PACKAGE 23 | -------------------------------------------------------------------------------- /proto/internal/temporal/server/api/enums/v1/cluster.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package temporal.server.api.enums.v1; 4 | 5 | option go_package = "go.temporal.io/server/api/enums/v1;enums"; 6 | 7 | enum ClusterMemberRole { 8 | CLUSTER_MEMBER_ROLE_UNSPECIFIED = 0; 9 | CLUSTER_MEMBER_ROLE_FRONTEND = 1; 10 | CLUSTER_MEMBER_ROLE_HISTORY = 2; 11 | CLUSTER_MEMBER_ROLE_MATCHING = 3; 12 | CLUSTER_MEMBER_ROLE_WORKER = 4; 13 | } 14 | 15 | enum HealthState { 16 | HEALTH_STATE_UNSPECIFIED = 0; 17 | // The host is in a healthy state. 18 | HEALTH_STATE_SERVING = 1; 19 | // The host is unhealthy through external observation. 20 | HEALTH_STATE_NOT_SERVING = 2; 21 | // The host has marked itself as not ready to serve traffic. 22 | HEALTH_STATE_DECLINED_SERVING = 3; 23 | } 24 | -------------------------------------------------------------------------------- /proto/internal/temporal/server/api/enums/v1/dlq.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package temporal.server.api.enums.v1; 4 | 5 | option go_package = "go.temporal.io/server/api/enums/v1;enums"; 6 | 7 | enum DLQOperationType { 8 | DLQ_OPERATION_TYPE_UNSPECIFIED = 0; 9 | DLQ_OPERATION_TYPE_MERGE = 1; 10 | DLQ_OPERATION_TYPE_PURGE = 2; 11 | } 12 | 13 | enum DLQOperationState { 14 | DLQ_OPERATION_STATE_UNSPECIFIED = 0; 15 | DLQ_OPERATION_STATE_RUNNING = 1; 16 | DLQ_OPERATION_STATE_COMPLETED = 2; 17 | DLQ_OPERATION_STATE_FAILED = 3; 18 | } 19 | -------------------------------------------------------------------------------- /proto/internal/temporal/server/api/enums/v1/predicate.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package temporal.server.api.enums.v1; 4 | 5 | option go_package = "go.temporal.io/server/api/enums/v1;enums"; 6 | 7 | enum PredicateType { 8 | PREDICATE_TYPE_UNSPECIFIED = 0; 9 | PREDICATE_TYPE_UNIVERSAL = 1; 10 | PREDICATE_TYPE_EMPTY = 2; 11 | PREDICATE_TYPE_AND = 3; 12 | PREDICATE_TYPE_OR = 4; 13 | PREDICATE_TYPE_NOT = 5; 14 | PREDICATE_TYPE_NAMESPACE_ID = 6; 15 | PREDICATE_TYPE_TASK_TYPE = 7; 16 | PREDICATE_TYPE_DESTINATION = 8; 17 | PREDICATE_TYPE_OUTBOUND_TASK_GROUP = 9; 18 | // Predicate used for grouping outbound tasks. Consists of task_group, namespace_id, and destination. 19 | // This replaces a previous implementation which used an AND predicate over 3 separate predicate types. 20 | PREDICATE_TYPE_OUTBOUND_TASK = 10; 21 | } 22 | -------------------------------------------------------------------------------- /proto/internal/temporal/server/api/enums/v1/workflow_task_type.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package temporal.server.api.enums.v1; 4 | 5 | option go_package = "go.temporal.io/server/api/enums/v1;enums"; 6 | 7 | enum WorkflowTaskType { 8 | WORKFLOW_TASK_TYPE_UNSPECIFIED = 0; 9 | WORKFLOW_TASK_TYPE_NORMAL = 1; 10 | // TODO (alex): TRANSIENT is not current used. Needs to be set when Attempt>1. 11 | WORKFLOW_TASK_TYPE_TRANSIENT = 2; 12 | WORKFLOW_TASK_TYPE_SPECULATIVE = 3; 13 | } 14 | -------------------------------------------------------------------------------- /proto/internal/temporal/server/api/metrics/v1/message.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package temporal.server.api.metrics.v1; 4 | 5 | option go_package = "go.temporal.io/server/api/metrics/v1;metrics"; 6 | 7 | message Baggage { 8 | map counters_int = 1; 9 | } 10 | -------------------------------------------------------------------------------- /proto/internal/temporal/server/api/namespace/v1/message.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package temporal.server.api.namespace.v1; 4 | 5 | option go_package = "go.temporal.io/server/api/namespace/v1;namespace"; 6 | 7 | message NamespaceCacheInfo { 8 | // (-- api-linter: core::0140::prepositions=disabled 9 | // aip.dev/not-precedent: "in" and "by" are needed here. --) 10 | int64 items_in_cache_by_id_count = 1; 11 | // (-- api-linter: core::0140::prepositions=disabled 12 | // aip.dev/not-precedent: "in" and "by" are needed here. --) 13 | int64 items_in_cache_by_name_count = 2; 14 | } 15 | -------------------------------------------------------------------------------- /proto/internal/temporal/server/api/persistence/v1/queue_metadata.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package temporal.server.api.persistence.v1; 4 | option go_package = "go.temporal.io/server/api/persistence/v1;persistence"; 5 | 6 | // data column 7 | message QueueMetadata { 8 | map cluster_ack_levels = 1; 9 | } 10 | -------------------------------------------------------------------------------- /proto/internal/temporal/server/api/testservice/v1/request_response.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package temporal.server.api.testservice.v1; 4 | option go_package = "go.temporal.io/server/api/testservice/v1;testservice"; 5 | 6 | message SendHelloRequest { 7 | string name = 1; 8 | } 9 | 10 | message SendHelloResponse { 11 | string message = 1; 12 | } -------------------------------------------------------------------------------- /proto/internal/temporal/server/api/testservice/v1/service.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package temporal.server.api.testservice.v1; 4 | option go_package = "go.temporal.io/server/api/testservice/v1;testservice"; 5 | 6 | import "temporal/server/api/testservice/v1/request_response.proto"; 7 | 8 | // The greeting service definition. 9 | service TestService { 10 | // Sends a greeting 11 | rpc SendHello (SendHelloRequest) returns (SendHelloResponse) {} 12 | } -------------------------------------------------------------------------------- /schema/cassandra/temporal/keyspace.cql: -------------------------------------------------------------------------------- 1 | CREATE KEYSPACE IF NOT EXISTS temporal WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1}; 2 | -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.0/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.0", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "base version of schema", 5 | "SchemaUpdateCqlFiles": [ 6 | "schema.cql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.1/cluster_metadata.cql: -------------------------------------------------------------------------------- 1 | ALTER TABLE cluster_metadata ADD data blob; 2 | ALTER TABLE cluster_metadata ADD data_encoding text; 3 | ALTER TABLE cluster_metadata ADD version bigint; -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.1/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.1", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "schema update for cluster metadata", 5 | "SchemaUpdateCqlFiles": [ 6 | "cluster_metadata.cql" 7 | ] 8 | } -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.10/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.10", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "create nexus_incoming_services table", 5 | "SchemaUpdateCqlFiles": ["nexus_incoming_services.cql"] 6 | } 7 | -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.10/nexus_incoming_services.cql: -------------------------------------------------------------------------------- 1 | CREATE TABLE nexus_incoming_services 2 | ( 3 | partition int, -- constant for all rows (using a single partition for efficient list queries) 4 | type int, -- enum RowType { PartitionStatus, NexusIncomingService } 5 | service_id uuid, 6 | data blob, 7 | data_encoding text, 8 | -- When type=PartitionStatus contains the partition version. 9 | -- Partition version is used to guarantee latest versions when listing all services. 10 | -- When type=NexusIncomingService contains the service version used for optimistic concurrency 11 | version bigint, 12 | PRIMARY KEY ((partition), type, service_id) 13 | ) WITH COMPACTION = { 14 | 'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy' 15 | }; 16 | -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.11/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.11", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "Replace nexus_incoming_services table with nexus_endpoints table", 5 | "SchemaUpdateCqlFiles": ["nexus_endpoints.cql"] 6 | } 7 | -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.11/nexus_endpoints.cql: -------------------------------------------------------------------------------- 1 | DROP TABLE nexus_incoming_services; 2 | 3 | CREATE TABLE nexus_endpoints 4 | ( 5 | partition int, -- constant for all rows (using a single partition for efficient list queries) 6 | type int, -- enum RowType { PartitionStatus, NexusEndpoint } 7 | id uuid, 8 | data blob, 9 | data_encoding text, 10 | -- When type=PartitionStatus contains the partition version. 11 | -- Partition version is used to guarantee latest versions when listing all endpoints. 12 | -- When type=NexusEndpoint contains the endpoint version used for optimistic concurrency. 13 | version bigint, 14 | PRIMARY KEY ((partition), type, id) 15 | ) WITH COMPACTION = { 16 | 'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy' 17 | }; 18 | -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.12/chasm_node_map.cql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions ADD chasm_node_map map; 2 | ALTER TABLE executions ADD chasm_node_map_encoding text; 3 | 4 | -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.12/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.12", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "Add the chasm_node_map to the executions table", 5 | "SchemaUpdateCqlFiles": ["chasm_node_map.cql"] 6 | } 7 | -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.2/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.2", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "schema update for RPC replication", 5 | "SchemaUpdateCqlFiles": [ 6 | "queue.cql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.2/queue.cql: -------------------------------------------------------------------------------- 1 | ALTER TABLE queue ADD message_encoding text; 2 | ALTER TABLE queue_metadata ADD data blob; 3 | ALTER TABLE queue_metadata ADD data_encoding text; -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.3/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.3", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "Schema update to deprecate Kafka", 5 | "SchemaUpdateCqlFiles": [ 6 | "visibility.cql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.3/visibility.cql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions ADD visibility_task_data blob; 2 | ALTER TABLE executions ADD visibility_task_encoding text; 3 | -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.4/cluster_metadata.cql: -------------------------------------------------------------------------------- 1 | ALTER TABLE cluster_metadata DROP immutable_data; 2 | ALTER TABLE cluster_metadata DROP immutable_data_encoding; 3 | -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.4/executions.cql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions DROP replication_metadata; 2 | ALTER TABLE executions DROP replication_metadata_encoding; 3 | -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.4/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.4", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "schema update for cluster metadata cleanup", 5 | "SchemaUpdateCqlFiles": [ 6 | "executions.cql", 7 | "cluster_metadata.cql" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.5/event.cql: -------------------------------------------------------------------------------- 1 | ALTER TABLE history_node ADD prev_txn_id bigint; 2 | -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.5/executions.cql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions Add db_record_version bigint; 2 | -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.5/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.5", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "schema update for execution & history node table version", 5 | "SchemaUpdateCqlFiles": [ 6 | "event.cql", 7 | "executions.cql" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.6/cluster_metadata_info.cql: -------------------------------------------------------------------------------- 1 | CREATE TABLE cluster_metadata_info ( 2 | metadata_partition int, 3 | cluster_name text, 4 | data blob, 5 | data_encoding text, 6 | version bigint, 7 | PRIMARY KEY (metadata_partition, cluster_name) 8 | ) WITH COMPACTION = { 9 | 'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy' 10 | }; -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.6/executions.cql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions ADD tiered_storage_task_data blob; 2 | ALTER TABLE executions ADD tiered_storage_task_encoding text; -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.6/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.6", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "create cluster metadata info table to store cluster information and add tiered storage queue into executions", 5 | "SchemaUpdateCqlFiles": [ 6 | "executions.cql", 7 | "cluster_metadata_info.cql" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.7/executions.cql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions DROP tiered_storage_task_data; 2 | ALTER TABLE executions DROP tiered_storage_task_encoding; 3 | ALTER TABLE executions ADD task_data blob; 4 | ALTER TABLE executions ADD task_encoding text; -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.7/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.7", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "drop unused columns and add history task columns in executions", 5 | "SchemaUpdateCqlFiles": [ 6 | "executions.cql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.8/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.8", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "add storage for update records and create task_queue_user_data table", 5 | "SchemaUpdateCqlFiles": ["task_queue_user_data.cql"] 6 | } 7 | -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.9/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.9", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "Add queues and queue_messages tables for Queue V2 (supersedes the queue_metadata and queue tables).", 5 | "SchemaUpdateCqlFiles": ["queues.cql"] 6 | } 7 | -------------------------------------------------------------------------------- /schema/cassandra/temporal/versioned/v1.9/queues.cql: -------------------------------------------------------------------------------- 1 | CREATE TABLE queues 2 | ( 3 | queue_type int, 4 | queue_name text, 5 | metadata_payload blob, 6 | metadata_encoding text, 7 | version bigint, 8 | PRIMARY KEY ((queue_type, queue_name)) 9 | ) WITH COMPACTION = { 10 | 'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy' 11 | }; 12 | 13 | CREATE TABLE queue_messages 14 | ( 15 | queue_type int, 16 | queue_name text, 17 | queue_partition int, 18 | message_id bigint, 19 | message_payload blob, 20 | message_encoding text, 21 | PRIMARY KEY ((queue_type, queue_name, queue_partition), message_id) 22 | ) WITH COMPACTION = { 23 | 'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy' 24 | }; 25 | -------------------------------------------------------------------------------- /schema/cassandra/version.go: -------------------------------------------------------------------------------- 1 | package cassandra 2 | 3 | // NOTE: whenever there is a new database schema update, plz update the following versions 4 | 5 | // Version is the Cassandra database release version 6 | const Version = "1.12" 7 | -------------------------------------------------------------------------------- /schema/elasticsearch/visibility/cluster_settings_v7.json: -------------------------------------------------------------------------------- 1 | { 2 | "persistent": { 3 | "action.auto_create_index": "false" 4 | } 5 | } -------------------------------------------------------------------------------- /schema/elasticsearch/visibility/index_template_v7.json: -------------------------------------------------------------------------------- 1 | ./versioned/v9/index_template_v7.json -------------------------------------------------------------------------------- /schema/elasticsearch/visibility/versioned/v1/reindex.json: -------------------------------------------------------------------------------- 1 | { 2 | "conflicts": "proceed", 3 | "source": { 4 | "index": "${ES_VIS_INDEX_V0}", 5 | "size": 10000 6 | }, 7 | "dest": { 8 | "index": "${ES_VIS_INDEX_V1}", 9 | "version_type": "external" 10 | }, 11 | "script": { 12 | "lang": "painless", 13 | "source": "${REINDEX_SCRIPT}", 14 | "params": { 15 | "customSearchAttributes": ${CUSTOM_SEARCH_ATTRIBUTES} 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /schema/elasticsearch/visibility/versioned/v1/rollback.json: -------------------------------------------------------------------------------- 1 | { 2 | "conflicts": "proceed", 3 | "source": { 4 | "index": "${ES_VIS_INDEX_V1}" 5 | }, 6 | "dest": { 7 | "index": "${ES_VIS_INDEX_V0}", 8 | "version_type": "external" 9 | }, 10 | "script": { 11 | "lang": "painless", 12 | "source": "${REINDEX_SCRIPT}", 13 | "params": { 14 | "customSearchAttributes": ${CUSTOM_SEARCH_ATTRIBUTES} 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /schema/embed_test.go: -------------------------------------------------------------------------------- 1 | package schema 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/require" 7 | ) 8 | 9 | func TestSchemaDirs(t *testing.T) { 10 | dirs := PathsByDir("cassandra") 11 | requireContains(t, []string{ 12 | "cassandra/temporal", 13 | }, dirs) 14 | 15 | dirs = PathsByDir("mysql") 16 | requireContains(t, []string{ 17 | "mysql/v8/temporal", 18 | "mysql/v8/visibility", 19 | }, dirs) 20 | 21 | dirs = PathsByDir("postgresql") 22 | requireContains(t, []string{ 23 | "postgresql/v12/temporal", 24 | "postgresql/v12/visibility", 25 | }, dirs) 26 | } 27 | 28 | func requireContains(t *testing.T, expected []string, actual []string) { 29 | for _, v := range expected { 30 | require.Contains(t, actual, v) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/database.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE temporal CHARACTER SET utf8mb4; 2 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.0/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.0", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "base version of schema", 5 | "SchemaUpdateCqlFiles": [ 6 | "schema.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.1/cluster_metadata.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE cluster_metadata ADD data BLOB NOT NULL; 2 | ALTER TABLE cluster_metadata ADD data_encoding VARCHAR(16) NOT NULL DEFAULT 'Proto3'; 3 | ALTER TABLE cluster_metadata ADD version BIGINT NOT NULL DEFAULT 1; -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.1/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.1", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "schema update for cluster metadata", 5 | "SchemaUpdateCqlFiles": [ 6 | "cluster_metadata.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.10/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.10", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "add storage for update records and create task_queue_user_data table", 5 | "SchemaUpdateCqlFiles": [ 6 | "task_queue_user_data.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.10/task_queue_user_data.sql: -------------------------------------------------------------------------------- 1 | -- Stores task queue information such as user provided versioning data 2 | CREATE TABLE task_queue_user_data ( 3 | namespace_id BINARY(16) NOT NULL, 4 | task_queue_name VARCHAR(255) NOT NULL, 5 | data MEDIUMBLOB NOT NULL, -- temporal.server.api.persistence.v1.TaskQueueUserData 6 | data_encoding VARCHAR(16) NOT NULL, -- Encoding type used for serialization, in practice this should always be proto3 7 | version BIGINT NOT NULL, -- Version of this row, used for optimistic concurrency 8 | PRIMARY KEY (namespace_id, task_queue_name) 9 | ); 10 | 11 | -- Stores a mapping between build ids and task queues 12 | CREATE TABLE build_id_to_task_queue ( 13 | namespace_id BINARY(16) NOT NULL, 14 | build_id VARCHAR(255) NOT NULL, 15 | task_queue_name VARCHAR(255) NOT NULL, 16 | PRIMARY KEY (namespace_id, build_id, task_queue_name) 17 | ); -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.11/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.11", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "add queues and queue_messages tables", 5 | "SchemaUpdateCqlFiles": [ 6 | "queues.sql" 7 | ] 8 | } -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.11/queues.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE queues ( 2 | queue_type INT NOT NULL, 3 | queue_name VARCHAR(255) NOT NULL, 4 | metadata_payload MEDIUMBLOB NOT NULL, 5 | metadata_encoding VARCHAR(16) NOT NULL, 6 | PRIMARY KEY (queue_type, queue_name) 7 | ); 8 | 9 | CREATE TABLE queue_messages ( 10 | queue_type INT NOT NULL, 11 | queue_name VARCHAR(255) NOT NULL, 12 | queue_partition BIGINT NOT NULL, 13 | message_id BIGINT NOT NULL, 14 | message_payload MEDIUMBLOB NOT NULL, 15 | message_encoding VARCHAR(16) NOT NULL, 16 | PRIMARY KEY ( 17 | queue_type, 18 | queue_name, 19 | queue_partition, 20 | message_id 21 | ) 22 | ); 23 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.12/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.12", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "add storage for Nexus incoming service records and create nexus_incoming_services and nexus_incoming_services_partition_status tables", 5 | "SchemaUpdateCqlFiles": [ 6 | "nexus_incoming_services.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.13/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.13", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "Replace nexus_incoming_services and nexus_incoming_services_partition_status tables with nexus_endpoints and nexus_endpoints_partition_status tables", 5 | "SchemaUpdateCqlFiles": [ 6 | "nexus_endpoints.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.14/add_current_executions_start_time.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE current_executions ADD COLUMN start_time DATETIME(6) NULL; -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.14/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.14", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "Add new start_time column", 5 | "SchemaUpdateCqlFiles": [ 6 | "add_current_executions_start_time.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.15/add_current_executions_data.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE current_executions 2 | ADD COLUMN data MEDIUMBLOB NULL, 3 | ADD COLUMN data_encoding VARCHAR(16) NULL; 4 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.15/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.15", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "Add new column `data` to current_executions table", 5 | "SchemaUpdateCqlFiles": [ 6 | "add_current_executions_data.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.16/fix_data_encoding_column.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE current_executions DROP COLUMN data_encoding; 2 | ALTER TABLE current_executions ADD COLUMN data_encoding VARCHAR(16) NOT NULL DEFAULT ''; 3 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.16/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.16", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "Fix data_encoding column in current_executions table", 5 | "SchemaUpdateCqlFiles": [ 6 | "fix_data_encoding_column.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.17/add_chasm_node_maps.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE chasm_node_maps ( 2 | shard_id INT NOT NULL, 3 | namespace_id BINARY(16) NOT NULL, 4 | workflow_id VARCHAR(255) NOT NULL, 5 | run_id BINARY(16) NOT NULL, 6 | chasm_path VARBINARY(1536) NOT NULL, 7 | -- 8 | metadata MEDIUMBLOB NOT NULL, 9 | metadata_encoding VARCHAR(16), 10 | data MEDIUMBLOB, 11 | data_encoding VARCHAR(16), 12 | PRIMARY KEY (shard_id, namespace_id, workflow_id, run_id, chasm_path) 13 | ); 14 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.17/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.17", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "Add new chasm_node_maps table", 5 | "SchemaUpdateCqlFiles": [ 6 | "add_chasm_node_maps.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.2/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.2", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "schema update for RPC replication and blob size adjustments", 5 | "SchemaUpdateCqlFiles": [ 6 | "queue.sql", 7 | "blob_size.sql" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.2/queue.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE queue ADD message_encoding VARCHAR(16) NOT NULL DEFAULT 'Json'; 2 | ALTER TABLE queue_metadata ADD data_encoding VARCHAR(16) NOT NULL DEFAULT 'Json'; 3 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.3/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.3", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "schema update for kafka deprecation", 5 | "SchemaUpdateCqlFiles": [ 6 | "visibility_tasks.sql" 7 | ] 8 | } -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.3/visibility_tasks.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE visibility_tasks( 2 | shard_id INT NOT NULL, 3 | task_id BIGINT NOT NULL, 4 | -- 5 | data MEDIUMBLOB NOT NULL, 6 | data_encoding VARCHAR(16) NOT NULL, 7 | PRIMARY KEY (shard_id, task_id) 8 | ); -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.4/cluster_metadata.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE cluster_metadata DROP immutable_data; 2 | ALTER TABLE cluster_metadata DROP immutable_data_encoding; 3 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.4/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.4", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "schema update for cluster metadata cleanup", 5 | "SchemaUpdateCqlFiles": [ 6 | "cluster_metadata.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.5/cluster_membership.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE cluster_membership MODIFY COLUMN rpc_address VARCHAR(128); 2 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.5/event.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE history_node ADD prev_txn_id BIGINT NOT NULL DEFAULT 0; 2 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.5/executions.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions ADD db_record_version BIGINT NOT NULL DEFAULT 0; 2 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.5/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.5", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "schema update for cluster_membership, executions and history_node tables", 5 | "SchemaUpdateCqlFiles": [ 6 | "event.sql", 7 | "executions.sql", 8 | "cluster_membership.sql" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.6/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.6", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "schema update for queue_metadata", 5 | "SchemaUpdateCqlFiles": [ 6 | "queue_metadata.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.6/queue_metadata.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE queue_metadata ADD version BIGINT NOT NULL DEFAULT 0; 2 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.7/cluster_metadata_info.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE cluster_metadata_info ( 2 | metadata_partition INT NOT NULL, 3 | cluster_name VARCHAR(255) NOT NULL, 4 | data MEDIUMBLOB NOT NULL, 5 | data_encoding VARCHAR(16) NOT NULL, 6 | version BIGINT NOT NULL, 7 | PRIMARY KEY(metadata_partition, cluster_name) 8 | ); -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.7/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.7", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "create cluster metadata info table to store cluster information and executions to store tiered storage queue", 5 | "SchemaUpdateCqlFiles": [ 6 | "cluster_metadata_info.sql", 7 | "no_start_version.sql", 8 | "tiered_storage_tasks.sql" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.7/no_start_version.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE current_executions ALTER COLUMN start_version SET DEFAULT 0; -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.7/tiered_storage_tasks.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE tiered_storage_tasks ( 2 | shard_id INT NOT NULL, 3 | task_id BIGINT NOT NULL, 4 | -- 5 | data MEDIUMBLOB NOT NULL, 6 | data_encoding VARCHAR(16) NOT NULL, 7 | PRIMARY KEY (shard_id, task_id) 8 | ); -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.8/alter_columns.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE current_executions MODIFY COLUMN create_request_id VARCHAR(255); 2 | ALTER TABLE signals_requested_sets MODIFY COLUMN signal_id VARCHAR(255); 3 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.8/drop_unused_tasks_table.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE tiered_storage_tasks; -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.8/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.8", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "drop unused tasks table; expand VARCHAR columns governed by maxIDLength to VARCHAR(255)", 5 | "SchemaUpdateCqlFiles": [ 6 | "drop_unused_tasks_table.sql", 7 | "alter_columns.sql" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.9/history_tasks_table.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE history_immediate_tasks( 2 | shard_id INT NOT NULL, 3 | category_id INT NOT NULL, 4 | task_id BIGINT NOT NULL, 5 | -- 6 | data MEDIUMBLOB NOT NULL, 7 | data_encoding VARCHAR(16) NOT NULL, 8 | PRIMARY KEY (shard_id, category_id, task_id) 9 | ); 10 | 11 | CREATE TABLE history_scheduled_tasks ( 12 | shard_id INT NOT NULL, 13 | category_id INT NOT NULL, 14 | visibility_timestamp DATETIME(6) NOT NULL, 15 | task_id BIGINT NOT NULL, 16 | -- 17 | data MEDIUMBLOB NOT NULL, 18 | data_encoding VARCHAR(16) NOT NULL, 19 | PRIMARY KEY (shard_id, category_id, visibility_timestamp, task_id) 20 | ); -------------------------------------------------------------------------------- /schema/mysql/v8/temporal/versioned/v1.9/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.9", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "add history tasks table", 5 | "SchemaUpdateCqlFiles": [ 6 | "history_tasks_table.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/mysql/v8/version.go: -------------------------------------------------------------------------------- 1 | package v8 2 | 3 | // NOTE: whenever there is a new database schema update, plz update the following versions 4 | 5 | // Version is the MySQL database release version 6 | const Version = "1.17" 7 | 8 | // VisibilityVersion is the MySQL visibility database release version 9 | const VisibilityVersion = "1.9" 10 | -------------------------------------------------------------------------------- /schema/mysql/v8/visibility/database.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE temporal_visibility CHARACTER SET utf8mb4; 2 | -------------------------------------------------------------------------------- /schema/mysql/v8/visibility/versioned/v1.0/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.0", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "base version of visibility schema", 5 | "SchemaUpdateCqlFiles": [ 6 | "schema.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/mysql/v8/visibility/versioned/v1.1/index.sql: -------------------------------------------------------------------------------- 1 | CREATE INDEX by_close_time_by_status ON executions_visibility (namespace_id, close_time DESC, run_id, status); 2 | -------------------------------------------------------------------------------- /schema/mysql/v8/visibility/versioned/v1.1/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.1", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "add close time & status index", 5 | "SchemaUpdateCqlFiles": [ 6 | "index.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/mysql/v8/visibility/versioned/v1.2/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.2", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "update schema to support advanced visibility", 5 | "SchemaUpdateCqlFiles": [ 6 | "advanced_visibility.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/mysql/v8/visibility/versioned/v1.3/add_build_ids_search_attribute.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions_visibility ADD COLUMN BuildIds JSON GENERATED ALWAYS AS (search_attributes->'$.BuildIds'); 2 | CREATE INDEX by_build_ids ON executions_visibility (namespace_id, (CAST(BuildIds AS CHAR(255) ARRAY)), (COALESCE(close_time, CAST('9999-12-31 23:59:59' AS DATETIME))) DESC, start_time DESC, run_id); 3 | -------------------------------------------------------------------------------- /schema/mysql/v8/visibility/versioned/v1.3/add_history_size_bytes.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions_visibility ADD COLUMN history_size_bytes BIGINT NULL; 2 | CREATE INDEX by_history_size_bytes ON executions_visibility (namespace_id, history_size_bytes, (COALESCE(close_time, CAST('9999-12-31 23:59:59' AS DATETIME))) DESC, start_time DESC, run_id); 3 | -------------------------------------------------------------------------------- /schema/mysql/v8/visibility/versioned/v1.3/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.3", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "add history size bytes and build IDs visibility columns and indices", 5 | "SchemaUpdateCqlFiles": [ 6 | "add_history_size_bytes.sql", 7 | "add_build_ids_search_attribute.sql" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /schema/mysql/v8/visibility/versioned/v1.4/add_execution_duration.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions_visibility ADD COLUMN execution_duration BIGINT NULL; 2 | CREATE INDEX by_execution_duration ON executions_visibility (namespace_id, execution_duration, (COALESCE(close_time, CAST('9999-12-31 23:59:59' AS DATETIME))) DESC, start_time DESC, run_id); 3 | -------------------------------------------------------------------------------- /schema/mysql/v8/visibility/versioned/v1.4/add_parent_workflow_info.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions_visibility ADD COLUMN parent_workflow_id VARCHAR(255) NULL; 2 | ALTER TABLE executions_visibility ADD COLUMN parent_run_id VARCHAR(255) NULL; 3 | CREATE INDEX by_parent_workflow_id ON executions_visibility (namespace_id, parent_workflow_id, (COALESCE(close_time, CAST('9999-12-31 23:59:59' AS DATETIME))) DESC, start_time DESC, run_id); 4 | CREATE INDEX by_parent_run_id ON executions_visibility (namespace_id, parent_run_id, (COALESCE(close_time, CAST('9999-12-31 23:59:59' AS DATETIME))) DESC, start_time DESC, run_id); 5 | -------------------------------------------------------------------------------- /schema/mysql/v8/visibility/versioned/v1.4/add_state_transition_count.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions_visibility ADD COLUMN state_transition_count BIGINT NULL; 2 | CREATE INDEX by_state_transition_count ON executions_visibility (namespace_id, state_transition_count, (COALESCE(close_time, CAST('9999-12-31 23:59:59' AS DATETIME))) DESC, start_time DESC, run_id); 3 | -------------------------------------------------------------------------------- /schema/mysql/v8/visibility/versioned/v1.4/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.4", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "add execution duration, state transition count and parent workflow info columns, and indices", 5 | "SchemaUpdateCqlFiles": [ 6 | "add_execution_duration.sql", 7 | "add_state_transition_count.sql", 8 | "add_parent_workflow_info.sql" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /schema/mysql/v8/visibility/versioned/v1.5/add_root_workflow_info.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions_visibility ADD COLUMN root_workflow_id VARCHAR(255) NULL; 2 | ALTER TABLE executions_visibility ADD COLUMN root_run_id VARCHAR(255) NULL; 3 | CREATE INDEX by_root_workflow_id ON executions_visibility (namespace_id, root_workflow_id, (COALESCE(close_time, CAST('9999-12-31 23:59:59' AS DATETIME))) DESC, start_time DESC, run_id); 4 | CREATE INDEX by_root_run_id ON executions_visibility (namespace_id, root_run_id, (COALESCE(close_time, CAST('9999-12-31 23:59:59' AS DATETIME))) DESC, start_time DESC, run_id); 5 | -------------------------------------------------------------------------------- /schema/mysql/v8/visibility/versioned/v1.5/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.5", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "add root workflow info columns and indices", 5 | "SchemaUpdateCqlFiles": [ 6 | "add_root_workflow_info.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/mysql/v8/visibility/versioned/v1.6/fix_root_workflow_info.sql: -------------------------------------------------------------------------------- 1 | DROP INDEX by_root_workflow_id ON executions_visibility; 2 | DROP INDEX by_root_run_id ON executions_visibility; 3 | ALTER TABLE executions_visibility DROP COLUMN root_workflow_id; 4 | ALTER TABLE executions_visibility DROP COLUMN root_run_id; 5 | 6 | ALTER TABLE executions_visibility ADD COLUMN root_workflow_id VARCHAR(255) NOT NULL DEFAULT ''; 7 | ALTER TABLE executions_visibility ADD COLUMN root_run_id VARCHAR(255) NOT NULL DEFAULT ''; 8 | CREATE INDEX by_root_workflow_id ON executions_visibility (namespace_id, root_workflow_id, (COALESCE(close_time, CAST('9999-12-31 23:59:59' AS DATETIME))) DESC, start_time DESC, run_id); 9 | CREATE INDEX by_root_run_id ON executions_visibility (namespace_id, root_run_id, (COALESCE(close_time, CAST('9999-12-31 23:59:59' AS DATETIME))) DESC, start_time DESC, run_id); 10 | -------------------------------------------------------------------------------- /schema/mysql/v8/visibility/versioned/v1.6/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.6", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "fix root workflow info columns", 5 | "SchemaUpdateCqlFiles": [ 6 | "fix_root_workflow_info.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/mysql/v8/visibility/versioned/v1.7/add_pause_info_search_attribute.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions_visibility ADD COLUMN TemporalPauseInfo JSON GENERATED ALWAYS AS (search_attributes->'$.TemporalPauseInfo'); 2 | CREATE INDEX by_temporal_pause_info ON executions_visibility (namespace_id, (CAST(TemporalPauseInfo AS CHAR(255) ARRAY)), (COALESCE(close_time, CAST('9999-12-31 23:59:59' AS DATETIME))) DESC, start_time DESC, run_id); 3 | -------------------------------------------------------------------------------- /schema/mysql/v8/visibility/versioned/v1.7/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.7", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "add TemporalPauseInfo column", 5 | "SchemaUpdateCqlFiles": [ 6 | "add_pause_info_search_attribute.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/mysql/v8/visibility/versioned/v1.8/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.8", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "add TemporalWorkerDeploymentVersion, TemporalWorkerDeployment, and TemporalWorkflowVersioningBehavior columns", 5 | "SchemaUpdateCqlFiles": [ 6 | "add_deployment_search_attributes.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/mysql/v8/visibility/versioned/v1.9/add_version_column.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions_visibility ADD COLUMN _version BIGINT NOT NULL DEFAULT 0; 2 | ALTER TABLE custom_search_attributes ADD COLUMN _version BIGINT NOT NULL DEFAULT 0; 3 | -------------------------------------------------------------------------------- /schema/mysql/v8/visibility/versioned/v1.9/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.9", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "add _version column", 5 | "SchemaUpdateCqlFiles": [ 6 | "add_version_column.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/database.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE temporal; -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.0/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.0", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "base version of schema", 5 | "SchemaUpdateCqlFiles": [ 6 | "schema.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.1/cluster_metadata.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE cluster_metadata ADD data BYTEA NOT NULL DEFAULT ''; 2 | ALTER TABLE cluster_metadata ADD data_encoding VARCHAR(16) NOT NULL DEFAULT 'Proto3'; 3 | ALTER TABLE cluster_metadata ADD version BIGINT NOT NULL DEFAULT 1; -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.1/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.1", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "schema update for cluster metadata", 5 | "SchemaUpdateCqlFiles": [ 6 | "cluster_metadata.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.10/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.10", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "add storage for update records and create task_queue_user_data table", 5 | "SchemaUpdateCqlFiles": [ 6 | "task_queue_user_data.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.11/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.11", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "add queues and queue_messages tables", 5 | "SchemaUpdateCqlFiles": [ 6 | "queue_v2.sql" 7 | ] 8 | } -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.11/queue_v2.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE queues ( 2 | queue_type INT NOT NULL, 3 | queue_name VARCHAR(255) NOT NULL, 4 | metadata_payload BYTEA NOT NULL, 5 | metadata_encoding VARCHAR(16) NOT NULL, 6 | PRIMARY KEY (queue_type, queue_name) 7 | ); 8 | 9 | CREATE TABLE queue_messages ( 10 | queue_type INT NOT NULL, 11 | queue_name VARCHAR(255) NOT NULL, 12 | queue_partition BIGINT NOT NULL, 13 | message_id BIGINT NOT NULL, 14 | message_payload BYTEA NOT NULL, 15 | message_encoding VARCHAR(16) NOT NULL, 16 | PRIMARY KEY ( 17 | queue_type, 18 | queue_name, 19 | queue_partition, 20 | message_id 21 | ) 22 | ); -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.12/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.12", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "add storage for Nexus incoming service records and create nexus_incoming_services and nexus_incoming_services_partition_status tables", 5 | "SchemaUpdateCqlFiles": [ 6 | "nexus_incoming_services.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.13/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.13", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "Replace nexus_incoming_services and nexus_incoming_services_partition_status tables with nexus_endpoints and nexus_endpoints_partition_status tables", 5 | "SchemaUpdateCqlFiles": [ 6 | "nexus_endpoints.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.14/add_current_executions_start_time.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE current_executions ADD COLUMN start_time TIMESTAMP NULL; -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.14/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.14", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "Add new start_time column", 5 | "SchemaUpdateCqlFiles": [ 6 | "add_current_executions_start_time.sql" 7 | ] 8 | } -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.15/add_current_executions_data.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE current_executions 2 | ADD COLUMN data BYTEA NULL, 3 | ADD COLUMN data_encoding VARCHAR(16) NULL; 4 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.15/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.15", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "Add new column `data` to current_executions table", 5 | "SchemaUpdateCqlFiles": [ 6 | "add_current_executions_data.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.16/fix_data_encoding_column.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE current_executions DROP COLUMN data_encoding; 2 | ALTER TABLE current_executions ADD COLUMN data_encoding VARCHAR(16) NOT NULL DEFAULT ''; 3 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.16/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.16", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "Fix data_encoding column in current_executions table", 5 | "SchemaUpdateCqlFiles": [ 6 | "fix_data_encoding_column.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.17/add_chasm_node_maps.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE chasm_node_maps ( 2 | shard_id INTEGER NOT NULL, 3 | namespace_id BYTEA NOT NULL, 4 | workflow_id VARCHAR(255) NOT NULL, 5 | run_id BYTEA NOT NULL, 6 | chasm_path BYTEA NOT NULL, 7 | -- 8 | metadata BYTEA NOT NULL, 9 | metadata_encoding VARCHAR(16), 10 | data BYTEA, 11 | data_encoding VARCHAR(16), 12 | PRIMARY KEY (shard_id, namespace_id, workflow_id, run_id, chasm_path) 13 | ); 14 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.17/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.17", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "Add new chasm_node_maps table", 5 | "SchemaUpdateCqlFiles": [ 6 | "add_chasm_node_maps.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.2/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.2", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "schema update for RPC replication", 5 | "SchemaUpdateCqlFiles": [ 6 | "queue.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.2/queue.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE queue ADD message_encoding VARCHAR(16) NOT NULL DEFAULT 'Json'; 2 | ALTER TABLE queue_metadata ADD data_encoding VARCHAR(16) NOT NULL DEFAULT 'Json'; 3 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.3/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.3", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "schema update for kafka deprecation", 5 | "SchemaUpdateCqlFiles": [ 6 | "visibility_tasks.sql" 7 | ] 8 | } -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.3/visibility_tasks.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE visibility_tasks( 2 | shard_id INTEGER NOT NULL, 3 | task_id BIGINT NOT NULL, 4 | -- 5 | data BYTEA NOT NULL, 6 | data_encoding VARCHAR(16) NOT NULL, 7 | PRIMARY KEY (shard_id, task_id) 8 | ); -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.4/cluster_metadata.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE cluster_metadata DROP immutable_data; 2 | ALTER TABLE cluster_metadata DROP immutable_data_encoding; 3 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.4/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.4", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "schema update for cluster metadata cleanup", 5 | "SchemaUpdateCqlFiles": [ 6 | "cluster_metadata.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.5/cluster_membership.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE cluster_membership ALTER COLUMN rpc_address TYPE VARCHAR(128); 2 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.5/event.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE history_node ADD prev_txn_id BIGINT NOT NULL DEFAULT 0; 2 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.5/executions.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions ADD db_record_version BIGINT NOT NULL DEFAULT 0; 2 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.5/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.5", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "schema update for cluster_membership, executions and history_node tables", 5 | "SchemaUpdateCqlFiles": [ 6 | "event.sql", 7 | "executions.sql", 8 | "cluster_membership.sql" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.6/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.6", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "schema update for queue_metadata", 5 | "SchemaUpdateCqlFiles": [ 6 | "queue_metadata.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.6/queue_metadata.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE queue_metadata ADD version BIGINT NOT NULL DEFAULT 0; 2 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.7/cluster_metadata_info.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE cluster_metadata_info ( 2 | metadata_partition INTEGER NOT NULL, 3 | cluster_name VARCHAR(255) NOT NULL, 4 | data BYTEA NOT NULL, 5 | data_encoding VARCHAR(16) NOT NULL, 6 | version BIGINT NOT NULL, 7 | PRIMARY KEY(metadata_partition, cluster_name) 8 | ); -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.7/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.7", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "create cluster metadata info table to store cluster information and executions to store tiered storage queue", 5 | "SchemaUpdateCqlFiles": [ 6 | "cluster_metadata_info.sql", 7 | "no_start_version.sql", 8 | "tiered_storage_tasks.sql" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.7/no_start_version.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE current_executions ALTER COLUMN start_version SET DEFAULT 0; -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.7/tiered_storage_tasks.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE tiered_storage_tasks( 2 | shard_id INTEGER NOT NULL, 3 | task_id BIGINT NOT NULL, 4 | -- 5 | data BYTEA NOT NULL, 6 | data_encoding VARCHAR(16) NOT NULL, 7 | PRIMARY KEY (shard_id, task_id) 8 | ); -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.8/alter_columns.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE current_executions ALTER COLUMN create_request_id TYPE VARCHAR(255); 2 | ALTER TABLE signals_requested_sets ALTER COLUMN signal_id TYPE VARCHAR(255); 3 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.8/drop_unused_tasks_table.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE tiered_storage_tasks; -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.8/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.8", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "drop unused tasks table; Expand VARCHAR columns governed by maxIDLength to VARCHAR(255)", 5 | "SchemaUpdateCqlFiles": [ 6 | "drop_unused_tasks_table.sql", 7 | "alter_columns.sql" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.9/history_tasks_table.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE history_immediate_tasks( 2 | shard_id INTEGER NOT NULL, 3 | category_id INTEGER NOT NULL, 4 | task_id BIGINT NOT NULL, 5 | -- 6 | data BYTEA NOT NULL, 7 | data_encoding VARCHAR(16) NOT NULL, 8 | PRIMARY KEY (shard_id, category_id, task_id) 9 | ); 10 | 11 | CREATE TABLE history_scheduled_tasks ( 12 | shard_id INTEGER NOT NULL, 13 | category_id INTEGER NOT NULL, 14 | visibility_timestamp TIMESTAMP NOT NULL, 15 | task_id BIGINT NOT NULL, 16 | -- 17 | data BYTEA NOT NULL, 18 | data_encoding VARCHAR(16) NOT NULL, 19 | PRIMARY KEY (shard_id, category_id, visibility_timestamp, task_id) 20 | ); -------------------------------------------------------------------------------- /schema/postgresql/v12/temporal/versioned/v1.9/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.9", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "add history tasks table", 5 | "SchemaUpdateCqlFiles": [ 6 | "history_tasks_table.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/postgresql/v12/version.go: -------------------------------------------------------------------------------- 1 | package v12 2 | 3 | // NOTE: whenever there is a new database schema update, plz update the following versions 4 | 5 | // Version is the Postgres database release version 6 | // Temporal supports both MySQL and Postgres officially, so upgrade should be performed for both MySQL and Postgres 7 | const Version = "1.17" 8 | 9 | // VisibilityVersion is the Postgres visibility database release version 10 | // Temporal supports both MySQL and Postgres officially, so upgrade should be performed for both MySQL and Postgres 11 | const VisibilityVersion = "1.9" 12 | -------------------------------------------------------------------------------- /schema/postgresql/v12/visibility/database.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE temporal_visibility; -------------------------------------------------------------------------------- /schema/postgresql/v12/visibility/versioned/v1.0/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.0", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "base version of visibility schema", 5 | "SchemaUpdateCqlFiles": [ 6 | "schema.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/postgresql/v12/visibility/versioned/v1.1/index.sql: -------------------------------------------------------------------------------- 1 | CREATE INDEX by_close_time_by_status ON executions_visibility (namespace_id, close_time DESC, run_id, status); 2 | -------------------------------------------------------------------------------- /schema/postgresql/v12/visibility/versioned/v1.1/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.1", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "add close time & status index", 5 | "SchemaUpdateCqlFiles": [ 6 | "index.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/postgresql/v12/visibility/versioned/v1.2/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.2", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "update schema to support advanced visibility", 5 | "SchemaUpdateCqlFiles": [ 6 | "advanced_visibility.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/postgresql/v12/visibility/versioned/v1.3/add_build_ids_search_attribute.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions_visibility ADD COLUMN BuildIds JSONB GENERATED ALWAYS AS (search_attributes->'BuildIds') STORED; 2 | CREATE INDEX by_build_ids ON executions_visibility USING GIN (namespace_id, BuildIds jsonb_path_ops); 3 | -------------------------------------------------------------------------------- /schema/postgresql/v12/visibility/versioned/v1.3/add_history_size_bytes.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions_visibility ADD COLUMN history_size_bytes BIGINT NULL; 2 | CREATE INDEX by_history_size_bytes ON executions_visibility (namespace_id, history_size_bytes, (COALESCE(close_time, '9999-12-31 23:59:59')) DESC, start_time DESC, run_id); 3 | -------------------------------------------------------------------------------- /schema/postgresql/v12/visibility/versioned/v1.3/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.3", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "add history size bytes and build IDs visibility columns and indices", 5 | "SchemaUpdateCqlFiles": [ 6 | "add_history_size_bytes.sql", 7 | "add_build_ids_search_attribute.sql" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /schema/postgresql/v12/visibility/versioned/v1.4/add_execution_duration.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions_visibility ADD COLUMN execution_duration BIGINT NULL; 2 | CREATE INDEX by_execution_duration ON executions_visibility (namespace_id, execution_duration, (COALESCE(close_time, '9999-12-31 23:59:59')) DESC, start_time DESC, run_id); 3 | -------------------------------------------------------------------------------- /schema/postgresql/v12/visibility/versioned/v1.4/add_parent_workflow_info.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions_visibility ADD COLUMN parent_workflow_id VARCHAR(255) NULL; 2 | ALTER TABLE executions_visibility ADD COLUMN parent_run_id VARCHAR(255) NULL; 3 | CREATE INDEX by_parent_workflow_id ON executions_visibility (namespace_id, parent_workflow_id, (COALESCE(close_time, '9999-12-31 23:59:59')) DESC, start_time DESC, run_id); 4 | CREATE INDEX by_parent_run_id ON executions_visibility (namespace_id, parent_run_id, (COALESCE(close_time, '9999-12-31 23:59:59')) DESC, start_time DESC, run_id); 5 | -------------------------------------------------------------------------------- /schema/postgresql/v12/visibility/versioned/v1.4/add_state_transition_count.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions_visibility ADD COLUMN state_transition_count BIGINT NULL; 2 | CREATE INDEX by_state_transition_count ON executions_visibility (namespace_id, state_transition_count, (COALESCE(close_time, '9999-12-31 23:59:59')) DESC, start_time DESC, run_id); 3 | -------------------------------------------------------------------------------- /schema/postgresql/v12/visibility/versioned/v1.4/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.4", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "add execution duration, state transition count and parent workflow info columns, and indices", 5 | "SchemaUpdateCqlFiles": [ 6 | "add_execution_duration.sql", 7 | "add_state_transition_count.sql", 8 | "add_parent_workflow_info.sql" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /schema/postgresql/v12/visibility/versioned/v1.5/add_root_workflow_info.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions_visibility ADD COLUMN root_workflow_id VARCHAR(255) NULL; 2 | ALTER TABLE executions_visibility ADD COLUMN root_run_id VARCHAR(255) NULL; 3 | CREATE INDEX by_root_workflow_id ON executions_visibility (namespace_id, root_workflow_id, (COALESCE(close_time, '9999-12-31 23:59:59')) DESC, start_time DESC, run_id); 4 | CREATE INDEX by_root_run_id ON executions_visibility (namespace_id, root_run_id, (COALESCE(close_time, '9999-12-31 23:59:59')) DESC, start_time DESC, run_id); 5 | -------------------------------------------------------------------------------- /schema/postgresql/v12/visibility/versioned/v1.5/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.5", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "add root workflow info columns and indices", 5 | "SchemaUpdateCqlFiles": [ 6 | "add_root_workflow_info.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/postgresql/v12/visibility/versioned/v1.6/fix_root_workflow_info.sql: -------------------------------------------------------------------------------- 1 | DROP INDEX by_root_workflow_id; 2 | DROP INDEX by_root_run_id; 3 | ALTER TABLE executions_visibility DROP COLUMN root_workflow_id; 4 | ALTER TABLE executions_visibility DROP COLUMN root_run_id; 5 | 6 | ALTER TABLE executions_visibility ADD COLUMN root_workflow_id VARCHAR(255) NOT NULL DEFAULT ''; 7 | ALTER TABLE executions_visibility ADD COLUMN root_run_id VARCHAR(255) NOT NULL DEFAULT ''; 8 | CREATE INDEX by_root_workflow_id ON executions_visibility (namespace_id, root_workflow_id, (COALESCE(close_time, '9999-12-31 23:59:59')) DESC, start_time DESC, run_id); 9 | CREATE INDEX by_root_run_id ON executions_visibility (namespace_id, root_run_id, (COALESCE(close_time, '9999-12-31 23:59:59')) DESC, start_time DESC, run_id); 10 | -------------------------------------------------------------------------------- /schema/postgresql/v12/visibility/versioned/v1.6/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.6", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "fix root workflow info columns", 5 | "SchemaUpdateCqlFiles": [ 6 | "fix_root_workflow_info.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/postgresql/v12/visibility/versioned/v1.7/add_pause_info_search_attribute.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions_visibility ADD COLUMN TemporalPauseInfo JSONB GENERATED ALWAYS AS (search_attributes->'TemporalPauseInfo') STORED; 2 | CREATE INDEX by_temporal_pause_info ON executions_visibility USING GIN (namespace_id, TemporalPauseInfo jsonb_path_ops); 3 | -------------------------------------------------------------------------------- /schema/postgresql/v12/visibility/versioned/v1.7/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.7", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "add TemporalPauseInfo column", 5 | "SchemaUpdateCqlFiles": [ 6 | "add_pause_info_search_attribute.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/postgresql/v12/visibility/versioned/v1.8/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.8", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "add TemporalWorkerDeploymentVersion, TemporalWorkerDeployment, and TemporalWorkflowVersioningBehavior columns", 5 | "SchemaUpdateCqlFiles": [ 6 | "add_deployment_search_attributes.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/postgresql/v12/visibility/versioned/v1.9/add_version_column.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE executions_visibility ADD COLUMN _version BIGINT NOT NULL DEFAULT 0; 2 | -------------------------------------------------------------------------------- /schema/postgresql/v12/visibility/versioned/v1.9/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "1.9", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "add _version column", 5 | "SchemaUpdateCqlFiles": [ 6 | "add_version_column.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/sqlite/v3/temporal/versioned/v0.2/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "0.2", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "create task_queue_user_data table", 5 | "SchemaUpdateCqlFiles": ["task_queue_user_data.sql"] 6 | } 7 | -------------------------------------------------------------------------------- /schema/sqlite/v3/temporal/versioned/v0.3/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "0.3", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "add queues and queue_messages tables", 5 | "SchemaUpdateCqlFiles": [ 6 | "queue_v2.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/sqlite/v3/temporal/versioned/v0.3/queue_v2.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE queues ( 2 | queue_type INT NOT NULL, 3 | queue_name VARCHAR(255) NOT NULL, 4 | metadata_payload MEDIUMBLOB NOT NULL, 5 | metadata_encoding VARCHAR(16) NOT NULL, 6 | PRIMARY KEY (queue_type, queue_name) 7 | ); 8 | 9 | CREATE TABLE queue_messages ( 10 | queue_type INT NOT NULL, 11 | queue_name VARCHAR(255) NOT NULL, 12 | queue_partition BIGINT NOT NULL, 13 | message_id BIGINT NOT NULL, 14 | message_payload MEDIUMBLOB NOT NULL, 15 | message_encoding VARCHAR(16) NOT NULL, 16 | PRIMARY KEY ( 17 | queue_type, 18 | queue_name, 19 | queue_partition, 20 | message_id 21 | ) 22 | ); 23 | -------------------------------------------------------------------------------- /schema/sqlite/v3/temporal/versioned/v0.4/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "0.4", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "add storage for Nexus incoming service records and create nexus_incoming_services and nexus_incoming_services_partition_status tables", 5 | "SchemaUpdateCqlFiles": [ 6 | "nexus_incoming_services.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/sqlite/v3/temporal/versioned/v0.5/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "0.5", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "Replace nexus_incoming_services and nexus_incoming_services_partition_status tables with nexus_endpoints and nexus_endpoints_partition_status tables", 5 | "SchemaUpdateCqlFiles": [ 6 | "nexus_endpoints.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/sqlite/v3/temporal/versioned/v0.6/add_current_executions_start_time.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE current_executions ADD COLUMN start_time TIMESTAMP NULL; -------------------------------------------------------------------------------- /schema/sqlite/v3/temporal/versioned/v0.6/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "0.6", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "Add new start_time column", 5 | "SchemaUpdateCqlFiles": [ 6 | "add_current_executions_start_time.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/sqlite/v3/temporal/versioned/v0.7/add_current_executions_data.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE current_executions ADD COLUMN data MEDIUMBLOB NULL; 2 | ALTER TABLE current_executions ADD COLUMN data_encoding VARCHAR(16) NULL; 3 | -------------------------------------------------------------------------------- /schema/sqlite/v3/temporal/versioned/v0.7/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "0.7", 3 | "MinCompatibleVersion": "0.1", 4 | "Description": "Add new column `data` to current_executions table", 5 | "SchemaUpdateCqlFiles": [ 6 | "add_current_executions_data.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/sqlite/v3/temporal/versioned/v0.8/fix_data_encoding_column.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE current_executions DROP COLUMN data_encoding; 2 | ALTER TABLE current_executions ADD COLUMN data_encoding VARCHAR(16) NOT NULL DEFAULT ''; 3 | -------------------------------------------------------------------------------- /schema/sqlite/v3/temporal/versioned/v0.8/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "0.8", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "Fix data_encoding column in current_executions table", 5 | "SchemaUpdateCqlFiles": [ 6 | "fix_data_encoding_column.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/sqlite/v3/temporal/versioned/v0.9/add_chasm_node_maps.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE chasm_node_maps ( 2 | shard_id INT NOT NULL, 3 | namespace_id BINARY(16) NOT NULL, 4 | workflow_id VARCHAR(255) NOT NULL, 5 | run_id BINARY(16) NOT NULL, 6 | chasm_path BINARY(1536) NOT NULL, 7 | -- 8 | metadata MEDIUMBLOB NOT NULL, 9 | metadata_encoding VARCHAR(16), 10 | data MEDIUMBLOB, 11 | data_encoding VARCHAR(16), 12 | PRIMARY KEY (shard_id, namespace_id, workflow_id, run_id, chasm_path) 13 | ); 14 | -------------------------------------------------------------------------------- /schema/sqlite/v3/temporal/versioned/v0.9/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "CurrVersion": "0.9", 3 | "MinCompatibleVersion": "1.0", 4 | "Description": "Add new chasm_node_maps table", 5 | "SchemaUpdateCqlFiles": [ 6 | "add_chasm_node_maps.sql" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /schema/sqlite/version.go: -------------------------------------------------------------------------------- 1 | package sqlite 2 | 3 | // Version is the SQLite database release version 4 | const Version = "0.9" 5 | 6 | // VisibilityVersion is the SQLite visibility database release version 7 | const VisibilityVersion = "0.1" 8 | -------------------------------------------------------------------------------- /service/frontend/interface.go: -------------------------------------------------------------------------------- 1 | package frontend 2 | 3 | import ( 4 | "go.temporal.io/api/operatorservice/v1" 5 | "go.temporal.io/api/workflowservice/v1" 6 | ) 7 | 8 | const ( 9 | WorkflowServiceName = "temporal.api.workflowservice.v1.WorkflowService" 10 | OperatorServiceName = "temporal.api.operatorservice.v1.OperatorService" 11 | AdminServiceName = "temporal.api.adminservice.v1.AdminService" 12 | ) 13 | 14 | type ( 15 | // Handler is interface wrapping frontend workflow handler 16 | Handler interface { 17 | workflowservice.WorkflowServiceServer 18 | GetConfig() *Config 19 | Start() 20 | Stop() 21 | } 22 | 23 | // OperatorHandler is interface wrapping frontend workflow handler 24 | OperatorHandler interface { 25 | operatorservice.OperatorServiceServer 26 | Start() 27 | Stop() 28 | } 29 | ) 30 | -------------------------------------------------------------------------------- /service/frontend/namespace_handler_mock.go: -------------------------------------------------------------------------------- 1 | // Code generated by MockGen. DO NOT EDIT. 2 | // Source: namespace_handler.go 3 | // 4 | // Generated by this command: 5 | // 6 | // mockgen -package frontend -source namespace_handler.go -destination namespace_handler_mock.go 7 | // 8 | 9 | // Package frontend is a generated GoMock package. 10 | package frontend 11 | -------------------------------------------------------------------------------- /service/frontend/validators.go: -------------------------------------------------------------------------------- 1 | package frontend 2 | 3 | import ( 4 | "github.com/pborman/uuid" 5 | commonpb "go.temporal.io/api/common/v1" 6 | ) 7 | 8 | func validateExecution(w *commonpb.WorkflowExecution) error { 9 | if w == nil { 10 | return errExecutionNotSet 11 | } 12 | if w.GetWorkflowId() == "" { 13 | return errWorkflowIDNotSet 14 | } 15 | if w.GetRunId() != "" && uuid.Parse(w.GetRunId()) == nil { 16 | return errInvalidRunID 17 | } 18 | return nil 19 | } 20 | -------------------------------------------------------------------------------- /service/history/README.md: -------------------------------------------------------------------------------- 1 | See [docs/history-service.md](../../docs/architecture/history-service.md). 2 | -------------------------------------------------------------------------------- /service/history/api/replication_util.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "go.temporal.io/api/serviceerror" 5 | "go.temporal.io/server/common/cluster" 6 | ) 7 | 8 | func ValidateReplicationConfig( 9 | clusterMetadata cluster.Metadata, 10 | ) error { 11 | if !clusterMetadata.IsGlobalNamespaceEnabled() { 12 | return serviceerror.NewUnavailable("The cluster has global namespace disabled. The operation is not supported.") 13 | } 14 | return nil 15 | } 16 | -------------------------------------------------------------------------------- /service/history/api/task_category.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "fmt" 5 | 6 | "go.temporal.io/api/serviceerror" 7 | "go.temporal.io/server/service/history/tasks" 8 | ) 9 | 10 | func GetTaskCategory(categoryID int, registry tasks.TaskCategoryRegistry) (tasks.Category, error) { 11 | category, ok := registry.GetCategoryByID(categoryID) 12 | if !ok { 13 | return tasks.Category{}, serviceerror.NewInvalidArgument( 14 | fmt.Sprintf("Invalid task category id: %v", categoryID), 15 | ) 16 | } 17 | return category, nil 18 | } 19 | -------------------------------------------------------------------------------- /service/history/api/task_category_test.go: -------------------------------------------------------------------------------- 1 | package api_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | "github.com/stretchr/testify/require" 8 | "go.temporal.io/api/serviceerror" 9 | "go.temporal.io/server/service/history/api" 10 | "go.temporal.io/server/service/history/tasks" 11 | "google.golang.org/grpc/codes" 12 | ) 13 | 14 | func TestGetTaskCategory(t *testing.T) { 15 | t.Parallel() 16 | 17 | registry := tasks.NewDefaultTaskCategoryRegistry() 18 | category, err := api.GetTaskCategory(tasks.CategoryIDTransfer, registry) 19 | require.NoError(t, err) 20 | assert.Equal(t, tasks.CategoryIDTransfer, category.ID()) 21 | 22 | _, err = api.GetTaskCategory(0, registry) 23 | require.Error(t, err) 24 | assert.ErrorContains(t, err, "0") 25 | assert.Equal(t, codes.InvalidArgument, serviceerror.ToStatus(err).Code()) 26 | } 27 | -------------------------------------------------------------------------------- /service/history/archival/fx.go: -------------------------------------------------------------------------------- 1 | package archival 2 | 3 | import ( 4 | "go.temporal.io/server/common/quotas" 5 | "go.temporal.io/server/service/history/configs" 6 | "go.uber.org/fx" 7 | ) 8 | 9 | var Module = fx.Options( 10 | fx.Provide(NewArchiver), 11 | fx.Provide(func(config *configs.Config) quotas.RateLimiter { 12 | return quotas.NewDefaultOutgoingRateLimiter(quotas.RateFn(config.ArchivalBackendMaxRPS)) 13 | }), 14 | ) 15 | -------------------------------------------------------------------------------- /service/history/circuitbreakerpool/circuit_breaker_factory.go: -------------------------------------------------------------------------------- 1 | package circuitbreakerpool 2 | 3 | import ( 4 | "go.temporal.io/server/common/circuitbreaker" 5 | "go.temporal.io/server/common/collection" 6 | ) 7 | 8 | type CircuitBreakerPool[K comparable] struct { 9 | m *collection.OnceMap[K, circuitbreaker.TwoStepCircuitBreaker] 10 | } 11 | 12 | func (p *CircuitBreakerPool[K]) Get(key K) circuitbreaker.TwoStepCircuitBreaker { 13 | return p.m.Get(key) 14 | } 15 | 16 | func NewCircuitBreakerPool[K comparable]( 17 | constructor func(key K) circuitbreaker.TwoStepCircuitBreaker, 18 | ) *CircuitBreakerPool[K] { 19 | return &CircuitBreakerPool[K]{ 20 | m: collection.NewOnceMap(constructor), 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /service/history/events/fx.go: -------------------------------------------------------------------------------- 1 | package events 2 | 3 | import ( 4 | "go.temporal.io/server/common/log" 5 | "go.temporal.io/server/common/metrics" 6 | "go.temporal.io/server/common/persistence" 7 | "go.temporal.io/server/service/history/configs" 8 | "go.uber.org/fx" 9 | ) 10 | 11 | var Module = fx.Options( 12 | fx.Provide(func(executionManager persistence.ExecutionManager, config *configs.Config, handler metrics.Handler, logger log.Logger) Cache { 13 | return NewHostLevelEventsCache(executionManager, config, handler, logger, false) 14 | }), 15 | ) 16 | -------------------------------------------------------------------------------- /service/history/hsm/remote_methods.go: -------------------------------------------------------------------------------- 1 | package hsm 2 | 3 | // RemoteMethod can be defined for each state machine to handle external request, like RPCs, but as part of the HSM 4 | // framework. See RemoteExecutor for how to define the handler for remote methods. 5 | type RemoteMethod interface { 6 | // Name of the remote method. Must be unique per state machine. 7 | Name() string 8 | // SerializeOutput serializes output of the invocation to a byte array that is suitable for transport. 9 | SerializeOutput(output any) ([]byte, error) 10 | // DeserializeInput deserializes input from bytes that is then passed to the handler. 11 | DeserializeInput(data []byte) (any, error) 12 | } 13 | 14 | type remoteMethodDefinition struct { 15 | method RemoteMethod 16 | executor RemoteExecutor 17 | } 18 | -------------------------------------------------------------------------------- /service/history/interfaces/replication_stream.go: -------------------------------------------------------------------------------- 1 | package interfaces 2 | 3 | import ( 4 | "context" 5 | "time" 6 | 7 | replicationspb "go.temporal.io/server/api/replication/v1" 8 | "go.temporal.io/server/common/collection" 9 | "go.temporal.io/server/service/history/tasks" 10 | ) 11 | 12 | type ( 13 | ReplicationStream interface { 14 | SubscribeReplicationNotification(string) (<-chan struct{}, string) 15 | UnsubscribeReplicationNotification(string) 16 | ConvertReplicationTask( 17 | ctx context.Context, 18 | task tasks.Task, 19 | clusterID int32, 20 | ) (*replicationspb.ReplicationTask, error) 21 | 22 | GetReplicationTasksIter( 23 | ctx context.Context, 24 | pollingCluster string, 25 | minInclusiveTaskID int64, 26 | maxExclusiveTaskID int64, 27 | ) (collection.Iterator[tasks.Task], error) 28 | 29 | GetMaxReplicationTaskInfo() (int64, time.Time) 30 | } 31 | ) 32 | -------------------------------------------------------------------------------- /service/history/interfaces/transaction_policy.go: -------------------------------------------------------------------------------- 1 | package interfaces 2 | 3 | type TransactionPolicy int 4 | 5 | func (policy TransactionPolicy) Ptr() *TransactionPolicy { 6 | return &policy 7 | } 8 | 9 | const ( 10 | TransactionPolicyActive TransactionPolicy = 0 11 | TransactionPolicyPassive TransactionPolicy = 1 12 | ) 13 | -------------------------------------------------------------------------------- /service/history/ndc/constants.go: -------------------------------------------------------------------------------- 1 | package ndc 2 | 3 | const ( 4 | defaultPageSize = 100 5 | ) 6 | -------------------------------------------------------------------------------- /service/history/queues/action.go: -------------------------------------------------------------------------------- 1 | package queues 2 | 3 | type ( 4 | // Action is a set of operations that can be run on a ReaderGroup. 5 | // It is created and run by Mitigator upon receiving an Alert. 6 | Action interface { 7 | Name() string 8 | Run(*ReaderGroup) 9 | } 10 | ) 11 | -------------------------------------------------------------------------------- /service/history/queues/metrics_test.go: -------------------------------------------------------------------------------- 1 | package queues 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | "go.temporal.io/server/service/history/tasks" 8 | ) 9 | 10 | func TestGetArchivalTaskTypeTagValue(t *testing.T) { 11 | assert.Equal(t, "ArchivalTaskArchiveExecution", GetArchivalTaskTypeTagValue(&tasks.ArchiveExecutionTask{})) 12 | 13 | unknownTask := &tasks.CloseExecutionTask{} 14 | assert.Equal(t, unknownTask.GetType().String(), GetArchivalTaskTypeTagValue(unknownTask)) 15 | } 16 | -------------------------------------------------------------------------------- /service/history/queues/queue.go: -------------------------------------------------------------------------------- 1 | package queues 2 | 3 | import ( 4 | "go.temporal.io/server/service/history/tasks" 5 | ) 6 | 7 | //go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination queue_mock.go 8 | 9 | type ( 10 | Queue interface { 11 | Category() tasks.Category 12 | NotifyNewTasks(tasks []tasks.Task) 13 | FailoverNamespace(namespaceID string) 14 | Start() 15 | Stop() 16 | } 17 | ) 18 | -------------------------------------------------------------------------------- /service/history/replication/noop_dlq_writer.go: -------------------------------------------------------------------------------- 1 | package replication 2 | 3 | import "context" 4 | 5 | // NoopDLQWriter is a DLQWriter that does nothing. The zero value is a valid instance. 6 | type NoopDLQWriter struct { 7 | } 8 | 9 | var _ DLQWriter = NoopDLQWriter{} 10 | 11 | func (w NoopDLQWriter) WriteTaskToDLQ(context.Context, DLQWriteRequest) error { 12 | return nil 13 | } 14 | -------------------------------------------------------------------------------- /service/history/shard/engine_factory.go: -------------------------------------------------------------------------------- 1 | //go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination engine_factory_mock.go 2 | 3 | package shard 4 | 5 | import historyi "go.temporal.io/server/service/history/interfaces" 6 | 7 | type ( 8 | // EngineFactory is used to create an instance of sharded history engine 9 | EngineFactory interface { 10 | CreateEngine(context historyi.ShardContext) historyi.Engine 11 | } 12 | ) 13 | -------------------------------------------------------------------------------- /service/history/tasks/delete_workflow_execution_stage.go: -------------------------------------------------------------------------------- 1 | package tasks 2 | 3 | // DeleteWorkflowExecutionStage used by ContextImpl.DeleteWorkflowExecution to indicate progress stage. 4 | type DeleteWorkflowExecutionStage byte 5 | 6 | const ( 7 | DeleteWorkflowExecutionStageNone DeleteWorkflowExecutionStage = 0 8 | ) 9 | 10 | const ( 11 | DeleteWorkflowExecutionStageVisibility DeleteWorkflowExecutionStage = 1 << iota 12 | DeleteWorkflowExecutionStageCurrent 13 | DeleteWorkflowExecutionStageMutableState 14 | DeleteWorkflowExecutionStageHistory 15 | ) 16 | 17 | func (s *DeleteWorkflowExecutionStage) MarkProcessed(stage DeleteWorkflowExecutionStage) { 18 | if s == nil { 19 | return 20 | } 21 | *s |= stage 22 | } 23 | func (s *DeleteWorkflowExecutionStage) IsProcessed(stage DeleteWorkflowExecutionStage) bool { 24 | return s != nil && *s&stage == stage 25 | } 26 | -------------------------------------------------------------------------------- /service/history/workflow/cache/fx.go: -------------------------------------------------------------------------------- 1 | package cache 2 | 3 | import ( 4 | "go.temporal.io/server/common/log" 5 | "go.temporal.io/server/common/metrics" 6 | "go.temporal.io/server/service/history/configs" 7 | "go.uber.org/fx" 8 | ) 9 | 10 | var Module = fx.Options( 11 | fx.Provide(func(config *configs.Config, logger log.Logger, handler metrics.Handler) Cache { 12 | return NewHostLevelCache(config, logger, handler) 13 | }), 14 | ) 15 | -------------------------------------------------------------------------------- /service/history/workflow/fx.go: -------------------------------------------------------------------------------- 1 | package workflow 2 | 3 | import ( 4 | "go.uber.org/fx" 5 | ) 6 | 7 | var Module = fx.Options( 8 | fx.Provide(func() TaskGeneratorProvider { return defaultTaskGeneratorProvider }), 9 | fx.Invoke(populateTaskGeneratorProvider), 10 | fx.Provide(RelocatableAttributesFetcherProvider), 11 | fx.Invoke(RegisterStateMachine), 12 | ) 13 | -------------------------------------------------------------------------------- /service/history/workflow/matcher/errors.go: -------------------------------------------------------------------------------- 1 | package matcher 2 | 3 | import ( 4 | "fmt" 5 | 6 | "go.temporal.io/api/serviceerror" 7 | ) 8 | 9 | var ( 10 | malformedSqlQueryErrMessage = "malformed SQL query" 11 | notSupportedErrMessage = "operation is not supported" 12 | invalidExpressionErrMessage = "invalid expression" 13 | ) 14 | 15 | func NewMatcherError(format string, a ...any) error { 16 | message := fmt.Sprintf(format, a...) 17 | return serviceerror.NewInvalidArgument(message) 18 | } 19 | -------------------------------------------------------------------------------- /service/history/workflow/update/README.md: -------------------------------------------------------------------------------- 1 | See [docs/architecture/workflow-update.md](../../../../docs/architecture/workflow-update.md). 2 | -------------------------------------------------------------------------------- /service/history/workflow/update/abort_reason_test.go: -------------------------------------------------------------------------------- 1 | package update 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/require" 7 | ) 8 | 9 | func TestAbortReasonUpdateStateMatrix(t *testing.T) { 10 | for r := AbortReasonRegistryCleared; r < lastAbortReason; r++ { 11 | for st := stateCreated; st < lastState; st <<= 1 { 12 | fe, ok := reasonStateMatrix[reasonState{r: r, st: st}] 13 | // If new abort reason or state is added, this test will fail. 14 | // Do not modify the test but make sure to update the reasonStateMatrix. 15 | require.True(t, ok, "Missing combination: %v, %v. If new abort reason or state is added make sure to update the reasonStateMatrix", r, st) 16 | if fe.f != nil { 17 | require.Nil(t, fe.err) 18 | } 19 | if fe.err != nil { 20 | require.Nil(t, fe.f) 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /service/history/workflow/update/version.go: -------------------------------------------------------------------------------- 1 | package update 2 | 3 | import "go.temporal.io/server/common/protocol" 4 | 5 | const ProtocolV1 = protocol.Type("temporal.api.update.v1") 6 | -------------------------------------------------------------------------------- /service/history/workflow/workflow_task_state_machine_mock.go: -------------------------------------------------------------------------------- 1 | // Code generated by MockGen. DO NOT EDIT. 2 | // Source: workflow_task_state_machine.go 3 | // 4 | // Generated by this command: 5 | // 6 | // mockgen -package workflow -source workflow_task_state_machine.go -destination workflow_task_state_machine_mock.go 7 | // 8 | 9 | // Package workflow is a generated GoMock package. 10 | package workflow 11 | -------------------------------------------------------------------------------- /service/matching/README.md: -------------------------------------------------------------------------------- 1 | See [docs/architecture/matching-service.md](../../docs/architecture/matching-service.md). -------------------------------------------------------------------------------- /service/matching/deployment_util.go: -------------------------------------------------------------------------------- 1 | package matching 2 | 3 | import ( 4 | "go.temporal.io/api/serviceerror" 5 | ) 6 | 7 | var ( 8 | errDeploymentsNotAllowed = serviceerror.NewPermissionDenied("deployments are disabled on this namespace", "") 9 | // [cleanup-wv-pre-release] 10 | errMissingDeployment = serviceerror.NewInvalidArgument("missing deployment") 11 | 12 | errMissingDeploymentVersion = serviceerror.NewInvalidArgument("missing deployment version") 13 | ) 14 | -------------------------------------------------------------------------------- /service/worker/common/fx.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import "go.uber.org/fx" 4 | 5 | // WorkerComponentTag is the fx group tag for worker components. This is used to allow those who use Temporal as a 6 | // library to dynamically register their own system workers. Use this to annotate a worker component consumer. Use the 7 | // AnnotateWorkerComponentProvider function to annotate a worker component provider. 8 | const WorkerComponentTag = `group:"workerComponent"` 9 | 10 | // AnnotateWorkerComponentProvider converts a WorkerComponent factory function into an fx provider which will add the 11 | // WorkerComponentTag to the result. 12 | func AnnotateWorkerComponentProvider[T any](f func(t T) WorkerComponent) fx.Option { 13 | return fx.Provide(fx.Annotate(f, fx.ResultTags(WorkerComponentTag))) 14 | } 15 | -------------------------------------------------------------------------------- /service/worker/migration/catchup_workflow_test.go: -------------------------------------------------------------------------------- 1 | package migration 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/mock" 7 | "github.com/stretchr/testify/require" 8 | "go.temporal.io/sdk/testsuite" 9 | ) 10 | 11 | func TestCatchupWorkflow(t *testing.T) { 12 | testSuite := &testsuite.WorkflowTestSuite{} 13 | env := testSuite.NewTestWorkflowEnvironment() 14 | var a *activities 15 | 16 | env.OnActivity(a.WaitCatchup, mock.Anything, mock.Anything).Return(nil) 17 | 18 | env.ExecuteWorkflow(CatchupWorkflow, CatchUpParams{ 19 | Namespace: "test-ns", 20 | CatchupCluster: "test-remote", 21 | }) 22 | 23 | require.True(t, env.IsWorkflowCompleted()) 24 | require.NoError(t, env.GetWorkflowError()) 25 | env.AssertExpectations(t) 26 | } 27 | -------------------------------------------------------------------------------- /service/worker/scanner/executions/interfaces.go: -------------------------------------------------------------------------------- 1 | package executions 2 | 3 | import ( 4 | "context" 5 | 6 | persistencespb "go.temporal.io/server/api/persistence/v1" 7 | ) 8 | 9 | type ( 10 | MutableState struct { 11 | *persistencespb.WorkflowMutableState 12 | } 13 | 14 | MutableStateValidationResult struct { 15 | // type tag used for metrics 16 | failureType string 17 | // failure details used for logging 18 | failureDetails string 19 | } 20 | 21 | Validator interface { 22 | Validate(ctx context.Context, mutableState *MutableState) ([]MutableStateValidationResult, error) 23 | } 24 | ) 25 | -------------------------------------------------------------------------------- /service/worker/scheduler/testdata/replay_recent_actions_includes_status.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temporalio/temporal/70a4b914511bf7c77de91fc63581032a49810e18/service/worker/scheduler/testdata/replay_recent_actions_includes_status.json.gz -------------------------------------------------------------------------------- /service/worker/scheduler/testdata/replay_v1.19.1.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temporalio/temporal/70a4b914511bf7c77de91fc63581032a49810e18/service/worker/scheduler/testdata/replay_v1.19.1.json.gz -------------------------------------------------------------------------------- /service/worker/scheduler/testdata/replay_v1.20.4.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temporalio/temporal/70a4b914511bf7c77de91fc63581032a49810e18/service/worker/scheduler/testdata/replay_v1.20.4.json.gz -------------------------------------------------------------------------------- /service/worker/scheduler/testdata/replay_v1.21.3.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temporalio/temporal/70a4b914511bf7c77de91fc63581032a49810e18/service/worker/scheduler/testdata/replay_v1.21.3.json.gz -------------------------------------------------------------------------------- /service/worker/scheduler/testdata/replay_v1.21.5.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temporalio/temporal/70a4b914511bf7c77de91fc63581032a49810e18/service/worker/scheduler/testdata/replay_v1.21.5.json.gz -------------------------------------------------------------------------------- /service/worker/scheduler/testdata/replay_v1.22-pre.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temporalio/temporal/70a4b914511bf7c77de91fc63581032a49810e18/service/worker/scheduler/testdata/replay_v1.22-pre.json.gz -------------------------------------------------------------------------------- /service/worker/scheduler/testdata/replay_v1.22.0.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temporalio/temporal/70a4b914511bf7c77de91fc63581032a49810e18/service/worker/scheduler/testdata/replay_v1.22.0.json.gz -------------------------------------------------------------------------------- /service/worker/scheduler/testdata/replay_v1.23-pre.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temporalio/temporal/70a4b914511bf7c77de91fc63581032a49810e18/service/worker/scheduler/testdata/replay_v1.23-pre.json.gz -------------------------------------------------------------------------------- /service/worker/scheduler/testdata/replay_with_incremental_backfill.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temporalio/temporal/70a4b914511bf7c77de91fc63581032a49810e18/service/worker/scheduler/testdata/replay_with_incremental_backfill.json.gz -------------------------------------------------------------------------------- /service/worker/scheduler/testdata/replay_with_proto_cache.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temporalio/temporal/70a4b914511bf7c77de91fc63581032a49810e18/service/worker/scheduler/testdata/replay_with_proto_cache.json.gz -------------------------------------------------------------------------------- /service/worker/scheduler/testdata/replay_with_use_last_action.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temporalio/temporal/70a4b914511bf7c77de91fc63581032a49810e18/service/worker/scheduler/testdata/replay_with_use_last_action.json.gz -------------------------------------------------------------------------------- /service/worker/workerdeployment/replaytester/testdata/replay_deployment-workflow_initial.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temporalio/temporal/70a4b914511bf7c77de91fc63581032a49810e18/service/worker/workerdeployment/replaytester/testdata/replay_deployment-workflow_initial.json.gz -------------------------------------------------------------------------------- /service/worker/workerdeployment/replaytester/testdata/replay_deployment-workflow_maprange.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temporalio/temporal/70a4b914511bf7c77de91fc63581032a49810e18/service/worker/workerdeployment/replaytester/testdata/replay_deployment-workflow_maprange.json.gz -------------------------------------------------------------------------------- /service/worker/workerdeployment/replaytester/testdata/replay_worker_deployment_wf_1748123053.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temporalio/temporal/70a4b914511bf7c77de91fc63581032a49810e18/service/worker/workerdeployment/replaytester/testdata/replay_worker_deployment_wf_1748123053.json.gz -------------------------------------------------------------------------------- /service/worker/workerdeployment/replaytester/workflow.go: -------------------------------------------------------------------------------- 1 | package replaytester 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | "time" 7 | 8 | "go.temporal.io/sdk/workflow" 9 | ) 10 | 11 | func HelloWorld(ctx workflow.Context) (string, error) { 12 | workflow.GetLogger(ctx).Info("HelloWorld workflow started") 13 | 14 | // Compute a subject 15 | var subject string 16 | if err := workflow.ExecuteActivity(ctx, GetSubject).Get(ctx, &subject); err != nil { 17 | return "", err 18 | } 19 | 20 | // Sleep for a while 21 | if err := workflow.Sleep(ctx, 30*time.Second); err != nil { 22 | return "", err 23 | } 24 | 25 | // Return the greeting 26 | return fmt.Sprintf("Hello %s", subject), nil 27 | } 28 | 29 | func GetSubject(ctx context.Context) (string, error) { 30 | return "World", nil 31 | } 32 | -------------------------------------------------------------------------------- /temporal/interrupt.go: -------------------------------------------------------------------------------- 1 | package temporal 2 | 3 | import ( 4 | "os" 5 | "os/signal" 6 | "syscall" 7 | ) 8 | 9 | func InterruptCh() <-chan interface{} { 10 | c := make(chan os.Signal, 1) 11 | signal.Notify(c, os.Interrupt, syscall.SIGTERM) 12 | 13 | ret := make(chan interface{}, 1) 14 | go func() { 15 | s := <-c 16 | ret <- s 17 | close(ret) 18 | }() 19 | 20 | return ret 21 | } 22 | -------------------------------------------------------------------------------- /temporaltest/README.md: -------------------------------------------------------------------------------- 1 | The `temporaltest` package provides helpers for writing end to end tests against a real Temporal server which can be run via the `go test` command. 2 | 3 | ## Backwards Compatibility 4 | 5 | This package must not break Go API backwards compatibility in accordance with semantic versioning. One exception to this policy is the `WithBaseServerOptions` function, which may have breaking changes in any Temporal server release. 6 | 7 | The base configuration (eg. dynamic config values) and behavior of `TestServer` may also be modified in any release. Such changes should be for the purposes of improving performance or stability for testing scenarios. 8 | -------------------------------------------------------------------------------- /tests/testcore/constants.go: -------------------------------------------------------------------------------- 1 | package testcore 2 | 3 | import "time" 4 | 5 | const ( 6 | DefaultPageSize = 5 7 | PprofTestPort = 7000 8 | TlsCertCommonName = "my-common-name" 9 | ClientSuiteLimit = 10 10 | // TODO (alex): replace all sleeps with WaitForESToSettle with s.Eventually() 11 | WaitForESToSettle = 4 * time.Second // wait es shards for some time ensure data consistent 12 | ) 13 | -------------------------------------------------------------------------------- /tests/testcore/context.go: -------------------------------------------------------------------------------- 1 | package testcore 2 | 3 | import ( 4 | "context" 5 | "time" 6 | 7 | "go.temporal.io/server/common/debug" 8 | "go.temporal.io/server/common/rpc" 9 | ) 10 | 11 | // NewContext create new context with default timeout 90 seconds. 12 | func NewContext() context.Context { 13 | ctx, _ := rpc.NewContextWithTimeoutAndVersionHeaders(90 * time.Second * debug.TimeoutMultiplier) 14 | return ctx 15 | } 16 | -------------------------------------------------------------------------------- /tests/testutils/source_root_test.go: -------------------------------------------------------------------------------- 1 | package testutils 2 | 3 | import ( 4 | "strings" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/assert" 8 | ) 9 | 10 | func TestGetRepoRootDirectory(t *testing.T) { 11 | t.Parallel() 12 | t.Run("env var set", func(t *testing.T) { 13 | directory := GetRepoRootDirectory(WithGetenv(func(s string) string { 14 | assert.Equal(t, "TEMPORAL_ROOT", s) 15 | return "/tmp/temporal" 16 | })) 17 | assert.Equal(t, "/tmp/temporal", directory) 18 | }) 19 | 20 | t.Run("env var not set", func(t *testing.T) { 21 | directory := GetRepoRootDirectory(WithGetenv(func(s string) string { 22 | return "" 23 | })) 24 | assert.True( 25 | t, 26 | strings.HasSuffix(directory, "temporal") || strings.HasSuffix(directory, "temporal/"), 27 | directory, 28 | ) 29 | }) 30 | } 31 | -------------------------------------------------------------------------------- /tools/common/schema/version.go: -------------------------------------------------------------------------------- 1 | package schema 2 | 3 | import ( 4 | "github.com/blang/semver/v4" 5 | ) 6 | 7 | // normalizeVersionString take a valid semver string and returns the input as-is with the 'v' prefix removed if present 8 | func normalizeVersionString(ver string) (string, error) { 9 | if _, err := semver.ParseTolerant(ver); err != nil { 10 | return "", err 11 | } 12 | if ver[0] == 'v' { 13 | return ver[1:], nil 14 | } 15 | return ver, nil 16 | } 17 | -------------------------------------------------------------------------------- /tools/tdbg/tdbgtest/app.go: -------------------------------------------------------------------------------- 1 | package tdbgtest 2 | 3 | import ( 4 | "github.com/urfave/cli/v2" 5 | "go.temporal.io/server/tools/tdbg" 6 | ) 7 | 8 | // NewCliApp is a wrapper around [tdbg.NewCliApp] that sets the [cli.App.ExitErrHandler] to a no-op function. 9 | func NewCliApp(opts ...tdbg.Option) *cli.App { 10 | app := tdbg.NewCliApp(opts...) 11 | app.ExitErrHandler = func(context *cli.Context, err error) {} 12 | return app 13 | } 14 | -------------------------------------------------------------------------------- /tools/tdbg/testdata/cert.pem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temporalio/temporal/70a4b914511bf7c77de91fc63581032a49810e18/tools/tdbg/testdata/cert.pem -------------------------------------------------------------------------------- /tools/testrunner/log_test.go: -------------------------------------------------------------------------------- 1 | package testrunner 2 | 3 | import ( 4 | "os" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/require" 8 | ) 9 | 10 | func TestParseTestTimeouts(t *testing.T) { 11 | logInput, err := os.ReadFile("testdata/timeout-input.log") 12 | require.NoError(t, err) 13 | logOutput, err := os.ReadFile("testdata/timeout-output.log") 14 | require.NoError(t, err) 15 | 16 | stacktrace, tests := parseTestTimeouts(string(logInput)) 17 | require.Equal(t, []string{ 18 | "TestActivityApiResetClientTestSuite", 19 | "TestNDCFuncTestSuite", 20 | "TestActivityApiStateReplicationSuite", 21 | }, tests) 22 | require.Equal(t, string(logOutput), stacktrace) 23 | } 24 | -------------------------------------------------------------------------------- /tools/testrunner/testdata/junit-timeout-output.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /tools/tests/cql_cli_test.go: -------------------------------------------------------------------------------- 1 | package tests 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/suite" 7 | "go.temporal.io/server/tools/cassandra" 8 | ) 9 | 10 | func TestCQLClientTestSuite(t *testing.T) { 11 | suite.Run(t, new(cassandra.CQLClientTestSuite)) 12 | } 13 | 14 | func TestSetupCQLSchemaTestSuite(t *testing.T) { 15 | suite.Run(t, new(cassandra.SetupSchemaTestSuite)) 16 | } 17 | 18 | func TestUpdateCQLSchemaTestSuite(t *testing.T) { 19 | suite.Run(t, new(cassandra.UpdateSchemaTestSuite)) 20 | } 21 | 22 | func TestVersionTestSuite(t *testing.T) { 23 | suite.Run(t, new(cassandra.VersionTestSuite)) 24 | } 25 | --------------------------------------------------------------------------------