-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configured elastic index to have replicas configurable by tenant (#7676)
* Configured elastic index to have replicas configurable by tenant * Changed esUseReplicas to esReplicas: number * Added flag for REINDEX_WITH_OPTIMIZATION * Renamed wrongly named feature * Upped version
- Loading branch information
Showing
9 changed files
with
83 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { tenants } from '../tenantContext'; | ||
import { getTenantESMapping } from '../tenantESMapping'; | ||
|
||
describe('tenantESMapping', () => { | ||
describe('getTenantESMapping', () => { | ||
it('should use the base elastic mapping', async () => { | ||
tenants.add({ | ||
name: 'test-tenant', | ||
dbName: 'test-tenant-db', | ||
}); | ||
|
||
await tenants.run(async () => { | ||
expect(getTenantESMapping().settings['index.number_of_replicas']).toBe(0); | ||
}, 'test-tenant'); | ||
}); | ||
|
||
it('should use the append tenant specific configuration to base mapping', async () => { | ||
tenants.add({ | ||
name: 'test-tenant', | ||
dbName: 'test-tenant-db', | ||
featureFlags: { esReplicas: 2 }, | ||
}); | ||
|
||
await tenants.run(async () => { | ||
expect(getTenantESMapping().settings['index.number_of_replicas']).toBe(2); | ||
}, 'test-tenant'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { tenants } from './index'; | ||
import elasticMapping from '../../../database/elastic_mapping/elastic_mapping'; | ||
|
||
const getTenantESMapping = () => { | ||
const tenantElasticMapping = { | ||
settings: { ...elasticMapping.settings }, | ||
mappings: { ...elasticMapping.mappings }, | ||
}; | ||
|
||
tenantElasticMapping.settings['index.number_of_replicas'] = | ||
tenants.current().featureFlags?.esReplicas || 0; | ||
|
||
return tenantElasticMapping; | ||
}; | ||
|
||
export { getTenantESMapping }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters