Skip to content

LPD-X Skip the object definition settings read without any edge - #7584

Open
JhossephG wants to merge 2 commits into
liferay:masterfrom
JhossephG:LPD-X-skip-object-definition-settings-read
Open

LPD-X Skip the object definition settings read without any edge#7584
JhossephG wants to merge 2 commits into
liferay:masterfrom
JhossephG:LPD-X-skip-object-definition-settings-read

Conversation

@JhossephG

Copy link
Copy Markdown
Member

What Is Being Fixed

ObjectDefinitionDeployerImpl.deploy read the ObjectDefinitionSetting table (rootObjectDefinitionIds) for the company on every deploy, even for companies with no object definition tree at all — an avoidable query that showed up in deploy/startup traces.

How It Is Being Fixed

A root object definition IDs setting only ever holds a value while an edge object relationship exists: it's written exclusively through ObjectDefinitionTreeUtil's bind/unbind paths, both gated on the relationship's edge flag, and unbind leaves the row present but empty rather than deleting it. deploy now reuses the object relationships map it already loads, checks whether any relationship is an edge, and skips the setting table read entirely when none is — passing an empty map to populateRootObjectDefinitionIds, which produces the same cached result an all-empty settings table would have.

A unit test (Mockito-based, in the same module) locks in this behavior: it asserts the setting read is skipped when no edge relationship exists, and happens when one does, guarding the invariant the optimization depends on.

Reproduces shuyangzhou#12385 with added test coverage.

ObjectDefinitionDeployerImpl.deploy read every root object definition IDs setting for the company on each deploy, an ObjectDefinitionSetting table query that ran even for companies with no object definition tree. A root object definition IDs setting only holds a value while an edge object relationship exists, since that value is written only through ObjectDefinitionTreeUtil's bind and unbind paths, both gated on an edge relationship, and an unbind leaves the row empty rather than deleting it. The deploy path now reuses the object relationships map it already loads, checks whether any relationship is an edge, and skips the setting read entirely when none is, passing an empty map instead. populateRootObjectDefinitionIds then caches an empty array per object definition, which is identical to the result the empty setting rows would have produced.
Verifies ObjectDefinitionDeployerImpl.deploy skips the rootObjectDefinitionIds setting table read when the company has no edge object relationship, and reads it when one exists. This guards the invariant the optimization depends on: the setting is only ever written through ObjectDefinitionTreeUtil's bind and unbind paths, both gated on an edge relationship, so a company without an edge can never have a meaningful row to miss.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant