Feature flag rollout plan for org selective sync in Staging
## Summary This issue is to roll out and measure the impact of enabling Geo features (in 3 stages, initially only on staging): * Phase 1 rollout - enable metrics worker and checksumming on a small table & measure impact * Phase 2 rollout - enable checksumming on medium sized tables & measure impact * Phase 3 rollout - enable checksumming on largest remaining tables & measure impact Originally discussed during the Org Mover sync on 24th Oct 2024 - (see [point 3 in the notes here](https://docs.google.com/document/d/1bScsA2LmIfiLJtDdq79EdwTSGFdQxlUYxHjOtotU3pY/edit?tab=t.0)) After that, we can begin rolling out on production. ## Owners - Most appropriate Slack channel to reach out to: `#f_org_mover` / `#geo_lounge` - Best individuals to reach out to: `@s_murray` / `@mkozono` / `@dbalexandre` ## Metrics to measure Key metrics we want to measure and where to monitor these:- * Verification State Table Sizes - https://dashboards.gitlab.net/d/fdzkd1y2qpg5cf/checksumming?orgId=1 * Any other errors/increase visible in https://dashboards.gitlab.net - specifically: * cpu saturation, disk IO saturation, saturation of the sidekiq worker pool (or potentially the pgbouncer pool backing it) if too many jobs start, and long running vacuums ## Staging Table Sizes Staging table sizes are recorded below. We also have this dashboard set up to display the verification state table sizes - https://dashboards.gitlab.net/d/fdzkd1y2qpg5cf/checksumming?orgId=1 | Replicable | Source Table | Source Table Size | Verification State Table | Verification Table Size (Before) | Verification Table Size (After) | Source Table Row count | - | |------------|-------|------------|--------------------------|----------------------------------|----------------------------------|----------------------------------|--------------------------------| | MergeRequestDiff | merge_request_diffs | 2260 MB | merge_request_diff_details | 752 kB | | 9759196 | X | | ProjectRepository | projects | 1423 MB | project_states | 704 kB | | 3341788 | X | | LfsObject | lfs_objects | 555 MB | lfs_object_states | 358 MB | | 2843629 | X | | Upload | uploads | 295 MB | upload_states | 90 MB | | 1441495 | X | | DesignManagement::Repository | design_management_repositories | 223 MB | design_management_repository_states | 8192 bytes | | 3335232 | X | | Projects::WikiRepository | project_wiki_repositories | 202 MB | wiki_repository_states | 1072 kB | | 3341642 | X | | SnippetRepository | snippet_repositories | 18 MB | snippet_repositories | 18 MB | | 49051 | X | | Packages::PackageFile | packages_package_files | 5528 kB | packages_package_files | 5528 kB | | 1093 | X | | ContainerRepository | container_repositories | 5712 kB | container_repository_states | 8192 bytes | | 28434 | X | | PagesDeployment | pages_deployments | 4736 kB | pages_deployment_states | N/A | | 28593 | X | | GroupWikiRepository | group_wiki_repositories | 352 kB | group_wiki_repository_states | 16 kB | | 294 | X | | DependencyProxy::Blob | dependency_proxy_blobs | 272 kB | dependency_proxy_blob_states | N/A | | 1074 | X | | DependencyProxy::Manifest | dependency_proxy_manifests | 40 kB | dependency_proxy_manifest_states | N/A | | 1074 | X | | Terraform::StateVersion | terraform_state_versions | 8192 bytes | terraform_state_versions | 8192 bytes | | 22 | X | | Ci::JobArtifact | ci_job_artifacts | N/A | ci_job_artifact_states | 358 MB | | 2257449 | X | | Ci::PipelineArtifact | ci_pipeline_artifacts | N/A | ci_pipeline_artifacts | N/A | | 37 | X | | Ci::SecureFile | ci_secure_files | N/A | ci_secure_file_states | N/A | | 842 | X | ## Rollout Steps (staging) Note: Please make sure to run the chatops commands in the Slack channel that gets impacted by the command. ### Phase 1 - Enable metrics worker and checksumming on a small table - [x] Enable the Geo::MetricsUpdateWorker feature with `/chatops run feature set geo_metrics_update_worker true --staging` - **Note:** Enabled at 1200 UTC - 12th Nov 2024 - [x] Monitor that the error rates did not increase - [x] Enable the force primary checksumming feature flag on small tables - [x] `/chatops run feature set geo_ci_secure_file_force_primary_checksumming true --staging` - **Note:** Enabled at 1400 UTC - 12th Nov 2024 - [ ] `/chatops run feature set geo_packages_nuget_symbol_force_primary_checksumming true --staging` - [x] Monitor that the error rates did not increase ### Phase 2 - Enable checksumming on remaining medium sized tables - [x] Enable the force primary checksumming feature flag on medium sized tables - [x] `/chatops run feature set geo_dependency_proxy_blob_force_primary_checksumming true --staging` - [x] `/chatops run feature set geo_dependency_proxy_manifest_force_primary_checksumming true --staging` - [x] `/chatops run feature set geo_group_wiki_repository_force_primary_checksumming true --staging` - [x] `/chatops run feature set geo_pages_deployment_force_primary_checksumming true --staging` - [x] `/chatops run feature set geo_pipeline_artifact_force_primary_checksumming true --staging` - [x] `/chatops run feature set geo_terraform_state_version_force_primary_checksumming true --staging` - [x] Monitor that error rates did not increase - [x] Monitor impact on metrics defined in the monitoring section for a few hours ### Phase 3 - Enable checksumming on the largest tables - [x] Enable the force primary checksumming feature flag on largest tables - [x] `/chatops run feature set geo_package_file_force_primary_checksumming true --staging` - [x] `/chatops run feature set geo_snippet_repository_force_primary_checksumming true --staging` - [x] `/chatops run feature set geo_container_repository_force_primary_checksumming true --staging` - [x] `/chatops run feature set geo_project_wiki_repository_force_primary_checksumming true --staging` - [x] `/chatops run feature set geo_design_management_repository_force_primary_checksumming true --staging` - [x] `/chatops run feature set geo_upload_force_primary_checksumming true --staging` - [x] `/chatops run feature set geo_lfs_object_force_primary_checksumming true --staging` - [x] `/chatops run feature set geo_project_repository_force_primary_checksumming true --staging` - [x] `/chatops run feature set geo_merge_request_diff_force_primary_checksumming true --staging` - [x] `/chatops run feature set geo_job_artifact_force_primary_checksumming true --staging` - [x] `/chatops run feature set geo_packages_helm_metadata_cache_force_primary_checksumming true --staging` - [x] Monitor that error rates did not increase - [x] Monitor impact on metrics defined in the monitoring section for a few hours ## Rollback Steps - [ ] Disable the feature flags on staging: ``` ### Phase 1 /chatops run feature set geo_metrics_update_worker false --staging /chatops run feature set geo_ci_secure_file_force_primary_checksumming false --staging ### Phase 2 /chatops run feature set geo_dependency_proxy_blob_force_primary_checksumming false --staging /chatops run feature set geo_dependency_proxy_manifest_force_primary_checksumming false --staging /chatops run feature set geo_group_wiki_repository_force_primary_checksumming false --staging /chatops run feature set geo_pages_deployment_force_primary_checksumming false --staging /chatops run feature set geo_pipeline_artifact_force_primary_checksumming false --staging /chatops run feature set geo_terraform_state_version_force_primary_checksumming false --staging ### Phase 3 /chatops run feature set geo_snippet_repository_force_primary_checksumming false --staging /chatops run feature set geo_project_wiki_repository_force_primary_checksumming false --staging /chatops run feature set geo_design_management_repository_force_primary_checksumming false --staging /chatops run feature set geo_container_repository_force_primary_checksumming false --staging /chatops run feature set geo_package_file_force_primary_checksumming false --staging /chatops run feature set geo_upload_force_primary_checksumming false --staging /chatops run feature set geo_lfs_object_force_primary_checksumming false --staging /chatops run feature set geo_project_repository_force_primary_checksumming false --staging /chatops run feature set geo_merge_request_diff_force_primary_checksumming false --staging /chatops run feature set geo_job_artifact_force_primary_checksumming false --staging /chatops run feature set geo_packages_helm_metadata_cache_force_primary_checksumming false --staging ``` #### Data rollback (optional) Optional step to remove any data created during the process. ```ruby # Remove data created by the metrics worker GeoNodeStatus.connection.truncate(GeoNodeStatus.table_name) # Remove verification state data on separate _state tables Geo::ProjectState.connection.truncate(Geo::ProjectState.table-name) Geo::ProjectRepositoryState.connection.truncate(Geo::ProjectRepositoryState.table_name) Geo::LfsObjectState.connection.truncate(Geo::LfsObjectState.table_name) Geo::UploadState.connection.truncate(Geo::UploadState.table_name) Geo::DesignManagementRepositoryState.connection.truncate(Geo::DesignManagementRepositoryState.table_name) Geo::WikiRepositoryState.connection.truncate(Geo::WikiRepositoryState.table_name) Geo::ContainerRepositoryState.connection.truncate(Geo::ContainerRepositoryState.table_name) Geo::PagesDeploymentState.connection.truncate(Geo::PagesDeploymentState.table_name) Geo::GroupWikiRepositoryState.connection.truncate(Geo::GroupWikiRepositoryState.table_name) Geo::DependencyProxyBlobState.connection.truncate(Geo::DependencyProxyBlobState.table_name) Geo::DependencyProxyManifestState.connection.truncate(Geo::DependencyProxyManifestState.table_name) Geo::JobArtifactState.connection.truncate(Geo::JobArtifactState.table_name) Geo::CiSecureFileState.connection.truncate(Ci::SecureFileState.table_name) Geo::PackagesNugetSymbolState.connection.truncate(Geo::PackagesNugetSymbolState.table_name) Geo::PackagesHelmMetadataCacheState.connection.truncate(Geo::PackagesHelmMetadataCacheState.table_name) # Update/remove verification state data added to existing source tables # (Probably not worth it, and can time out on large tables) MergeRequestDiffDetail.update_all( verification_retry_at: nil, verified_at: nil, verification_retry_count: nil, verification_checksum: nil, verification_failure: nil, verification_state: 0, verification_started_at: nil ) SnippetRepository.update_all( verification_retry_at: nil, verified_at: nil, verification_retry_count: nil, verification_checksum: nil, verification_failure: nil, verification_state: 0, verification_started_at: nil ) Packages::PackageFile.update_all( verification_retry_at: nil, verified_at: nil, verification_retry_count: nil, verification_checksum: nil, verification_failure: nil, verification_state: 0, verification_started_at: nil ) Terraform::StateVersion.update_all( verification_retry_at: nil, verified_at: nil, verification_retry_count: nil, verification_checksum: nil, verification_failure: nil, verification_state: 0, verification_started_at: nil ) Ci::PipelineArtifact.update_all( verification_retry_at: nil, verified_at: nil, verification_retry_count: nil, verification_checksum: nil, verification_failure: nil, verification_state: 0, verification_started_at: nil ) ``` ### Rollout Summary #### Phase 1 summary (complete) * `geo_metrics_update_worker` - enabled at 1200 UTC - 12th Nov 2024 * No visible increase in errors that I can see ([Sidekiq Worker Detail chart for this worker](https://dashboards.gitlab.net/d/sidekiq-worker-detail/sidekiq3a-worker-detail?from=now-24h&to=now&timezone=utc&var-PROMETHEUS_DS=mimir-gitlab-gstg&var-environment=gstg&var-stage=main&var-worker=Geo::MetricsUpdateWorker)) * I'm also not seeing a huge variation in any of the patroni/sidekiq dashboard graphs. There was a deployment which happened just after this FF was turned on and these seem to normally cause a spike in metrics - not sure if there's a good way to filter out the noise caused by deploys? Maybe there's a way to get the query stats for just the Geo Metrics Worker by itself from grafana? * `geo_ci_secure_file_force_primary_checksumming` - enabled at 1400 UTC - 12th Nov 2024 * No visible increase in errors that I can see * `842` rows added to the `ci_secure_file_states` table (as expected since it's a 1-1 link to the source table) * Table size increase by `558kb` * [Checksumming seems to have completed](https://dashboards.gitlab.net/d/fdzkd1y2qpg5cf/checksumming?orgId=1) in \< 10 seconds given the small table size #### Phase 2 summary (WIP) * `geo_dependency_proxy_blob_force_primary_checksumming` - enabled at 1130 UTC - 13th Nov 2024 * No visible increase in errors that I can see * 1074 existing records updated * State table size increase by `795kb` to `860kb` * 7 verification failures (<1%) noted with the message `Error during verification: File is not checksummable` * `geo_dependency_proxy_manifest_force_primary_checksumming` - enabled at 1200 UTC - 13th Nov 2024 * No visible increase in errors that I can see * 74 existing records updated * State table size increase by `99kb` to `164kb` * `geo_group_wiki_repository_force_primary_checksumming` - enabled at 1235 UTC - 13th Nov 2024 * No visible increase in errors that I can see * 306 existing records updated * State table size increase by `115kb` to `262kb` * `geo_pages_deployment_force_primary_checksumming` - enabled at 1300 UTC - 13th Nov 2024 * No visible increase in errors that I can see * 27968 existing records updated * State table size increase by `12270kb` to `12400kb` * `geo_pipeline_artifact_force_primary_checksumming` - enabled at 1330 UTC - 13th Nov 2024 * No visible increase in errors that I can see * 37 existing records updated * State table size increase by `80kb` to `80kb` * `geo_terraform_state_version_force_primary_checksumming` - enabled at 1400 UTC - 13th Nov 2024 * No visible increase in errors that I can see * 22 existing records updated * State table size increase by `122.9kb` to `131kb` * 4 verification failures (18%) noted with the message `Error during verification: File is not checksummable` ### Grafana Screenshots <details> <summary>Checksumming</summary> geo_ci_secure_file_force_primary_checksumming ![Screenshot_2024-11-15_at_13.59.52](/uploads/c6fbece4b2552b5681b1f71bcde53014/Screenshot_2024-11-15_at_13.59.52.png) geo_dependency_proxy_blob_force_primary_checksumming ![Screenshot_2024-11-15_at_14.02.04](/uploads/8180a68bbb82c6f1825eee6a108e4922/Screenshot_2024-11-15_at_14.02.04.png) geo_dependency_proxy_manifest_force_primary_checksumming ![Screenshot_2024-11-15_at_14.02.35](/uploads/12e796b55295951abbc72152690d3371/Screenshot_2024-11-15_at_14.02.35.png) geo_group_wiki_repository_force_primary_checksumming ![Screenshot_2024-11-15_at_14.03.06](/uploads/6c2690da066337d21b553866ab928d21/Screenshot_2024-11-15_at_14.03.06.png) geo_pages_deployment_force_primary_checksumming ![Screenshot_2024-11-15_at_14.03.37](/uploads/f742e227db77e72f0007c40225a68683/Screenshot_2024-11-15_at_14.03.37.png) geo_terraform_state_version_force_primary_checksumming ![Screenshot_2024-11-15_at_14.05.43](/uploads/fcf4befb4197b5e0a181bb91a1270471/Screenshot_2024-11-15_at_14.05.43.png) </details> <details> <summary>Patroni</summary> geo_ci_secure_file_force_primary_checksumming ![Screenshot_2024-11-18_at_17.15.09](/uploads/73160f5849b0e6f17a57d543f9d62ca5/Screenshot_2024-11-18_at_17.15.09.png) ![Screenshot_2024-11-18_at_17.15.20](/uploads/d83d3b482990e9831a9b7c765f29d2db/Screenshot_2024-11-18_at_17.15.20.png) ![Screenshot_2024-11-18_at_17.15.31](/uploads/ace04e35072043ec27167c84a37535bb/Screenshot_2024-11-18_at_17.15.31.png) ![Screenshot_2024-11-18_at_17.15.42](/uploads/df2c5786c8d0455bd6241c1086fe325d/Screenshot_2024-11-18_at_17.15.42.png) ![Screenshot_2024-11-18_at_17.15.52](/uploads/ab8eb7a772db9f91149c7e4868886612/Screenshot_2024-11-18_at_17.15.52.png) ![Screenshot_2024-11-18_at_17.16.04](/uploads/d49074fcdd75dff95a30f8ccb00cbe9a/Screenshot_2024-11-18_at_17.16.04.png) geo_dependency_proxy_blob_force_primary_checksumming ![Screenshot_2024-11-18_at_17.21.37](/uploads/05fb15ad5059c7df934ddbc7a4a14733/Screenshot_2024-11-18_at_17.21.37.png) ![Screenshot_2024-11-18_at_17.21.46](/uploads/87041cdcfb0e0db5fd4d068fee00b14f/Screenshot_2024-11-18_at_17.21.46.png) ![Screenshot_2024-11-18_at_17.21.54](/uploads/ebf8f8430013bb27361bcd1e16d11beb/Screenshot_2024-11-18_at_17.21.54.png) ![Screenshot_2024-11-18_at_17.22.03](/uploads/c37867fb3fc5f97b52f1c103c243692e/Screenshot_2024-11-18_at_17.22.03.png) ![Screenshot_2024-11-18_at_17.22.12](/uploads/9cf31a86882ca92b6a1395f94a0c6ba7/Screenshot_2024-11-18_at_17.22.12.png) ![Screenshot_2024-11-18_at_17.22.32](/uploads/6fe84e3002d0df592c1f77bc97292182/Screenshot_2024-11-18_at_17.22.32.png) geo_dependency_proxy_manifest_force_primary_checksumming ![Screenshot_2024-11-18_at_17.23.40](/uploads/ac7718dc6cf872fc32c600187d023cd7/Screenshot_2024-11-18_at_17.23.40.png) ![Screenshot_2024-11-18_at_17.23.49](/uploads/adecfc953574899a4d5edaa7eebc00db/Screenshot_2024-11-18_at_17.23.49.png) ![Screenshot_2024-11-18_at_17.23.58](/uploads/116d9acd1875dc065ab7ea67e46be5be/Screenshot_2024-11-18_at_17.23.58.png) ![Screenshot_2024-11-18_at_17.24.09](/uploads/42cd697cbe3041780c13ef4a9b453bd8/Screenshot_2024-11-18_at_17.24.09.png) ![Screenshot_2024-11-18_at_17.24.17](/uploads/2852f48a13066f341799095c9519d0a8/Screenshot_2024-11-18_at_17.24.17.png) ![Screenshot_2024-11-18_at_17.24.29](/uploads/cf2662eae615f11a9ccbf81f68e9984c/Screenshot_2024-11-18_at_17.24.29.png) geo_group_wiki_repository_force_primary_checksumming ![Screenshot_2024-11-18_at_17.26.19](/uploads/37f426eb06c50e0532c2b5350b02f0a2/Screenshot_2024-11-18_at_17.26.19.png) ![Screenshot_2024-11-18_at_17.26.28](/uploads/4f140dcf59c13fece702d430589d7a6e/Screenshot_2024-11-18_at_17.26.28.png) ![Screenshot_2024-11-18_at_17.26.36](/uploads/b8fc5cfe00690b4e7b45eeb4b41dbbae/Screenshot_2024-11-18_at_17.26.36.png) ![Screenshot_2024-11-18_at_17.26.45](/uploads/ec57ac688865ba04cacb24acf288682b/Screenshot_2024-11-18_at_17.26.45.png) ![Screenshot_2024-11-18_at_17.26.54](/uploads/b625e4e7b375b95c6350dd4f8867fe3d/Screenshot_2024-11-18_at_17.26.54.png) ![Screenshot_2024-11-18_at_17.27.03](/uploads/9fe22cddc23a87725773a5f68a1418d8/Screenshot_2024-11-18_at_17.27.03.png) geo_pages_deployment_force_primary_checksumming ![Screenshot_2024-11-18_at_17.29.19](/uploads/dac26f43653d053578a43c205b0bce97/Screenshot_2024-11-18_at_17.29.19.png) ![Screenshot_2024-11-18_at_17.30.32](/uploads/d54adec3a095307d7dccb5fe7c2c000e/Screenshot_2024-11-18_at_17.30.32.png) ![Screenshot_2024-11-18_at_17.30.41](/uploads/4100fbead2de3fb1c831ecbc5d149812/Screenshot_2024-11-18_at_17.30.41.png) ![Screenshot_2024-11-18_at_17.30.48](/uploads/ea3e4073ac5500223103d22835d19959/Screenshot_2024-11-18_at_17.30.48.png) ![Screenshot_2024-11-18_at_17.30.55](/uploads/b793c8c87354f3a250ddcfdd3b5234e0/Screenshot_2024-11-18_at_17.30.55.png) ![Screenshot_2024-11-18_at_17.31.07](/uploads/d18b549990d65bca225c11eeb1af6ed7/Screenshot_2024-11-18_at_17.31.07.png) geo_terraform_state_version_force_primary_checksumming ![Screenshot_2024-11-18_at_17.32.00](/uploads/556175d8492161f54733cb1d5a17dff4/Screenshot_2024-11-18_at_17.32.00.png) ![Screenshot_2024-11-18_at_17.32.07](/uploads/047bb15cf3c65e6e61be0acb2f025470/Screenshot_2024-11-18_at_17.32.07.png) ![Screenshot_2024-11-18_at_17.32.14](/uploads/9e47e34c52cf689860ab9f0a53b0feb2/Screenshot_2024-11-18_at_17.32.14.png) ![Screenshot_2024-11-18_at_17.32.21](/uploads/0adebfb6dd4c3677f453f5245a4af5fb/Screenshot_2024-11-18_at_17.32.21.png) ![Screenshot_2024-11-18_at_17.32.30](/uploads/7dd4e780dbae13fcaae9a38d593af8b8/Screenshot_2024-11-18_at_17.32.30.png) ![Screenshot_2024-11-18_at_17.32.41](/uploads/970c02f8986242df612dee5e6877d502/Screenshot_2024-11-18_at_17.32.41.png) </details> cc @mkozono @nsilva5 @luciezhao @sranasinghe @dbalexandre
epic