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

Vinai/more dbeaver stuff #1455

Merged
merged 30 commits into from
Mar 19, 2021
Merged

Vinai/more dbeaver stuff #1455

merged 30 commits into from
Mar 19, 2021

Conversation

VinaiRachakonda
Copy link
Contributor

@VinaiRachakonda VinaiRachakonda commented Mar 17, 2021

This pr unblocks basic dbeaver functionality.

@VinaiRachakonda
Copy link
Contributor Author

This pr needs a bumped gms before review.

Copy link
Member

@zachmu zachmu left a comment

Choose a reason for hiding this comment

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

Mostly good, just a few comments about the test logic

go/go.mod Outdated
@@ -78,4 +78,6 @@ require (

replace github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi => ./gen/proto/dolt/services/eventsapi

replace github.com/dolthub/go-mysql-server => /Users/vinairachakonda/go/src/dolthub/go-mysql-server
Copy link
Member

Choose a reason for hiding this comment

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

Remove this, go get github.com/dolthub/go-mysql-server@master instead

if currentDb == "" {
return sql.ErrNoDatabaseSelected.New()
func (sess *DoltSession) CommitTransaction(ctx *sql.Context, dbName string) error {
if dbName == "" {
Copy link
Member

Choose a reason for hiding this comment

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

When does this happen?

Copy link
Member

Choose a reason for hiding this comment

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

Leave a comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was a bug that was happening when dbeaver would run a query and throw a "commit" statement when no database was selected. For some reason even with autocommit off, dbeaver forces these transaction statements on you.

skiponwindows "Has dependencies that are missing on the Jenkins Windows installation."

cd repo1
start_sql_server repo1
Copy link
Member

Choose a reason for hiding this comment

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

Make sure this is actually testing what you think it is. These test helper methods definitely use a particular database one way or another.

Would be better to pass repo2 here, since you're operating on repo1 below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So each of these queries form a new connection to the server. So if start_sql_server does in fact connect to the db, the unselected_sql_query will only connect to the serve but not the db. I can add an additional statement validating that no database is selected to give more clarity

Copy link
Member

Choose a reason for hiding this comment

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

Just use repo2.one_pk etc. I know what you're doing is right, but you don't know how the underlying code might change and make your test worthless. If want the test to be durable, run the statements on a different database than the one you're giving as an argument to start_sql_server

unselected_update_query 1 "DELETE FROM repo1.one_pk WHERE pk=3"
unselected_server_query 1 "SELECT * FROM repo1.one_pk" "pk\n0\n1"

# We don't have transactions but some editors will throws this commit statement along
Copy link
Member

Choose a reason for hiding this comment

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

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that was just a sanity check that someone typing "commit" into the server doesn't mess anything up

Copy link
Member

Choose a reason for hiding this comment

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

I mean the comment doesn't make sense, read it again

# In the event that the results do not match expectations, the python process will exit with an exit code of 1
# * param1 is 1 for autocommit = true, 0 for autocommit = false
# * param2 is the query_str
unselected_server_query() {
Copy link
Member

Choose a reason for hiding this comment

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

How is this different from server_query?

Copy link
Contributor Author

@VinaiRachakonda VinaiRachakonda Mar 18, 2021

Choose a reason for hiding this comment

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

This does not connect to a database. The normal server_query uses $DEFAULT_DB variable which translates to USE DB. Since we're not connecting to a database the engine does not have a currentDB set

Copy link
Member

Choose a reason for hiding this comment

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

Ah ok, i missed that bit

# unselected_update_query runs an update query and should be called with 2 parameters
# * param1 is 1 for autocommit = true, 0 for autocommit = false
# * param2 is the query string
unselected_update_query() {
Copy link
Member

Choose a reason for hiding this comment

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

See above question, not sure what these methods are doing different

unselected_update_query 1 "DELETE FROM repo1.one_pk WHERE pk=3"
unselected_server_query 1 "SELECT * FROM repo1.one_pk" "pk\n0\n1"

# We don't have transactions but some editors will throws this commit statement along
Copy link
Member

Choose a reason for hiding this comment

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

I mean the comment doesn't make sense, read it again

# In the event that the results do not match expectations, the python process will exit with an exit code of 1
# * param1 is 1 for autocommit = true, 0 for autocommit = false
# * param2 is the query_str
unselected_server_query() {
Copy link
Member

Choose a reason for hiding this comment

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

Ah ok, i missed that bit

skiponwindows "Has dependencies that are missing on the Jenkins Windows installation."

cd repo1
start_sql_server repo1
Copy link
Member

Choose a reason for hiding this comment

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

Just use repo2.one_pk etc. I know what you're doing is right, but you don't know how the underlying code might change and make your test worthless. If want the test to be durable, run the statements on a different database than the one you're giving as an argument to start_sql_server

@VinaiRachakonda VinaiRachakonda changed the title [wip] Vinai/more dbeaver stuff Vinai/more dbeaver stuff Mar 19, 2021
@VinaiRachakonda VinaiRachakonda merged commit de8f4d9 into master Mar 19, 2021
@VinaiRachakonda VinaiRachakonda deleted the vinai/more-dbeaver-stuff branch March 19, 2021 18:01
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.

2 participants