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

formatting explain with stable aliases #3015

Merged
merged 10 commits into from
Jan 9, 2025

Conversation

normen662
Copy link
Contributor

@normen662 normen662 commented Jan 6, 2025

Reimplementation of stringification of plans:

  1. differentiation of use cases: for debugging versus for external explain
  2. external explains use self contained symbols; for debugging uses plan aliases
  3. iterated on ExplainPlanVisitor to create a token list in a first step then is then rendered in a second step
  4. all TreeLikes get explain methods that are called from toString()
  5. two renderers:
    a. renderer for external explains and logging(supports maximum length as well as different explain levels: STRUCTURE, SOME_DETAILS, ALL_DETAILS
    b. renderer for pretty explain
Screenshot 2025-01-07 at 11 48 18

@foundationdb-ci
Copy link
Contributor

Result of fdb-record-layer-pr on Linux CentOS 7

  • Commit ID: 2854ca4
  • Duration 0:47:19
  • Result: ❌ FAILED
  • Error: Error while executing command: ./gradlew --no-daemon --console=plain -b ./build.gradle build destructiveTest -PcoreNotStrict -PreleaseBuild=false -PpublishBuild=false -PspotbugsEnableHtmlReport. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of fdb-record-layer-pr on Linux CentOS 7

  • Commit ID: 0bb6fde
  • Duration 0:34:25
  • Result: ❌ FAILED
  • Error: Error while executing command: ./gradlew --no-daemon --console=plain -b ./build.gradle build destructiveTest -PcoreNotStrict -PreleaseBuild=false -PpublishBuild=false -PspotbugsEnableHtmlReport. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of fdb-record-layer-pr on Linux CentOS 7

  • Commit ID: 45974e7
  • Duration 0:35:49
  • Result: ❌ FAILED
  • Error: Error while executing command: ./gradlew --no-daemon --console=plain -b ./build.gradle build destructiveTest -PcoreNotStrict -PreleaseBuild=false -PpublishBuild=false -PspotbugsEnableHtmlReport. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@normen662 normen662 requested a review from hatyo January 7, 2025 20:38
@foundationdb-ci
Copy link
Contributor

Result of fdb-record-layer-pr on Linux CentOS 7

  • Commit ID: 5f1e42f
  • Duration 0:47:24
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of fdb-record-layer-pr on Linux CentOS 7

  • Commit ID: e49c3ef
  • Duration 0:47:01
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

Copy link
Collaborator

@alecgrieser alecgrieser left a comment

Choose a reason for hiding this comment

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

I've only looked at the new formatter framework classes so far, but I figured you'd want feedback on that first, so I'm submitting what I have now

Comment on lines -366 to +370
logger.debug(KeyValueLogMessage.of("explain of plan",
logger.debug(KeyValueLogMessage.of("GML explain of plan",
"explain", PlannerGraphProperty.explain(singleRoot)));
logger.debug(KeyValueLogMessage.of("string explain of plan",
"explain", ExplainPlanVisitor.toStringForDebugging((RecordQueryPlan)singleRoot)));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be consolidated into a single log message with both the GML and the string explain? Arguably, this should just have the string explain, as I think that will be more useful for humans reading through the logs, if we even want to rely on this log line at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is not enough testing for GML that's why it's there in the first place. Maybe I should open a ticket for that. For now I think this is safer and will not ever be triggered other than in local debugging sessions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay, got it. But would it make sense to collapse both calls to a single log message, like:

logger.debug(KeyValueLogMessage.of("explain of plan",
    "explain_gml", PlannerGraphProperty.explain(singleRoot),
    "explain_string", ExplainPlanVisitor.toStringForDebugging((RecordQueryPlan)singleRoot)));

I think you get the same amount of coverage, but only one log message. Which is something we sort of care about, even for debug logs

@foundationdb-ci
Copy link
Contributor

Result of fdb-record-layer-pr on Linux CentOS 7

  • Commit ID: 01f1689
  • Duration 0:47:03
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci
Copy link
Contributor

Result of fdb-record-layer-pr on Linux CentOS 7

  • Commit ID: a677078
  • Duration 0:47:09
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

alecgrieser
alecgrieser previously approved these changes Jan 8, 2025
}

@Nonnull
ExplainTokensWithPrecedence explain(@Nonnull Iterable<Supplier<ExplainTokensWithPrecedence>> explainSuppliers);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ExplainTokensWithPrecedence explain(@Nonnull Iterable<Supplier<ExplainTokensWithPrecedence>> explainSuppliers);
ExplainTokensWithPrecedence explain(@Nonnull Iterable<Supplier<ExplainTokensWithPrecedence>> childrenExplainSuppliers);

@foundationdb-ci
Copy link
Contributor

Result of fdb-record-layer-pr on Linux CentOS 7

  • Commit ID: 0917e96
  • Duration 0:47:11
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

Copy link
Contributor

@hatyo hatyo left a comment

Choose a reason for hiding this comment

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

LGTM, nice work!

@normen662 normen662 merged commit 8386a32 into FoundationDB:main Jan 9, 2025
1 check passed
g31pranjal pushed a commit to g31pranjal/fdb-record-layer that referenced this pull request Jan 14, 2025
* numerous refactorings from describe and explain

* rewriting the explain visitor

* able to render plan explains

* explain levels

* unit tests work

* touch ups

* added documentation

* addressing Alec's comments

* more renamings

* addressing yhatem's comments
alecgrieser pushed a commit to alecgrieser/fdb-record-layer that referenced this pull request Jan 21, 2025
* numerous refactorings from describe and explain

* rewriting the explain visitor

* able to render plan explains

* explain levels

* unit tests work

* touch ups

* added documentation

* addressing Alec's comments

* more renamings

* addressing yhatem's comments
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.

4 participants