Lines 122-127
unless ($index_authorities || $index_biblios) {
Link Here
|
122 |
$index_authorities = $index_biblios = 1; |
122 |
$index_authorities = $index_biblios = 1; |
123 |
} |
123 |
} |
124 |
|
124 |
|
|
|
125 |
if ($processes && @record_numbers) { |
126 |
die "Argument p|processes cannot be combined with bn|bnumber"; |
127 |
} |
128 |
|
125 |
pod2usage(1) if $help; |
129 |
pod2usage(1) if $help; |
126 |
pod2usage( -exitstatus => 0, -verbose => 2 ) if $man; |
130 |
pod2usage( -exitstatus => 0, -verbose => 2 ) if $man; |
127 |
|
131 |
|
Lines 132-142
_verify_index_state($Koha::SearchEngine::Elasticsearch::AUTHORITIES_INDEX, $dele
Link Here
|
132 |
|
136 |
|
133 |
my $slice_index = 0; |
137 |
my $slice_index = 0; |
134 |
my $slice_count = $processes // 1; |
138 |
my $slice_count = $processes // 1; |
|
|
139 |
my %iterator_options; |
135 |
|
140 |
|
136 |
if ($slice_count > 1) { |
141 |
if ($slice_count > 1) { |
137 |
# Fire up child processes for processing slices from 2 on. This main process will handle slice 1. |
142 |
# Fire up child processes for processing slices from 2 on. This main process will handle slice 1. |
138 |
$slice_index = 1; |
143 |
$slice_index = 0; |
139 |
for (my $proc = 2; $proc <= $processes; $proc++) { |
144 |
for (my $proc = 1; $proc < $slice_count; $proc++) { |
140 |
my $pid = fork(); |
145 |
my $pid = fork(); |
141 |
die "Failed to fork a child process\n" unless defined $pid; |
146 |
die "Failed to fork a child process\n" unless defined $pid; |
142 |
if ($pid == 0) { |
147 |
if ($pid == 0) { |
Lines 146-157
if ($slice_count > 1) {
Link Here
|
146 |
} |
151 |
} |
147 |
} |
152 |
} |
148 |
# Fudge the commit count a bit to spread out the Elasticsearch commits |
153 |
# Fudge the commit count a bit to spread out the Elasticsearch commits |
149 |
$commit *= 1 + 0.10 * ($slice_index - 1); |
154 |
$commit *= 1 + 0.10 * $slice_index; |
150 |
} |
155 |
_log(1, "Processing slice @{[$slice_index + 1]} of $slice_count\n"); |
151 |
|
|
|
152 |
my %iterator_options; |
153 |
if ($slice_index) { |
154 |
_log(1, "Processing slice $slice_index of $slice_count\n"); |
155 |
$iterator_options{slice} = { index => $slice_index, count => $slice_count }; |
156 |
$iterator_options{slice} = { index => $slice_index, count => $slice_count }; |
156 |
} |
157 |
} |
157 |
|
158 |
|
Lines 190-205
if ($index_authorities) {
Link Here
|
190 |
_do_reindex($next, $Koha::SearchEngine::Elasticsearch::AUTHORITIES_INDEX); |
191 |
_do_reindex($next, $Koha::SearchEngine::Elasticsearch::AUTHORITIES_INDEX); |
191 |
} |
192 |
} |
192 |
|
193 |
|
193 |
if ($slice_index == 1) { |
194 |
if ($slice_index == 0) { |
194 |
# Main process, wait for children |
195 |
# Main process, wait for children |
195 |
for (my $proc = 2; $proc <= $processes; $proc++) { |
196 |
for (my $proc = 1; $proc < $processes; $proc++) { |
196 |
wait(); |
197 |
wait(); |
197 |
} |
198 |
} |
198 |
} |
199 |
} |
199 |
|
200 |
|
200 |
=head2 _verify_index_state |
201 |
=head2 _verify_index_state |
201 |
|
202 |
|
202 |
_ verify_index_state($Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX, 1); |
203 |
_verify_index_state($Koha::SearchEngine::Elasticsearch::BIBLIOS_INDEX, 1); |
203 |
|
204 |
|
204 |
Checks the index state and recreates it if requested. |
205 |
Checks the index state and recreates it if requested. |
205 |
|
206 |
|
206 |
- |
|
|