Skip to content

Commit

Permalink
Added deadlock protection to these operations
Browse files Browse the repository at this point in the history
  • Loading branch information
muffato authored and ens-bwalts committed May 6, 2020
1 parent 50f5fdd commit ef1f0a5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions modules/Bio/EnsEMBL/Hive/DBSQL/AnalysisJobAdaptor.pm
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,9 @@ sub reset_jobs_for_analysis_id {
WHERE $analyses_filter $statuses_filter
};

$self->dbc->do($sql3);
$self->dbc->protected_prepare_execute( [$sql3],
sub { my ($after) = @_; $self->db->get_LogMessageAdaptor->store_hive_message( 'resetting jobs'.$after, 'INFO' ); }
);

foreach my $analysis ( @$list_of_analyses ) {
$self->db->get_AnalysisStatsAdaptor->update_status($analysis->dbID, 'LOADING');
Expand Down Expand Up @@ -936,7 +938,9 @@ sub unblock_jobs_for_analysis_id {
SET s.local_jobs_counter=0, s.remote_jobs_counter=0, j.status = 'READY'
WHERE $analyses_filter AND j.status = 'SEMAPHORED'
};
$self->dbc->do($sql);
$self->dbc->protected_prepare_execute( [$sql],
sub { my ($after) = @_; $self->db->get_LogMessageAdaptor->store_hive_message( 'unblocking jobs'.$after, 'INFO' ); }
);

} elsif ($self->dbc->driver eq 'pgsql') {

Expand Down Expand Up @@ -1031,7 +1035,9 @@ sub discard_jobs_for_analysis_id {
$self->dbc->run_in_transaction( sub {

# let's reset work on the jobs that don't have a controlled_semaphore_id
$self->dbc->do($sql3);
$self->dbc->protected_prepare_execute( [$sql3],
sub { my ($after) = @_; $self->db->get_LogMessageAdaptor->store_hive_message( 'discarding jobs'.$after, 'INFO' ); }
);

my $semaphore_adaptor = $self->db->get_SemaphoreAdaptor;

Expand Down

0 comments on commit ef1f0a5

Please sign in to comment.