mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 10:23:14 -04:00
parent
4d234f8d3f
commit
3b5450a19b
4 changed files with 54 additions and 8 deletions
|
@ -27,6 +27,7 @@ import {
|
||||||
describe('reindexService', () => {
|
describe('reindexService', () => {
|
||||||
let actions: jest.Mocked<any>;
|
let actions: jest.Mocked<any>;
|
||||||
let callCluster: jest.Mock<CallCluster>;
|
let callCluster: jest.Mock<CallCluster>;
|
||||||
|
let log: jest.Mock;
|
||||||
let xpackInfo: { feature: jest.Mocked<any> };
|
let xpackInfo: { feature: jest.Mocked<any> };
|
||||||
let service: ReindexService;
|
let service: ReindexService;
|
||||||
|
|
||||||
|
@ -55,6 +56,7 @@ describe('reindexService', () => {
|
||||||
runWhileIndexGroupLocked: jest.fn(async (group: string, f: any) => f({ attributes: {} })),
|
runWhileIndexGroupLocked: jest.fn(async (group: string, f: any) => f({ attributes: {} })),
|
||||||
};
|
};
|
||||||
callCluster = jest.fn();
|
callCluster = jest.fn();
|
||||||
|
log = jest.fn();
|
||||||
xpackInfo = {
|
xpackInfo = {
|
||||||
feature: jest.fn(() => ({
|
feature: jest.fn(() => ({
|
||||||
isAvailable() {
|
isAvailable() {
|
||||||
|
@ -65,7 +67,7 @@ describe('reindexService', () => {
|
||||||
},
|
},
|
||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
service = reindexServiceFactory(callCluster, xpackInfo as any, actions);
|
service = reindexServiceFactory(callCluster, xpackInfo as any, actions, log);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('hasRequiredPrivileges', () => {
|
describe('hasRequiredPrivileges', () => {
|
||||||
|
@ -586,6 +588,7 @@ describe('reindexService', () => {
|
||||||
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.created);
|
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.created);
|
||||||
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
||||||
expect(updatedOp.attributes.errorMessage!.includes(`Can't lock!`)).toBeTruthy();
|
expect(updatedOp.attributes.errorMessage!.includes(`Can't lock!`)).toBeTruthy();
|
||||||
|
expect(log).toHaveBeenCalledWith(['upgrade_assistant', 'error'], expect.any(String));
|
||||||
expect(callCluster).not.toHaveBeenCalledWith('transport.request', {
|
expect(callCluster).not.toHaveBeenCalledWith('transport.request', {
|
||||||
path: '/_xpack/ml/set_upgrade_mode?enabled=true',
|
path: '/_xpack/ml/set_upgrade_mode?enabled=true',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -600,6 +603,7 @@ describe('reindexService', () => {
|
||||||
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.created);
|
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.created);
|
||||||
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
||||||
expect(updatedOp.attributes.errorMessage!.includes(`Can't lock!`)).toBeTruthy();
|
expect(updatedOp.attributes.errorMessage!.includes(`Can't lock!`)).toBeTruthy();
|
||||||
|
expect(log).toHaveBeenCalledWith(['upgrade_assistant', 'error'], expect.any(String));
|
||||||
expect(callCluster).not.toHaveBeenCalledWith('transport.request', {
|
expect(callCluster).not.toHaveBeenCalledWith('transport.request', {
|
||||||
path: '/_xpack/ml/set_upgrade_mode?enabled=true',
|
path: '/_xpack/ml/set_upgrade_mode?enabled=true',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -623,6 +627,7 @@ describe('reindexService', () => {
|
||||||
expect(
|
expect(
|
||||||
updatedOp.attributes.errorMessage!.includes('Could not stop ML jobs')
|
updatedOp.attributes.errorMessage!.includes('Could not stop ML jobs')
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
|
expect(log).toHaveBeenCalledWith(['upgrade_assistant', 'error'], expect.any(String));
|
||||||
expect(callCluster).toHaveBeenCalledWith('transport.request', {
|
expect(callCluster).toHaveBeenCalledWith('transport.request', {
|
||||||
path: '/_xpack/ml/set_upgrade_mode?enabled=true',
|
path: '/_xpack/ml/set_upgrade_mode?enabled=true',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -644,6 +649,7 @@ describe('reindexService', () => {
|
||||||
expect(
|
expect(
|
||||||
updatedOp.attributes.errorMessage!.includes('Some nodes are not on minimum version')
|
updatedOp.attributes.errorMessage!.includes('Some nodes are not on minimum version')
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
|
expect(log).toHaveBeenCalledWith(['upgrade_assistant', 'error'], expect.any(String));
|
||||||
// Should not have called ML endpoint at all
|
// Should not have called ML endpoint at all
|
||||||
expect(callCluster).not.toHaveBeenCalledWith('transport.request', {
|
expect(callCluster).not.toHaveBeenCalledWith('transport.request', {
|
||||||
path: '/_xpack/ml/set_upgrade_mode?enabled=true',
|
path: '/_xpack/ml/set_upgrade_mode?enabled=true',
|
||||||
|
@ -696,6 +702,7 @@ describe('reindexService', () => {
|
||||||
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.created);
|
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.created);
|
||||||
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
||||||
expect(updatedOp.attributes.errorMessage!.includes(`Can't lock!`)).toBeTruthy();
|
expect(updatedOp.attributes.errorMessage!.includes(`Can't lock!`)).toBeTruthy();
|
||||||
|
expect(log).toHaveBeenCalledWith(['upgrade_assistant', 'error'], expect.any(String));
|
||||||
expect(callCluster).not.toHaveBeenCalledWith('transport.request', {
|
expect(callCluster).not.toHaveBeenCalledWith('transport.request', {
|
||||||
path: '/_xpack/watcher/_stop',
|
path: '/_xpack/watcher/_stop',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -710,6 +717,7 @@ describe('reindexService', () => {
|
||||||
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.created);
|
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.created);
|
||||||
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
||||||
expect(updatedOp.attributes.errorMessage!.includes(`Can't lock!`)).toBeTruthy();
|
expect(updatedOp.attributes.errorMessage!.includes(`Can't lock!`)).toBeTruthy();
|
||||||
|
expect(log).toHaveBeenCalledWith(['upgrade_assistant', 'error'], expect.any(String));
|
||||||
expect(callCluster).not.toHaveBeenCalledWith('transport.request', {
|
expect(callCluster).not.toHaveBeenCalledWith('transport.request', {
|
||||||
path: '/_xpack/watcher/_stop',
|
path: '/_xpack/watcher/_stop',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -731,6 +739,7 @@ describe('reindexService', () => {
|
||||||
expect(
|
expect(
|
||||||
updatedOp.attributes.errorMessage!.includes('Could not stop Watcher')
|
updatedOp.attributes.errorMessage!.includes('Could not stop Watcher')
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
|
expect(log).toHaveBeenCalledWith(['upgrade_assistant', 'error'], expect.any(String));
|
||||||
expect(callCluster).toHaveBeenCalledWith('transport.request', {
|
expect(callCluster).toHaveBeenCalledWith('transport.request', {
|
||||||
path: '/_xpack/watcher/_stop',
|
path: '/_xpack/watcher/_stop',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -766,6 +775,7 @@ describe('reindexService', () => {
|
||||||
);
|
);
|
||||||
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
||||||
expect(updatedOp.attributes.errorMessage).not.toBeNull();
|
expect(updatedOp.attributes.errorMessage).not.toBeNull();
|
||||||
|
expect(log).toHaveBeenCalledWith(['upgrade_assistant', 'error'], expect.any(String));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('fails if setting updates fail', async () => {
|
it('fails if setting updates fail', async () => {
|
||||||
|
@ -776,6 +786,7 @@ describe('reindexService', () => {
|
||||||
);
|
);
|
||||||
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
||||||
expect(updatedOp.attributes.errorMessage).not.toBeNull();
|
expect(updatedOp.attributes.errorMessage).not.toBeNull();
|
||||||
|
expect(log).toHaveBeenCalledWith(['upgrade_assistant', 'error'], expect.any(String));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -810,6 +821,7 @@ describe('reindexService', () => {
|
||||||
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.readonly);
|
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.readonly);
|
||||||
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
||||||
expect(updatedOp.attributes.errorMessage).not.toBeNull();
|
expect(updatedOp.attributes.errorMessage).not.toBeNull();
|
||||||
|
expect(log).toHaveBeenCalledWith(['upgrade_assistant', 'error'], expect.any(String));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('fails if create index fails', async () => {
|
it('fails if create index fails', async () => {
|
||||||
|
@ -821,6 +833,7 @@ describe('reindexService', () => {
|
||||||
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.readonly);
|
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.readonly);
|
||||||
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
||||||
expect(updatedOp.attributes.errorMessage).not.toBeNull();
|
expect(updatedOp.attributes.errorMessage).not.toBeNull();
|
||||||
|
expect(log).toHaveBeenCalledWith(['upgrade_assistant', 'error'], expect.any(String));
|
||||||
|
|
||||||
// Original index should have been set back to allow reads.
|
// Original index should have been set back to allow reads.
|
||||||
expect(callCluster).toHaveBeenCalledWith('indices.putSettings', {
|
expect(callCluster).toHaveBeenCalledWith('indices.putSettings', {
|
||||||
|
@ -873,6 +886,7 @@ describe('reindexService', () => {
|
||||||
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.newIndexCreated);
|
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.newIndexCreated);
|
||||||
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
||||||
expect(updatedOp.attributes.errorMessage).not.toBeNull();
|
expect(updatedOp.attributes.errorMessage).not.toBeNull();
|
||||||
|
expect(log).toHaveBeenCalledWith(['upgrade_assistant', 'error'], expect.any(String));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -930,6 +944,7 @@ describe('reindexService', () => {
|
||||||
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.reindexStarted);
|
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.reindexStarted);
|
||||||
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
||||||
expect(updatedOp.attributes.errorMessage).not.toBeNull();
|
expect(updatedOp.attributes.errorMessage).not.toBeNull();
|
||||||
|
expect(log).toHaveBeenCalledWith(['upgrade_assistant', 'error'], expect.any(String));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1013,6 +1028,7 @@ describe('reindexService', () => {
|
||||||
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.reindexCompleted);
|
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.reindexCompleted);
|
||||||
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
||||||
expect(updatedOp.attributes.errorMessage).not.toBeNull();
|
expect(updatedOp.attributes.errorMessage).not.toBeNull();
|
||||||
|
expect(log).toHaveBeenCalledWith(['upgrade_assistant', 'error'], expect.any(String));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('fails if switching aliases fails', async () => {
|
it('fails if switching aliases fails', async () => {
|
||||||
|
@ -1021,6 +1037,7 @@ describe('reindexService', () => {
|
||||||
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.reindexCompleted);
|
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.reindexCompleted);
|
||||||
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
||||||
expect(updatedOp.attributes.errorMessage).not.toBeNull();
|
expect(updatedOp.attributes.errorMessage).not.toBeNull();
|
||||||
|
expect(log).toHaveBeenCalledWith(['upgrade_assistant', 'error'], expect.any(String));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1089,6 +1106,7 @@ describe('reindexService', () => {
|
||||||
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.aliasCreated);
|
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.aliasCreated);
|
||||||
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
||||||
expect(updatedOp.attributes.errorMessage!.includes(`Can't lock!`)).toBeTruthy();
|
expect(updatedOp.attributes.errorMessage!.includes(`Can't lock!`)).toBeTruthy();
|
||||||
|
expect(log).toHaveBeenCalledWith(['upgrade_assistant', 'error'], expect.any(String));
|
||||||
expect(callCluster).not.toHaveBeenCalledWith('transport.request', {
|
expect(callCluster).not.toHaveBeenCalledWith('transport.request', {
|
||||||
path: '/_xpack/ml/set_upgrade_mode?enabled=false',
|
path: '/_xpack/ml/set_upgrade_mode?enabled=false',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -1104,6 +1122,7 @@ describe('reindexService', () => {
|
||||||
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.aliasCreated);
|
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.aliasCreated);
|
||||||
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
||||||
expect(updatedOp.attributes.errorMessage!.includes(`Can't lock!`)).toBeTruthy();
|
expect(updatedOp.attributes.errorMessage!.includes(`Can't lock!`)).toBeTruthy();
|
||||||
|
expect(log).toHaveBeenCalledWith(['upgrade_assistant', 'error'], expect.any(String));
|
||||||
expect(callCluster).not.toHaveBeenCalledWith('transport.request', {
|
expect(callCluster).not.toHaveBeenCalledWith('transport.request', {
|
||||||
path: '/_xpack/ml/set_upgrade_mode?enabled=false',
|
path: '/_xpack/ml/set_upgrade_mode?enabled=false',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -1124,6 +1143,7 @@ describe('reindexService', () => {
|
||||||
expect(
|
expect(
|
||||||
updatedOp.attributes.errorMessage!.includes('Could not resume ML jobs')
|
updatedOp.attributes.errorMessage!.includes('Could not resume ML jobs')
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
|
expect(log).toHaveBeenCalledWith(['upgrade_assistant', 'error'], expect.any(String));
|
||||||
expect(callCluster).toHaveBeenCalledWith('transport.request', {
|
expect(callCluster).toHaveBeenCalledWith('transport.request', {
|
||||||
path: '/_xpack/ml/set_upgrade_mode?enabled=false',
|
path: '/_xpack/ml/set_upgrade_mode?enabled=false',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -1190,6 +1210,7 @@ describe('reindexService', () => {
|
||||||
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.aliasCreated);
|
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.aliasCreated);
|
||||||
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
||||||
expect(updatedOp.attributes.errorMessage!.includes(`Can't lock!`)).toBeTruthy();
|
expect(updatedOp.attributes.errorMessage!.includes(`Can't lock!`)).toBeTruthy();
|
||||||
|
expect(log).toHaveBeenCalledWith(['upgrade_assistant', 'error'], expect.any(String));
|
||||||
expect(callCluster).not.toHaveBeenCalledWith('transport.request', {
|
expect(callCluster).not.toHaveBeenCalledWith('transport.request', {
|
||||||
path: '/_xpack/watcher/_start',
|
path: '/_xpack/watcher/_start',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -1205,6 +1226,7 @@ describe('reindexService', () => {
|
||||||
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.aliasCreated);
|
expect(updatedOp.attributes.lastCompletedStep).toEqual(ReindexStep.aliasCreated);
|
||||||
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
expect(updatedOp.attributes.status).toEqual(ReindexStatus.failed);
|
||||||
expect(updatedOp.attributes.errorMessage!.includes(`Can't lock!`)).toBeTruthy();
|
expect(updatedOp.attributes.errorMessage!.includes(`Can't lock!`)).toBeTruthy();
|
||||||
|
expect(log).toHaveBeenCalledWith(['upgrade_assistant', 'error'], expect.any(String));
|
||||||
expect(callCluster).not.toHaveBeenCalledWith('transport.request', {
|
expect(callCluster).not.toHaveBeenCalledWith('transport.request', {
|
||||||
path: '/_xpack/watcher/_start',
|
path: '/_xpack/watcher/_start',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -1225,6 +1247,7 @@ describe('reindexService', () => {
|
||||||
expect(
|
expect(
|
||||||
updatedOp.attributes.errorMessage!.includes('Could not start Watcher')
|
updatedOp.attributes.errorMessage!.includes('Could not start Watcher')
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
|
expect(log).toHaveBeenCalledWith(['upgrade_assistant', 'error'], expect.any(String));
|
||||||
expect(callCluster).toHaveBeenCalledWith('transport.request', {
|
expect(callCluster).toHaveBeenCalledWith('transport.request', {
|
||||||
path: '/_xpack/watcher/_start',
|
path: '/_xpack/watcher/_start',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
import Boom from 'boom';
|
import Boom from 'boom';
|
||||||
|
|
||||||
|
import { Server } from 'hapi';
|
||||||
import { CallCluster } from 'src/legacy/core_plugins/elasticsearch';
|
import { CallCluster } from 'src/legacy/core_plugins/elasticsearch';
|
||||||
import { XPackInfo } from 'x-pack/plugins/xpack_main/server/lib/xpack_info';
|
import { XPackInfo } from 'x-pack/plugins/xpack_main/server/lib/xpack_info';
|
||||||
import {
|
import {
|
||||||
|
@ -98,7 +99,8 @@ export interface ReindexService {
|
||||||
export const reindexServiceFactory = (
|
export const reindexServiceFactory = (
|
||||||
callCluster: CallCluster,
|
callCluster: CallCluster,
|
||||||
xpackInfo: XPackInfo,
|
xpackInfo: XPackInfo,
|
||||||
actions: ReindexActions
|
actions: ReindexActions,
|
||||||
|
log: Server['log']
|
||||||
): ReindexService => {
|
): ReindexService => {
|
||||||
// ------ Utility functions
|
// ------ Utility functions
|
||||||
|
|
||||||
|
@ -628,10 +630,15 @@ export const reindexServiceFactory = (
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
log(
|
||||||
|
['upgrade_assistant', 'error'],
|
||||||
|
`Reindexing step failed: ${e instanceof Error ? e.stack : e.toString()}`
|
||||||
|
);
|
||||||
|
|
||||||
// Trap the exception and add the message to the object so the UI can display it.
|
// Trap the exception and add the message to the object so the UI can display it.
|
||||||
lockedReindexOp = await actions.updateReindexOp(lockedReindexOp, {
|
lockedReindexOp = await actions.updateReindexOp(lockedReindexOp, {
|
||||||
status: ReindexStatus.failed,
|
status: ReindexStatus.failed,
|
||||||
errorMessage: e instanceof Error ? e.stack : e.toString(),
|
errorMessage: e.toString(),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Cleanup any changes, ignoring any errors.
|
// Cleanup any changes, ignoring any errors.
|
||||||
|
|
|
@ -57,7 +57,8 @@ export class ReindexWorker {
|
||||||
this.reindexService = reindexServiceFactory(
|
this.reindexService = reindexServiceFactory(
|
||||||
this.callWithInternalUser,
|
this.callWithInternalUser,
|
||||||
this.xpackInfo,
|
this.xpackInfo,
|
||||||
reindexActionsFactory(this.client, this.callWithInternalUser)
|
reindexActionsFactory(this.client, this.callWithInternalUser),
|
||||||
|
this.log
|
||||||
);
|
);
|
||||||
|
|
||||||
ReindexWorker.workerSingleton = this;
|
ReindexWorker.workerSingleton = this;
|
||||||
|
@ -161,7 +162,7 @@ export class ReindexWorker {
|
||||||
const fakeRequest = { headers: credential } as Request;
|
const fakeRequest = { headers: credential } as Request;
|
||||||
const callCluster = this.callWithRequest.bind(null, fakeRequest) as CallCluster;
|
const callCluster = this.callWithRequest.bind(null, fakeRequest) as CallCluster;
|
||||||
const actions = reindexActionsFactory(this.client, callCluster);
|
const actions = reindexActionsFactory(this.client, callCluster);
|
||||||
const service = reindexServiceFactory(callCluster, this.xpackInfo, actions);
|
const service = reindexServiceFactory(callCluster, this.xpackInfo, actions, this.log);
|
||||||
reindexOp = await swallowExceptions(service.processNextStep, this.log)(reindexOp);
|
reindexOp = await swallowExceptions(service.processNextStep, this.log)(reindexOp);
|
||||||
|
|
||||||
// Update credential store with most recent state.
|
// Update credential store with most recent state.
|
||||||
|
|
|
@ -74,7 +74,12 @@ export function registerReindexIndicesRoutes(
|
||||||
const { indexName } = request.params;
|
const { indexName } = request.params;
|
||||||
const callCluster = callWithRequest.bind(null, request) as CallCluster;
|
const callCluster = callWithRequest.bind(null, request) as CallCluster;
|
||||||
const reindexActions = reindexActionsFactory(client, callCluster);
|
const reindexActions = reindexActionsFactory(client, callCluster);
|
||||||
const reindexService = reindexServiceFactory(callCluster, xpackInfo, reindexActions);
|
const reindexService = reindexServiceFactory(
|
||||||
|
callCluster,
|
||||||
|
xpackInfo,
|
||||||
|
reindexActions,
|
||||||
|
server.log
|
||||||
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!(await reindexService.hasRequiredPrivileges(indexName))) {
|
if (!(await reindexService.hasRequiredPrivileges(indexName))) {
|
||||||
|
@ -118,7 +123,12 @@ export function registerReindexIndicesRoutes(
|
||||||
const { indexName } = request.params;
|
const { indexName } = request.params;
|
||||||
const callCluster = callWithRequest.bind(null, request) as CallCluster;
|
const callCluster = callWithRequest.bind(null, request) as CallCluster;
|
||||||
const reindexActions = reindexActionsFactory(client, callCluster);
|
const reindexActions = reindexActionsFactory(client, callCluster);
|
||||||
const reindexService = reindexServiceFactory(callCluster, xpackInfo, reindexActions);
|
const reindexService = reindexServiceFactory(
|
||||||
|
callCluster,
|
||||||
|
xpackInfo,
|
||||||
|
reindexActions,
|
||||||
|
server.log
|
||||||
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const hasRequiredPrivileges = await reindexService.hasRequiredPrivileges(indexName);
|
const hasRequiredPrivileges = await reindexService.hasRequiredPrivileges(indexName);
|
||||||
|
@ -157,7 +167,12 @@ export function registerReindexIndicesRoutes(
|
||||||
const { indexName } = request.params;
|
const { indexName } = request.params;
|
||||||
const callCluster = callWithRequest.bind(null, request) as CallCluster;
|
const callCluster = callWithRequest.bind(null, request) as CallCluster;
|
||||||
const reindexActions = reindexActionsFactory(client, callCluster);
|
const reindexActions = reindexActionsFactory(client, callCluster);
|
||||||
const reindexService = reindexServiceFactory(callCluster, xpackInfo, reindexActions);
|
const reindexService = reindexServiceFactory(
|
||||||
|
callCluster,
|
||||||
|
xpackInfo,
|
||||||
|
reindexActions,
|
||||||
|
server.log
|
||||||
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await reindexService.cancelReindexing(indexName);
|
await reindexService.cancelReindexing(indexName);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue