Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't persist type information to translog #47229

Merged
merged 9 commits into from
Oct 15, 2019

Conversation

romseygeek
Copy link
Contributor

We no longer need to store type information in the translog, given that an index
can only have a single type.

Relates to #41059

@romseygeek romseygeek added :Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. >refactoring v8.0.0 labels Sep 27, 2019
@romseygeek romseygeek requested a review from dnhatn September 27, 2019 15:43
@romseygeek romseygeek self-assigned this Sep 27, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

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

Looks great. Thanks, @romseygeek.

I left two comments relating to BWC in translog. I will need some time to look carefully at other files.

@dnhatn dnhatn self-requested a review September 30, 2019 22:08
Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks, @romseygeek for your huge effort. I left two smaller comments.

@@ -155,7 +155,7 @@ public void testResyncDoesNotBlockOnPrimaryAction() throws Exception {

final byte[] bytes = "{}".getBytes(Charset.forName("UTF-8"));
final ResyncReplicationRequest request = new ResyncReplicationRequest(shardId, 42L, 100,
new Translog.Operation[]{new Translog.Index("type", "id", 0, primaryTerm, 0L, bytes, null, -1)});
new Translog.Operation[]{new Translog.Index("type", 0, primaryTerm, 0L, bytes, null, -1)});
Copy link
Member

Choose a reason for hiding this comment

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

We should keep "id" instead of "type" here.

@@ -83,7 +83,7 @@ private void applyOperation(Engine engine, Engine.Operation operation) throws IO
Engine.Index engineIndex = (Engine.Index) operation;
Mapping update = engineIndex.parsedDoc().dynamicMappingsUpdate();
if (engineIndex.parsedDoc().dynamicMappingsUpdate() != null) {
recoveredTypes.compute(engineIndex.type(), (k, mapping) -> mapping == null ? update : mapping.merge(update));
recoveredTypes.compute("", (k, mapping) -> mapping == null ? update : mapping.merge(update));
Copy link
Member

@dnhatn dnhatn Oct 14, 2019

Choose a reason for hiding this comment

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

I think we should remove "recoveredTypes" and adjust the related tests.

@romseygeek
Copy link
Contributor Author

Thanks @dnhatn, I pushed a change removing recoveredTypes, and also TranslogHandler.mappingUpdate which only seemed to be set by tests.

@romseygeek
Copy link
Contributor Author

@elasticmachine update branch

@romseygeek romseygeek merged commit 6531369 into elastic:master Oct 15, 2019
@romseygeek romseygeek deleted the types-removal/translog branch October 15, 2019 08:05
@jpountz jpountz mentioned this pull request Oct 15, 2019
66 tasks
@pgomulka pgomulka mentioned this pull request Mar 25, 2020
66 tasks
dnhatn added a commit that referenced this pull request Jul 7, 2020
We stopped persisting the doctype in translog since #47229. We should 
also stop storing the uid as we can construct it from the single mapping
doctype and the id.

Relates #47229
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. >refactoring v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants