$kid->{dbname} = $dbname;
$self->{kidcheckq} = 1;
if ($otc) {
- $sth{qinsert}->execute($syncname,$self->{ppid},$sourcedb,$dbname,'fullcopy');
+ $sth{qinsert}->execute($syncname,$$,$sourcedb,$dbname,'fullcopy');
$maindbh->commit();
## These changes are for the newly created kid, but also stick in the controller.
$sync->{synctype} = 'fullcopy';
}
else {
$self->glog(qq{Re-adding sync to q table for database "$atarget"}, 1);
- $count = $sth{qinsert}->execute($syncname,$self->{ppid},$sourcedb,$atarget,$synctype);
+ $count = $sth{qinsert}->execute($syncname,$$,$sourcedb,$atarget,$synctype);
$maindbh->commit();
sleep $config{kid_abort_sleep};
$self->glog('Creating kid to handle resurrected q row', 1);
$count = kill 0 => $pid;
if ($count != 1) {
## Make sure this kid has cleaned up after themselves in the q table
- $count = $sth{qupdateabortedpid}->execute('?',$syncname,$pid,$self->{ppid},$dbname);
+ $count = $sth{qupdateabortedpid}->execute('?',$syncname,$pid,$$,$dbname);
if ($count >= 1) {
$self->glog("Rows updated child $pid to aborted in q: $count", 1);
}
$count = $sth{qcheck}->execute($syncname,$sourcedb,$dbname);
$sth{qcheck}->finish();
if ($count < 1) {
- $count = $sth{qinsert}->execute($syncname,$self->{ppid},$sourcedb,$dbname,$synctype);
+ $count = $sth{qinsert}->execute($syncname,$$,$sourcedb,$dbname,$synctype);
}
else {
$self->glog("Could not add to q sync=$syncname,source=$sourcedb,target=$dbname,count=$count. Sending manual notification", 6);
$merr = $maindbh->err || 'none';
$serr = $sourcedbh->err || 'none';
$terr = $targetdbh->err || 'none';
- $mstate = $maindbh->state;
- $sstate = $sourcedbh->state;
- $tstate = $targetdbh->state;
- $msg .= "\n main error: $merr source error: $serr target error: $terr States:$mstate/$sstate/$tstate\n";
+ $mstate = $maindbh->state || '?';
+ $sstate = $sourcedbh->state || '?';
+ $tstate = $targetdbh->state || '?';
+ $msg .= "\n main error: $merr\nsource error: $serr\ntarget error: $terr\nStates: $mstate/$sstate/$tstate\n";
}
## If the error was because we could not serialize, maybe add a sleep time
};
## Note: we don't check for non-null started because it is never set without a pid
$sth = $finaldbh->prepare($SQL);
- $sth->execute($msg,$syncname,$sourcedb,$targetdb,$self->{parent},$$);
+ (my $flatmsg = $msg) =~ s/\n/\\n/g;
+ my $count = $sth->execute($flatmsg,$syncname,$sourcedb,$targetdb,$self->{parent},$$);
## Clean up the audit_pid table
if ($config{audit_pid}) {
chomp $@;
(my $err = $@) =~ s/\n/\\n/g;
$self->glog("Warning! Aborting due to exception for $S.$T:$pkval Error was $err", 0);
- die $@;
+ die "$err\n";
}
}
elsif ($@) {