-
Notifications
You must be signed in to change notification settings - Fork 104
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
Remove yaml-tests dependency on fdb-record-layer-core test code #3252
Draft
ScottDugas
wants to merge
3
commits into
FoundationDB:main
Choose a base branch
from
ScottDugas:yamsql-remove-test-dependency
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 0 additions & 66 deletions
66
yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/YamlTest.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,14 +20,10 @@ | |
|
||
package com.apple.foundationdb.relational.yamltests.command; | ||
|
||
import com.apple.foundationdb.record.TestHelpers; | ||
import com.apple.foundationdb.record.query.plan.cascades.debug.Debugger; | ||
import com.apple.foundationdb.record.query.plan.debug.DebuggerWithSymbolTables; | ||
import com.apple.foundationdb.relational.api.Continuation; | ||
import com.apple.foundationdb.relational.api.exceptions.RelationalException; | ||
import com.apple.foundationdb.relational.recordlayer.util.ExceptionUtil; | ||
import com.apple.foundationdb.relational.util.Assert; | ||
import com.apple.foundationdb.relational.util.Environment; | ||
import com.apple.foundationdb.relational.yamltests.CustomYamlConstructor; | ||
import com.apple.foundationdb.relational.yamltests.Matchers; | ||
import com.apple.foundationdb.relational.yamltests.YamlConnection; | ||
|
@@ -151,7 +147,6 @@ void executeInternal(@Nonnull final YamlConnection connection) throws SQLExcepti | |
|
||
private void executeInternal(@Nonnull final YamlConnection connection, boolean checkCache, @Nonnull QueryExecutor executor) | ||
throws SQLException, RelationalException { | ||
enableCascadesDebugger(); | ||
boolean shouldExecute = true; | ||
boolean queryIsRunning = false; | ||
Continuation continuation = null; | ||
|
@@ -179,13 +174,13 @@ private void executeInternal(@Nonnull final YamlConnection connection, boolean c | |
// can result in the explain plan being put into the plan cache, so running without the debugger | ||
// can pollute cache and thus interfere with the explain's results | ||
Integer finalMaxRows = maxRows; | ||
runWithDebugger(() -> executor.execute(connection, null, queryConfig, checkCache, finalMaxRows)); | ||
executor.execute(connection, null, queryConfig, checkCache, finalMaxRows); | ||
} else if (QueryConfig.QUERY_CONFIG_EXPLAIN.equals(queryConfig.getConfigName()) || QueryConfig.QUERY_CONFIG_EXPLAIN_CONTAINS.equals(queryConfig.getConfigName())) { | ||
Assert.that(!queryIsRunning, "Explain test should not be intermingled with query result tests"); | ||
// ignore debugger configuration, always set the debugger for explain, so we can always get consistent | ||
// results | ||
Integer finalMaxRows1 = maxRows; | ||
runWithDebugger(() -> executor.execute(connection, null, queryConfig, checkCache, finalMaxRows1)); | ||
executor.execute(connection, null, queryConfig, checkCache, finalMaxRows1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here. |
||
} else if (QueryConfig.QUERY_CONFIG_NO_OP.equals(queryConfig.getConfigName())) { | ||
// Do nothing for noop execution. | ||
continue; | ||
|
@@ -233,31 +228,4 @@ static void reportTestFailure(@Nonnull String message, @Nullable Throwable throw | |
Assertions.fail(message, throwable); | ||
} | ||
} | ||
|
||
private static void runWithDebugger(@Nonnull TestHelpers.DangerousRunnable r) throws SQLException { | ||
final var savedDebugger = Debugger.getDebugger(); | ||
try { | ||
Debugger.setDebugger(DebuggerWithSymbolTables.withoutSanityChecks()); | ||
Debugger.setup(); | ||
r.run(); | ||
} catch (Exception t) { | ||
throw ExceptionUtil.toRelationalException(t).toSqlException(); | ||
} finally { | ||
Debugger.setDebugger(savedDebugger); | ||
} | ||
} | ||
|
||
/** | ||
* Enables internal Cascades debugger which, among other things, sets plan identifiers in a stable fashion making | ||
* it easier to view plans and reproduce planning steps. | ||
* | ||
* @implNote | ||
* This is copied from fdb-relational-core:test subproject to avoid having a dependency just for getting access to it. | ||
*/ | ||
private static void enableCascadesDebugger() { | ||
if (Debugger.getDebugger() == null && Environment.isDebug()) { | ||
Debugger.setDebugger(DebuggerWithSymbolTables.withoutSanityChecks()); | ||
} | ||
Debugger.setup(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This disables all sanity checks within the planner. See
Debugger.isSane()