summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-07-12 00:21:47 +0200
committerGitHub <noreply@github.com>2017-07-12 00:21:47 +0200
commit382199a567afed3795f13591cd41080906ffb87e (patch)
tree7b85232b94cbb340b2586864057b786f7813d14a /scripts
parent01e09b0b05a92bf1a95e09118d05259a4c70a7c4 (diff)
downloadbugzilla-382199a567afed3795f13591cd41080906ffb87e.tar.gz
bugzilla-382199a567afed3795f13591cd41080906ffb87e.tar.xz
Bug 1378999 - Add update/new stats to bulk_indexer verbose mode
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/bulk_index.pl24
1 files changed, 16 insertions, 8 deletions
diff --git a/scripts/bulk_index.pl b/scripts/bulk_index.pl
index 1746bc868..8d04b7e8d 100755
--- a/scripts/bulk_index.pl
+++ b/scripts/bulk_index.pl
@@ -49,6 +49,7 @@ my $indexer = Bugzilla::Elastic::Indexer->new(
$indexer->create_index;
+my $run_time = time;
my $loop = IO::Async::Loop->new;
my $timer = IO::Async::Timer::Periodic->new(
first_interval => 0,
@@ -56,25 +57,32 @@ my $timer = IO::Async::Timer::Periodic->new(
reschedule => 'skip',
on_tick => sub {
+ printf "Running after %d seconds\n", time - $run_time;
my $start_users = time;
say "indexing users" if $verbose;
- $indexer->bulk_load('Bugzilla::User');
- print " ", time - $start_users, " seconds\n" if $verbose > 1;
+ my $users = $indexer->bulk_load('Bugzilla::User');
+ bulk_load_stats($start_users, $users) if $verbose > 1;
- say "indexing bugs" if $verbose;
my $start_bugs = time;
- $indexer->bulk_load('Bugzilla::Bug');
- print " ", time - $start_bugs, " seconds\n" if $verbose > 1;
+ say "indexing bugs" if $verbose;
+ my $bugs = $indexer->bulk_load('Bugzilla::Bug');
+ bulk_load_stats($start_bugs, $bugs) if $verbose > 1;
- say "indexing comments" if $verbose;
my $start_comments = time;
- $indexer->bulk_load('Bugzilla::Comment');
- print " ", time - $start_comments, " seconds\n" if $verbose > 1;
+ say "indexing comments" if $verbose;
+ my $comments = $indexer->bulk_load('Bugzilla::Comment');
+ bulk_load_stats($start_comments, $comments) if $verbose > 1;
$loop->stop if $once;
+ $run_time = time;
},
);
$timer->start();
$loop->add($timer);
$loop->run;
+
+sub bulk_load_stats {
+ my ($start_time, $info) = @_;
+ printf " %d seconds (%d new, %d update)\n", time - $start_time, $info->{new}, $info->{updated};
+}