Skip to content

Abstract codec lookup by name, to make CodecService extensible#111007

Merged
ldematte merged 6 commits intoelastic:mainfrom
ldematte:metering/codec-supplier-interface
Jul 24, 2024
Merged

Abstract codec lookup by name, to make CodecService extensible#111007
ldematte merged 6 commits intoelastic:mainfrom
ldematte:metering/codec-supplier-interface

Conversation

@ldematte
Copy link
Copy Markdown
Contributor

@ldematte ldematte commented Jul 18, 2024

This is the minimal change we can make to make it possible for use to provide a custom Codec/DocValuesFormat when using it via EngineConfig in a EnginePlugin's EngineFactory (basically this is just a "extract interface" here).

An alternative (implemented here - main...ldematte/internal-engine-change) is to make InternalEngine#getIndexWriterConfig extensible (protected); I think this one is cleaner and more in line with existing code (e.g. to use a custom Lucene MergePolicy we also make it changeable via EngineFactory), but I'm fine either way.

@ldematte ldematte added >refactoring :Core/Infra/Metrics Metrics and metering infrastructure labels Jul 18, 2024
@ldematte ldematte requested review from a team, mosche and rjernst July 18, 2024 07:22
@elasticsearchmachine elasticsearchmachine added v8.16.0 Team:Core/Infra Meta label for core/infra team labels Jul 18, 2024
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)


import org.apache.lucene.codecs.Codec;

public class FilterCodecService implements CodecSupplier {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not strictly needed here, it will be used by extending code, but thought it would be nice to have (mimicking the various Filter* implementations in Lucene). But I'm OK to remove it if you think it does not belong here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this could be just a lambda, I'd suggest to remove it from ES. But no strong opinion on this.

* @return the {@link CodecSupplier}
*/
public CodecService getCodecService() {
public CodecSupplier getCodecService() {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could/should be renamed, but wanted to check with reviewers names were good (e.g. CodecSupplier) before doing it. Wdyt?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I think it should be renamed unless it touches a million places. Is it going to break the serverless build if renaming?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, but I'll try (add the label)

Copy link
Copy Markdown
Contributor

@mosche mosche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A minor suggestion on the name, but I prefer this approach 👍
lgtm

Copy link
Copy Markdown
Contributor

@mosche mosche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🥇

@ldematte ldematte merged commit aa01639 into elastic:main Jul 24, 2024
@ldematte ldematte deleted the metering/codec-supplier-interface branch July 24, 2024 12:23
weizijun added a commit to weizijun/elasticsearch that referenced this pull request Jul 25, 2024
* main: (39 commits)
  Update README.asciidoc (elastic#111244)
  ESQL: INLINESTATS (elastic#109583)
  ESQL: Document a little of `DataType` (elastic#111250)
  Relax assertions in segment level field stats (elastic#111243)
  LogsDB data generator - support nested object field (elastic#111206)
  Validate `Authorization` header in Azure test fixture (elastic#111242)
  Fixing HistoryStoreTests.testPut() and testStoreWithHideSecrets() (elastic#111246)
  [ESQL] Remove Named Expcted Types map from testing infrastructure  (elastic#111213)
  Change visibility of createWriter to allow tests from a different package to override it (elastic#111234)
  [ES|QL] Remove EsqlDataTypes (elastic#111089)
  Mute org.elasticsearch.repositories.azure.AzureBlobContainerRetriesTests testReadNonexistentBlobThrowsNoSuchFileException elastic#111233
  Abstract codec lookup by name, to make CodecService extensible (elastic#111007)
  Add HTTPS support to `AzureHttpFixture` (elastic#111228)
  Unmuting tests related to free_context action being processed in ESSingleNodeTestCase (elastic#111224)
  Upgrade Azure SDK (elastic#111225)
  Collapse transport versions for 8.14.0 (elastic#111199)
  Make sure contender uses logs templates (elastic#111183)
  unmute HistogramPercentileAggregationTests.testBoxplotHistogram (elastic#111223)
  Refactor Quality Assurance test infrastructure (elastic#111195)
  Mute org.elasticsearch.xpack.restart.FullClusterRestartIT testDisableFieldNameField {cluster=UPGRADED} elastic#111222
  ...

# Conflicts:
#	server/src/main/java/org/elasticsearch/TransportVersions.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Core/Infra/Metrics Metrics and metering infrastructure >refactoring Team:Core/Infra Meta label for core/infra team test-update-serverless v8.16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants