Class: Ci::Partition
Constant Summary
collapse
- INITIAL_PARTITION_VALUE =
100
- LAST_STATIC_PARTITION_VALUE =
102
- DEFAULT_PARTITION_VALUES =
(INITIAL_PARTITION_VALUE..LAST_STATIC_PARTITION_VALUE).to_a.freeze
ApplicationRecord::MAX_PLUCK
HasCheckConstraints::NOT_NULL_CHECK_PATTERN
ResetOnColumnErrors::MAX_RESET_PERIOD
Class Method Summary
collapse
Instance Method Summary
collapse
model_name, table_name_prefix
===, cached_column_list, #create_or_load_association, current_transaction, declarative_enum, default_select_columns, delete_all_returning, #deleted_from_database?, id_in, id_not_in, iid_in, nullable_column?, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
#sharding_organization
#reset_on_union_error, #reset_on_unknown_attribute_error
#serializable_hash
Class Method Details
.create_next! ⇒ Object
49
50
51
|
# File 'app/models/ci/partition.rb', line 49
def create_next!
create!(id: last.id.next, status: statuses[:preparing])
end
|
.current ⇒ Object
45
46
47
|
# File 'app/models/ci/partition.rb', line 45
def current
with_status(:current).first
end
|
.next_available(partition_id) ⇒ Object
53
54
55
56
57
58
59
|
# File 'app/models/ci/partition.rb', line 53
def next_available(partition_id)
Ci::Partition
.with_status(:ready)
.id_after(partition_id)
.order(id: :asc)
.first
end
|
.provisioning(partition_id) ⇒ Object
61
62
63
64
65
66
|
# File 'app/models/ci/partition.rb', line 61
def provisioning(partition_id)
Ci::Partition
.id_after(partition_id)
.order(id: :asc)
.first
end
|
.statuses ⇒ Object
41
42
43
|
# File 'app/models/ci/partition.rb', line 41
def statuses
@statuses ||= state_machines[:status].states.to_h { |state| [state.name, state.value] }.freeze
end
|
Instance Method Details
#above_threshold?(threshold = ::Gitlab::CurrentSettings.ci_partitions_size_limit) ⇒ Boolean
69
70
71
72
73
74
75
76
77
|
# File 'app/models/ci/partition.rb', line 69
def above_threshold?(threshold = ::Gitlab::CurrentSettings.ci_partitions_size_limit)
with_ci_connection do
Gitlab::Database::PostgresPartition
.with_parent_tables(parent_table_names)
.with_list_constraint(id)
.above_threshold(threshold)
.exists?
end
end
|
#all_partitions_exist? ⇒ Boolean
79
80
81
82
83
84
85
86
|
# File 'app/models/ci/partition.rb', line 79
def all_partitions_exist?
with_ci_connection do
Gitlab::Database::PostgresPartition
.with_parent_tables(parent_table_names)
.with_list_constraint(id)
.count == parent_table_names.size
end
end
|