From e390670a7d088478d614131d72c1e48480336949 Mon Sep 17 00:00:00 2001 From: Rene Krenn Date: Mon, 5 Sep 2016 18:59:25 +0200 Subject: [PATCH] MT#20837 consider low-level db errors in error stats Change-Id: I1d15f8f7d2de0e428baf437dd994244ff47ffaf1 --- .../Projects/Migration/IPGallery/Api.pm | 6 +++++- .../Projects/Migration/IPGallery/Lnp.pm | 12 ++++++++++-- .../Projects/Migration/IPGallery/Preferences.pm | 12 ++++++++++-- .../Projects/Migration/IPGallery/Provisioning.pm | 6 +++++- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/lib/NGCP/BulkProcessor/Projects/Migration/IPGallery/Api.pm b/lib/NGCP/BulkProcessor/Projects/Migration/IPGallery/Api.pm index 3f15ed18..09926287 100644 --- a/lib/NGCP/BulkProcessor/Projects/Migration/IPGallery/Api.pm +++ b/lib/NGCP/BulkProcessor/Projects/Migration/IPGallery/Api.pm @@ -227,7 +227,11 @@ sub _invoke_api { eval { $context->{db}->db_rollback(1); }; - die($err) if !$skip_errors; + if ($skip_errors) { + _warn($context,"($context->{rownum}) " . 'database error with subscriber ' . $context->{cli} . ': ' . $err); + } else { + _error($context,"($context->{rownum}) " . 'database error with subscriber ' . $context->{cli} . ': ' . $err); + } } } diff --git a/lib/NGCP/BulkProcessor/Projects/Migration/IPGallery/Lnp.pm b/lib/NGCP/BulkProcessor/Projects/Migration/IPGallery/Lnp.pm index b2fc5353..cd4bf88e 100644 --- a/lib/NGCP/BulkProcessor/Projects/Migration/IPGallery/Lnp.pm +++ b/lib/NGCP/BulkProcessor/Projects/Migration/IPGallery/Lnp.pm @@ -77,7 +77,11 @@ sub create_lnps { eval { $context->{db}->db_rollback(1); }; - die($err) if !$skip_errors; + if ($skip_errors) { + _warn($context,"($context->{rownum}) " . 'database error with lnp ' . $context->{number} . ': ' . $err); + } else { + _error($context,"($context->{rownum}) " . 'database error with lnp ' . $context->{number} . ': ' . $err); + } } } else { foreach my $imported_lnp (@$records) { @@ -97,7 +101,11 @@ sub create_lnps { eval { $context->{db}->db_rollback(1); }; - die($err) if !$skip_errors; + if ($skip_errors) { + _warn($context,"($context->{rownum}) " . 'database error with lnp ' . $context->{number} . ': ' . $err); + } else { + _error($context,"($context->{rownum}) " . 'database error with lnp ' . $context->{number} . ': ' . $err); + } } } } diff --git a/lib/NGCP/BulkProcessor/Projects/Migration/IPGallery/Preferences.pm b/lib/NGCP/BulkProcessor/Projects/Migration/IPGallery/Preferences.pm index 7c88d5e9..d3e3c297 100644 --- a/lib/NGCP/BulkProcessor/Projects/Migration/IPGallery/Preferences.pm +++ b/lib/NGCP/BulkProcessor/Projects/Migration/IPGallery/Preferences.pm @@ -254,7 +254,11 @@ sub _set_subscriber_preference { eval { $context->{db}->db_rollback(1); }; - die($err) if !$skip_errors; + if ($skip_errors) { + _warn($context,"($context->{rownum}) " . 'database error with subscriber ' . $context->{cli} . ': ' . $err); + } else { + _error($context,"($context->{rownum}) " . 'database error with subscriber ' . $context->{cli} . ': ' . $err); + } } } @@ -763,7 +767,11 @@ sub cleanup_aig_sequence_ids { eval { $context->{db}->db_rollback(1); }; - die($err) if !$skip_errors; + if ($skip_errors) { + _warn($context,"database problem with voip_aig_sequence clean up: " . $err); + } else { + _error($context,"database problem with voip_aig_sequence clean up: " . $err); + } } } diff --git a/lib/NGCP/BulkProcessor/Projects/Migration/IPGallery/Provisioning.pm b/lib/NGCP/BulkProcessor/Projects/Migration/IPGallery/Provisioning.pm index ab835c49..31f4db05 100644 --- a/lib/NGCP/BulkProcessor/Projects/Migration/IPGallery/Provisioning.pm +++ b/lib/NGCP/BulkProcessor/Projects/Migration/IPGallery/Provisioning.pm @@ -302,7 +302,11 @@ sub _provision_susbcriber { eval { $context->{db}->db_rollback(1); }; - die($err) if !$skip_errors; + if ($skip_errors) { + _warn($context,"($context->{rownum}) " . 'database error with subscriber ' . $context->{cli} . ': ' . $err); + } else { + _error($context,"($context->{rownum}) " . 'database error with subscriber ' . $context->{cli} . ': ' . $err); + } } return 1;