Skip to content

Add reusable connector smoke test#7155

Merged
findepi merged 2 commits intotrinodb:masterfrom
findepi:findepi/the-true-smoke-test
Mar 5, 2021
Merged

Add reusable connector smoke test#7155
findepi merged 2 commits intotrinodb:masterfrom
findepi:findepi/the-true-smoke-test

Conversation

@findepi
Copy link
Copy Markdown
Member

@findepi findepi commented Mar 4, 2021

Add BaseConnectorSmokeTest, a reusable, slim, fast connector smoke test everyone always wanted, but never dared to ask for one.

@findepi findepi added the test label Mar 4, 2021
@cla-bot cla-bot bot added the cla-signed label Mar 4, 2021
@findepi
Copy link
Copy Markdown
Member Author

findepi commented Mar 4, 2021

Based on #6874 to avoid conflicts.

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 it be TestGlobalTransactionMySqlConnectorSmokeTest or TestGlobalTransactionMySqlSmokeTest?
There is Smoke in class name for Oracle.

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.

TestMySqlGlobalTransactionMyConnectorSmokeTest

Copy link
Copy Markdown
Member

@losipiuk losipiuk left a comment

Choose a reason for hiding this comment

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

Looks reasonable

Copy link
Copy Markdown
Member

@hashhar hashhar left a comment

Choose a reason for hiding this comment

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

Reviewed last two commits since the rest seems to come from another PR. Looks very reasonable.

Thanks a lot for adding this.

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.

Even if it's not a public API, maybe a doc comment here and/or on the class would make this easier to understand.

"Return whether this behavior is enabled by default. If this behavior is based on another behavior, use the given function to determine whether that behavior is enabled."

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.

Does the new method name (hasBehaviorByDefault) help alleviate the concern?

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.

The names on the test class are better, but it doesn't help much on the enum. It's hard to convey the correct meaning of the fallback parameter. Even though the end effect is pretty simple, the way hasBehavior passes itself as a parameter to the enum's method makes me look twice to make sure I'm not confused every time I see it.

I'd probably call it getDefault and give it a doc comment like "get the default setting for this behavior or check the parent behavior using the given function."

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.

Adding

    /**
     * Determines whether a connector should be assumed to have this behavior.
     * 
     * @param fallback callback to be used to inspect connector behaviors, if this behavior is assumed to be had conditionally
     */

here

@findepi findepi force-pushed the findepi/the-true-smoke-test branch from c9a136b to 6cc69b0 Compare March 4, 2021 21:03
@findepi
Copy link
Copy Markdown
Member Author

findepi commented Mar 4, 2021

AC

@losipiuk @hashhar @jirassimok thank you for the review!
please mark resolved when you're satisfied with the response

PTAL

Copy link
Copy Markdown
Member

@hashhar hashhar 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 to me.

@findepi findepi force-pushed the findepi/the-true-smoke-test branch from 58b2dc6 to d42c941 Compare March 5, 2021 13:28
@findepi
Copy link
Copy Markdown
Member Author

findepi commented Mar 5, 2021

Rebased after #6874 merged, no changes otherwise.

SUPPORTS_PREDICATE_PUSHDOWN_WITH_VARCHAR_EQUALITY,
SUPPORTS_PREDICATE_PUSHDOWN_WITH_VARCHAR_INEQUALITY,
SUPPORTS_PREDICATE_PUSHDOWN_WITH_VARCHAR_EQUALITY(SUPPORTS_PREDICATE_PUSHDOWN),
SUPPORTS_PREDICATE_PUSHDOWN_WITH_VARCHAR_INEQUALITY(SUPPORTS_PREDICATE_PUSHDOWN),
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.

These three are on the same axis. Three flavors of the same feature. It looks like having support of something does not fit into boolean domain.

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 don't understand the comment. What do you suggest here?

this(true);
}

TestingConnectorBehavior(boolean defaultBehavior)
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.

What do you mean by default? Connector default? Engine default? Each connector could have different default.

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.

it's whether behavior should be assumed to be had by default

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.

renaming to hasBehaviorByDefault, as the method name it fules

throws Exception
{
oracleServer = new TestingOracleServer();
oracleServer = closeAfterClass(new TestingOracleServer());
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.

separate commit?

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.

that's a mistake, i will take it back

SUPPORTS_INSERT,

SUPPORTS_DELETE(false),
SUPPORTS_ROW_LEVEL_DELETE(SUPPORTS_DELETE),
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.

I don't get. Feature SUPPORTS_ROW_LEVEL_DELETE is by default set to SUPPORTS_DELETE which is by default disabled. How should I read this?

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.

You should read this as:

  • if connector declares that it supports row level delete, then it should be expected to work
  • if connector declares it supports delete (and doesn't say anything about row level delete), then it should be expected to work
  • if connector declares it supports delete, but declares no support for row level delete, then it should be expected not to work
  • if connector declares nothing, no delete should be expected to work

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.

if connector declares it supports delete, but declares no support for row level delete, then it should be expected not to work

You mean it supports delete and does not support row level delete. Does row level delete indicates delete?

Did you mean delete -> metadata delete and row level delete -> delete?

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.

Does row level delete indicates delete?

yes, if a connector supports row level delete, then it does support delete in general

@findepi
Copy link
Copy Markdown
Member Author

findepi commented Mar 5, 2021

AC

@findepi
Copy link
Copy Markdown
Member Author

findepi commented Mar 5, 2021

@kokosing PTAL

SUPPORTS_JOIN_PUSHDOWN_WITH_DISTINCT_FROM(SUPPORTS_JOIN_PUSHDOWN),

SUPPORTS_CREATE_TABLE,
SUPPORTS_CREATE_TABLE_WITH_DATA(SUPPORTS_CREATE_TABLE),
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.

Why not SUPPORTS_CREATE_TABLE_AS?

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.

"AS" is too short, "WITH DATA" may be confusing... any other options?

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.

SUPPORTS_CREATE_TABLE_AS_SELECT is probably better than just _AS.

Though I think WITH_DATA is probably fine. Maybe it could have a doc comment to help anyone who gets confused (some of the others would probably also benefit from doc comments, like JOIN_PUSHDOWN_WITH_DISTINCT_FROM).

(A doc comment for this one could just be {@code CREATE TABLE name AS query}.)

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.

yes, we can add comments here!

@findepi
Copy link
Copy Markdown
Member Author

findepi commented Mar 5, 2021

CI #5758

@findepi findepi force-pushed the findepi/the-true-smoke-test branch from c5417d8 to 8249f87 Compare March 5, 2021 21:18
@findepi findepi merged commit 09f91d8 into trinodb:master Mar 5, 2021
@findepi findepi deleted the findepi/the-true-smoke-test branch March 5, 2021 21:18
@findepi findepi added this to the 353 milestone Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

5 participants