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