Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #851 from joyent/ether/fix-slow-validation_result-…
Browse files Browse the repository at this point in the history
…inserts

v2: fix slow validation result inserts
  • Loading branch information
karenetheridge authored Aug 2, 2019
2 parents ab7287c + 40852cb commit bc562fe
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Conch/ValidationSystem.pm
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ sub run_validation_plan ($self, %options) {
$validator->validation_results;

$self->log->debug('validation '.$validation->name.' returned no results for device id '.$device->id)
if not @validation_results;
if not $validator->validation_results;
}

# maybe no validations ran? this is a problem.
Expand Down
9 changes: 9 additions & 0 deletions sql/migrations/0092-validation_result-index.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SELECT run_migration(92, $$

-- this is used when inserting validation_state + validation_state_member +
-- validation_result records at the end of running a validation_plan and we seek
-- to re-use old records where possible instead of creating a new ones
create index validation_result_all_columns_idx on validation_result
(device_id, hardware_product_id, validation_id, message, hint, status, category, component_id, result_order);

$$);
7 changes: 7 additions & 0 deletions sql/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1378,6 +1378,13 @@ CREATE INDEX validation_plan_member_validation_plan_id_idx ON public.validation_
CREATE UNIQUE INDEX validation_plan_name_idx ON public.validation_plan USING btree (name) WHERE (deactivated IS NULL);


--
-- Name: validation_result_all_columns_idx; Type: INDEX; Schema: public; Owner: conch
--

CREATE INDEX validation_result_all_columns_idx ON public.validation_result USING btree (device_id, hardware_product_id, validation_id, message, hint, status, category, component_id, result_order);


--
-- Name: validation_result_device_id_idx; Type: INDEX; Schema: public; Owner: conch
--
Expand Down

0 comments on commit bc562fe

Please sign in to comment.