R
ramanmu
I get the 'undefined' error, as noted in the Subject line, whenever I
initialize the $Sybase:
Blib::nsql_deadlock_retrycount var.
Line 450 of /opt/perl.../DBlib.pm looks like this:
406 sub nsql {
407
408 my ($db,$sql,$type,$callback) = @_;
409 my (@res,@data,%data);
410 my $retrycount = $nsql_deadlock_retrycount;
411 my $retrysleep = $nsql_deadlock_retrysleep || 60;
412 my $retryverbose = $nsql_deadlock_verbose;
413
414 if ( ref $type ) {
415 $type = ref $type;
416 }
417 elsif ( not defined $type ) {
418 $type = "";
419 }
420
421 undef $DB_ERROR;
422
423 DEADLOCK:
424 {
425
426 return unless $db->dbcmd($sql);
427
428 unless ( $db->dbsqlexec ) {
429
430 if ( $nsql_deadlock_retrycount && $DB_ERROR =~
/Message: 1205\b/m ) {
431 if ( $retrycount < 0 || $retrycount-- ) {
432 carp "SQL deadlock encountered.
Retrying...\n" if $retryverbose;
433 undef $DB_ERROR;
434 sleep($retrysleep);
435 redo DEADLOCK;
436 }
437 else {
438 carp "SQL deadlock retry failed
$nsql_deadlock_retrycount times. Aborting.\n"
439 if $retryverbose;
440 last DEADLOCK;
441 }
442 }
443
444 last DEADLOCK;
445
446 }
447
448 while ( $db->dbresults != $db->NO_MORE_RESULTS ) {
449
450 if ( $nsql_deadlock_retrycount && $DB_ERROR =~
/Message: 1205\b/m ) {
451 if ( $retrycount < 0 || $retrycount-- ) {
452 carp "SQL deadlock encountered.
Retrying...\n" if $retryverbose;
453 undef $DB_ERROR;
454 @res = ();
455 sleep($retrysleep);
456 redo DEADLOCK;
457 }
458 else {
459 carp "SQL deadlock retry failed
$nsql_deadlock_retrycount times. Aborting.\n"
460 if $retryverbose;
461 last DEADLOCK;
462 }
463 }
Can someone help please?
The 'undefined' error messages are filling up my log files & I'm not
able to figure out what exactly is getting undefined.
If I understand this piece of code correctly, it appears to me that
$DB_ERROR is undef'ed at line 421. Then, assuming that everything
proceeds without any errors & deadlocks, when the test for $DB_ERROR is
made in line 450 it is still undef'ed which in turn causes the error
message.
Any & all help would be greatly appreciated.
thanks,
Murali.
initialize the $Sybase:
Line 450 of /opt/perl.../DBlib.pm looks like this:
406 sub nsql {
407
408 my ($db,$sql,$type,$callback) = @_;
409 my (@res,@data,%data);
410 my $retrycount = $nsql_deadlock_retrycount;
411 my $retrysleep = $nsql_deadlock_retrysleep || 60;
412 my $retryverbose = $nsql_deadlock_verbose;
413
414 if ( ref $type ) {
415 $type = ref $type;
416 }
417 elsif ( not defined $type ) {
418 $type = "";
419 }
420
421 undef $DB_ERROR;
422
423 DEADLOCK:
424 {
425
426 return unless $db->dbcmd($sql);
427
428 unless ( $db->dbsqlexec ) {
429
430 if ( $nsql_deadlock_retrycount && $DB_ERROR =~
/Message: 1205\b/m ) {
431 if ( $retrycount < 0 || $retrycount-- ) {
432 carp "SQL deadlock encountered.
Retrying...\n" if $retryverbose;
433 undef $DB_ERROR;
434 sleep($retrysleep);
435 redo DEADLOCK;
436 }
437 else {
438 carp "SQL deadlock retry failed
$nsql_deadlock_retrycount times. Aborting.\n"
439 if $retryverbose;
440 last DEADLOCK;
441 }
442 }
443
444 last DEADLOCK;
445
446 }
447
448 while ( $db->dbresults != $db->NO_MORE_RESULTS ) {
449
450 if ( $nsql_deadlock_retrycount && $DB_ERROR =~
/Message: 1205\b/m ) {
451 if ( $retrycount < 0 || $retrycount-- ) {
452 carp "SQL deadlock encountered.
Retrying...\n" if $retryverbose;
453 undef $DB_ERROR;
454 @res = ();
455 sleep($retrysleep);
456 redo DEADLOCK;
457 }
458 else {
459 carp "SQL deadlock retry failed
$nsql_deadlock_retrycount times. Aborting.\n"
460 if $retryverbose;
461 last DEADLOCK;
462 }
463 }
Can someone help please?
The 'undefined' error messages are filling up my log files & I'm not
able to figure out what exactly is getting undefined.
If I understand this piece of code correctly, it appears to me that
$DB_ERROR is undef'ed at line 421. Then, assuming that everything
proceeds without any errors & deadlocks, when the test for $DB_ERROR is
made in line 450 it is still undef'ed which in turn causes the error
message.
Any & all help would be greatly appreciated.
thanks,
Murali.