Skip to content

Track synthetic source for disabled objects#108051

Merged
kkrik-es merged 11 commits intoelastic:mainfrom
kkrik-es:fix/synthetic-source/disabled
May 1, 2024
Merged

Track synthetic source for disabled objects#108051
kkrik-es merged 11 commits intoelastic:mainfrom
kkrik-es:fix/synthetic-source/disabled

Conversation

@kkrik-es
Copy link
Copy Markdown
Member

Tracks source for disabled object in _ignored_source metadata field.

Related to #106825

@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Hi @kkrik-es, I've created a changelog YAML for you.

@kkrik-es kkrik-es requested a review from martijnvg April 30, 2024 08:12
@kkrik-es kkrik-es marked this pull request as ready for review April 30, 2024 08:12
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

Copy link
Copy Markdown
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

Looks good. Left two questions.

)
);
}
context.parser().skipChildren();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should context.parser().skipChildren() only be executed if context.isSourceSynthetic() == false? If so then add an else clause here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think it's fine as is, the _ignored_source entry created above includes all children so there's no point to further inspect this object. The tests support that this is the case?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I see, this is a no-op for the new path.

)
);
}
parser.skipChildren();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same question as above.

assertThat(syntheticSource, Matchers.containsString("\"some\":{\"deeply\":{\"nested\":{\"string_value\":\"" + stringValue + "\""));
}

public void testDisabledObjectSingleField() throws IOException {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe add a test with many object fields at the same level (some enabled and some disabled)? I think this should catch the case were the previous skipChildren(...) invocation after XContentDataHelper.encodeToken(...) could be an issue.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

And a yaml test too.

Copy link
Copy Markdown
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

lgtm 👍

@kkrik-es kkrik-es added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Apr 30, 2024
@kkrik-es kkrik-es removed the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Apr 30, 2024
@kkrik-es kkrik-es merged commit 098f1fd into elastic:main May 1, 2024
@kkrik-es kkrik-es deleted the fix/synthetic-source/disabled branch May 17, 2024 10:23
@felixbarny
Copy link
Copy Markdown
Member

Does this also track the source of objects where dynamic mapping is disabled (dynamic: false)?

@kkrik-es
Copy link
Copy Markdown
Member Author

Does this also track the source of objects where dynamic mapping is disabled (dynamic: false)?

No, but I'll take a look at that too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants