Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ GEM
raabro (~> 1.4)
globalid (1.3.0)
activesupport (>= 6.1)
good_job (4.13.1)
good_job (4.18.2)
activejob (>= 6.1.0)
activerecord (>= 6.1.0)
concurrent-ruby (>= 1.3.1)
Expand Down Expand Up @@ -161,8 +161,9 @@ GEM
mini_magick (>= 4.9.5, < 6)
ruby-vips (>= 2.0.17, < 3)
io-console (0.8.2)
irb (1.16.0)
irb (1.18.0)
pp (>= 0.6.0)
prism (>= 1.3.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.19.5)
Expand Down Expand Up @@ -205,7 +206,7 @@ GEM
net-smtp (0.5.1)
net-protocol
nio4r (2.7.5)
nokogiri (1.18.10)
nokogiri (1.19.3)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
open3 (0.2.1)
Expand Down Expand Up @@ -238,7 +239,7 @@ GEM
raabro (1.4.0)
racc (1.8.1)
rack (3.2.6)
rack-session (2.1.1)
rack-session (2.1.2)
base64 (>= 0.1.0)
rack (>= 3.0.0)
rack-test (2.2.0)
Expand All @@ -263,8 +264,8 @@ GEM
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.2)
loofah (~> 2.21)
rails-html-sanitizer (1.7.0)
loofah (~> 2.25)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
railties (8.1.3)
actionpack (= 8.1.3)
Expand Down Expand Up @@ -381,8 +382,8 @@ GEM
simplecov_json_formatter (0.1.4)
stringio (3.2.0)
test-prof (1.6.1)
thor (1.4.0)
timeout (0.6.0)
thor (1.5.0)
timeout (0.6.1)
triangulum (0.14.3)
base64 (~> 0.3)
json (~> 2.19)
Expand Down
7 changes: 7 additions & 0 deletions db/migrate/20260517180943_add_lock_type_to_good_jobs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class AddLockTypeToGoodJobs < Code0::ZeroTrack::Database::Migration[1.0]
def change
add_column :good_jobs, :lock_type, :integer, limit: 2 unless column_exists?(:good_jobs, :lock_type)
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

class AddIndexGoodJobsForCandidateDequeueUnlocked < Code0::ZeroTrack::Database::Migration[1.0]
disable_ddl_transaction!

def change
add_index :good_jobs, %i[priority scheduled_at id],
name: :index_good_jobs_for_candidate_dequeue_unlocked,
order: { priority: 'ASC NULLS LAST', scheduled_at: :asc, id: :asc },
where: 'finished_at IS NULL AND locked_by_id IS NULL',
algorithm: :concurrently,
if_not_exists: true
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# frozen_string_literal: true

class AddIndexGoodJobsPriorityScheduledAt < Code0::ZeroTrack::Database::Migration[1.0]
disable_ddl_transaction!

def change
reversible do |dir|
dir.up do
# Ensure this incremental update migration is idempotent
# with monolithic install migration.
return if connection.index_name_exists?(:good_jobs, 'index_good_jobs_on_priority_scheduled_at_unfinished') &&
connection.index_name_exists?(:good_jobs,
'index_good_jobs_on_queue_name_priority_scheduled_at_unfinished')
end
end

add_index :good_jobs, %i[priority scheduled_at id],
where: 'finished_at IS NULL', name: 'index_good_jobs_on_priority_scheduled_at_unfinished',
algorithm: :concurrently
add_index :good_jobs, %i[queue_name scheduled_at id],
where: 'finished_at IS NULL', name: 'index_good_jobs_on_queue_name_priority_scheduled_at_unfinished',
algorithm: :concurrently
end
end
12 changes: 12 additions & 0 deletions db/migrate/20260517180946_add_index_good_jobs_queue_name.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

class AddIndexGoodJobsQueueName < Code0::ZeroTrack::Database::Migration[1.0]
disable_ddl_transaction!

def change
add_index :good_jobs, :queue_name,
name: :index_good_jobs_on_queue_name,
algorithm: :concurrently,
if_not_exists: true
end
end
12 changes: 12 additions & 0 deletions db/migrate/20260517180947_add_index_good_jobs_created_at.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

class AddIndexGoodJobsCreatedAt < Code0::ZeroTrack::Database::Migration[1.0]
disable_ddl_transaction!

def change
add_index :good_jobs, :created_at,
name: :index_good_jobs_on_created_at,
algorithm: :concurrently,
if_not_exists: true
end
end
14 changes: 14 additions & 0 deletions db/migrate/20260517180948_add_index_good_jobs_discarded.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

class AddIndexGoodJobsDiscarded < Code0::ZeroTrack::Database::Migration[1.0]
disable_ddl_transaction!

def change
add_index :good_jobs, :finished_at,
name: :index_good_jobs_on_discarded,
order: { finished_at: :desc },
where: 'finished_at IS NOT NULL AND error IS NOT NULL',
algorithm: :concurrently,
if_not_exists: true
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

class AddIndexGoodJobsScheduledAtAndQueueName < Code0::ZeroTrack::Database::Migration[1.0]
disable_ddl_transaction!

def change
add_index :good_jobs, %i[scheduled_at queue_name],
name: :index_good_jobs_on_scheduled_at_and_queue_name,
algorithm: :concurrently,
if_not_exists: true
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

class AddIndexGoodJobsOnUnfinishedOrErrored < Code0::ZeroTrack::Database::Migration[1.0]
disable_ddl_transaction!

def change
add_index :good_jobs, :id,
name: :index_good_jobs_on_unfinished_or_errored,
where: 'finished_at IS NULL OR error IS NOT NULL',
algorithm: :concurrently,
if_not_exists: true
end
end
1 change: 1 addition & 0 deletions db/schema_migrations/20260517180943
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d52549929012a317aa85f4f37076cd6fd8fab818ea9e402bd55fcdc42a8a0f5b
1 change: 1 addition & 0 deletions db/schema_migrations/20260517180944
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
adda851653b16a29956e7d5474b7674e925b356869f681a9bef3d3464bc93eb4
1 change: 1 addition & 0 deletions db/schema_migrations/20260517180945
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
19e3c885ab83aa8d15d84d824e8dc0d8430297b54a58df4e692fbfaa1da254c0
1 change: 1 addition & 0 deletions db/schema_migrations/20260517180946
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6177c3ffce96080840aa1c7a7774ff0d4288d7e5d3e02844698c80a8ad17453c
1 change: 1 addition & 0 deletions db/schema_migrations/20260517180947
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d717a2206059dd12d8e3a88e2393826f4cdc980752fe57cd81f30120d60be081
1 change: 1 addition & 0 deletions db/schema_migrations/20260517180948
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0a5b234a81003235c5adfa67e0e188c8909ed091c09357169fc087e5fdf8c56b
1 change: 1 addition & 0 deletions db/schema_migrations/20260517180949
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b33d5406709c22de5389c35ccfca939778a3d2a114e8a16253b9dee96ea02277
1 change: 1 addition & 0 deletions db/schema_migrations/20260517180950
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
302f53f804d4ce8a58abb9b194d62dbfbb7ecb00d77c25c1f86bdac17bf8ee99
19 changes: 18 additions & 1 deletion db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,8 @@ CREATE TABLE good_jobs (
error_event smallint,
labels text[],
locked_by_id uuid,
locked_at timestamp with time zone
locked_at timestamp with time zone,
lock_type integer
);

CREATE TABLE licenses (
Expand Down Expand Up @@ -1162,6 +1163,8 @@ CREATE INDEX index_good_job_jobs_for_candidate_lookup ON good_jobs USING btree (

CREATE UNIQUE INDEX index_good_job_settings_on_key ON good_job_settings USING btree (key);

CREATE INDEX index_good_jobs_for_candidate_dequeue_unlocked ON good_jobs USING btree (priority, scheduled_at, id) WHERE ((finished_at IS NULL) AND (locked_by_id IS NULL));

CREATE INDEX index_good_jobs_jobs_on_finished_at_only ON good_jobs USING btree (finished_at) WHERE (finished_at IS NOT NULL);

CREATE INDEX index_good_jobs_jobs_on_priority_created_at_when_unfinished ON good_jobs USING btree (priority DESC NULLS LAST, created_at) WHERE (finished_at IS NULL);
Expand All @@ -1176,22 +1179,36 @@ CREATE INDEX index_good_jobs_on_concurrency_key_and_created_at ON good_jobs USIN

CREATE INDEX index_good_jobs_on_concurrency_key_when_unfinished ON good_jobs USING btree (concurrency_key) WHERE (finished_at IS NULL);

CREATE INDEX index_good_jobs_on_created_at ON good_jobs USING btree (created_at);

CREATE INDEX index_good_jobs_on_cron_key_and_created_at_cond ON good_jobs USING btree (cron_key, created_at) WHERE (cron_key IS NOT NULL);

CREATE UNIQUE INDEX index_good_jobs_on_cron_key_and_cron_at_cond ON good_jobs USING btree (cron_key, cron_at) WHERE (cron_key IS NOT NULL);

CREATE INDEX index_good_jobs_on_discarded ON good_jobs USING btree (finished_at DESC) WHERE ((finished_at IS NOT NULL) AND (error IS NOT NULL));

CREATE INDEX index_good_jobs_on_job_class ON good_jobs USING btree (job_class);

CREATE INDEX index_good_jobs_on_labels ON good_jobs USING gin (labels) WHERE (labels IS NOT NULL);

CREATE INDEX index_good_jobs_on_locked_by_id ON good_jobs USING btree (locked_by_id) WHERE (locked_by_id IS NOT NULL);

CREATE INDEX index_good_jobs_on_priority_scheduled_at_unfinished ON good_jobs USING btree (priority, scheduled_at, id) WHERE (finished_at IS NULL);

CREATE INDEX index_good_jobs_on_priority_scheduled_at_unfinished_unlocked ON good_jobs USING btree (priority, scheduled_at) WHERE ((finished_at IS NULL) AND (locked_by_id IS NULL));

CREATE INDEX index_good_jobs_on_queue_name ON good_jobs USING btree (queue_name);

CREATE INDEX index_good_jobs_on_queue_name_and_scheduled_at ON good_jobs USING btree (queue_name, scheduled_at) WHERE (finished_at IS NULL);

CREATE INDEX index_good_jobs_on_queue_name_priority_scheduled_at_unfinished ON good_jobs USING btree (queue_name, scheduled_at, id) WHERE (finished_at IS NULL);

CREATE INDEX index_good_jobs_on_scheduled_at ON good_jobs USING btree (scheduled_at) WHERE (finished_at IS NULL);

CREATE INDEX index_good_jobs_on_scheduled_at_and_queue_name ON good_jobs USING btree (scheduled_at, queue_name);

CREATE INDEX index_good_jobs_on_unfinished_or_errored ON good_jobs USING btree (id) WHERE ((finished_at IS NULL) OR (error IS NOT NULL));

CREATE INDEX index_licenses_on_namespace_id ON licenses USING btree (namespace_id);

CREATE INDEX index_namespace_member_roles_on_member_id ON namespace_member_roles USING btree (member_id);
Expand Down