IntRangeStrategy does not implement analyze_interval
Summary
The recently added IntRangeStrategy
does not have analyze_interval
attribute, which results in an error when syncing partitions.
Steps to reproduce
- Execute
tail -f log/application_json.log | jq 'select(.severity=="ERROR")'
. - In a new terminal execute
bundle exec rails gitlab:db:create_dynamic_partitions
. - Back in the first terminal we'll see the following error
{ "severity": "ERROR", "time": "2024-04-15T21:50:49.286Z", "message": "Failed to create / detach partition(s)", "table_name": "merge_request_diff_commits_b5377a7a34", "exception_class": "NoMethodError", "exception_message": "undefined method `analyze_interval' for #<Gitlab::Database::Partitioning::IntRangeStrategy:0x000000017847e2e8 @model=#<Class:0x00000001645f53d8>(authored_date: datetime, committed_date: datetime, sha: binary, message: text, trailers: jsonb, commit_author_id: integer, committer_id: integer, merge_request_diff_id: integer, relative_order: integer), @partitioning_key=:merge_request_diff_id, @partition_size=200000000>", "connection_name": "main" } { "severity": "ERROR", "time": "2024-04-15T21:50:49.506Z", "message": "Failed to create / detach partition(s)", "table_name": "merge_request_diff_commits_b5377a7a34", "exception_class": "NoMethodError", "exception_message": "undefined method `analyze_interval' for #<Gitlab::Database::Partitioning::IntRangeStrategy:0x000000017847e2e8 @model=#<Class:0x00000001645f53d8>(authored_date: datetime, committed_date: datetime, sha: binary, message: text, trailers: jsonb, commit_author_id: integer, committer_id: integer, merge_request_diff_id: integer, relative_order: integer), @partitioning_key=:merge_request_diff_id, @partition_size=200000000>", "connection_name": "ci" }
What is the current bug behavior?
Syncing partitions for models using IntRangeStrategy
fails.
What is the expected correct behavior?
Partitions for models using IntRangeStrategy
should succeed.
Relevant logs and/or screenshots
Reported in #451767 (comment 1863215307)