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

Fix SeekGE in DDB #6561

Merged
merged 9 commits into from Sep 10, 2023
Merged

Fix SeekGE in DDB #6561

merged 9 commits into from Sep 10, 2023

Conversation

itaiad200
Copy link
Contributor

closes #6558

@itaiad200 itaiad200 added the include-changelog PR description should be included in next release changelog label Sep 8, 2023
@itaiad200 itaiad200 marked this pull request as ready for review September 8, 2023 20:04
pkg/kv/cosmosdb/store_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

Think we can just remove this file and move the code left to the test entry function.
No need global kvparams and etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

pkg/kv/kvtest/iterators.go Outdated Show resolved Hide resolved
pkg/kv/local/store_test.go Outdated Show resolved Hide resolved
pkg/kv/mem/store_test.go Outdated Show resolved Hide resolved
@@ -49,7 +48,7 @@ func runDBInstance(dockerPool *dockertest.Pool) (string, func()) {
// create connection
var pgPool *pgxpool.Pool
port := resource.GetPort("5432/tcp")
uri := fmt.Sprintf("postgres://lakefs:lakefs@localhost:%s/lakefs_db?sslmode=disable", port)
uri := fmt.Sprintf("postgres://lakefs:lakefs@localhost:%s/%s?sslmode=disable", port, dbName)
Copy link
Contributor

Choose a reason for hiding this comment

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

wrap dbName with call to url.PathEscape

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest to keep the same database name and have each test create a different db or scheme on the same instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

pkg/kv/postgres/store_test.go Outdated Show resolved Hide resolved
Co-authored-by: Barak Amar <barak.amar@treeverse.io>

// create a new schema per test
schemaName := "test_schema" + testutil.UniqueName()
_, err = conn.Exec(context.Background(), fmt.Sprintf("CREATE SCHEMA IF NOT EXISTS %s;", schemaName))
Copy link
Contributor

Choose a reason for hiding this comment

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

Use connection's QuoteIdentifier to quote the schemaName value.
Check the following if it works:

Suggested change
_, err = conn.Exec(context.Background(), fmt.Sprintf("CREATE SCHEMA IF NOT EXISTS %s;", schemaName))
_, err = conn.Exec(ctx, "CREATE SCHEMA IF NOT EXISTS " + conn. QuoteIdentifier(schemaName))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can't. I simply escaped it

schemaName := "test_schema" + testutil.UniqueName()
_, err = conn.Exec(context.Background(), fmt.Sprintf("CREATE SCHEMA IF NOT EXISTS %s;", schemaName))
if err != nil {
t.Fatalf("Error creating schema: %v", err)
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
t.Fatalf("Error creating schema: %v", err)
t.Fatalf("Error creating schema '%s': %s", schemaName, err)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


store, err := kv.Open(ctx, kvparams.Config{
Type: postgres.DriverName,
Postgres: &kvparams.Postgres{ConnectionString: databaseURI, ScanPageSize: 10},
Postgres: &kvparams.Postgres{ConnectionString: fmt.Sprintf("%s&search_path=%s", databaseURI, schemaName), ScanPageSize: kvtest.MaxPageSize},
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to url parse the connection string to add qs parameter

Copy link
Contributor

@nopcoder nopcoder left a comment

Choose a reason for hiding this comment

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

LGTM left some minor comments

@itaiad200 itaiad200 merged commit 1b4a32d into master Sep 10, 2023
33 checks passed
@itaiad200 itaiad200 deleted the 6558-import-ddb-bug branch September 10, 2023 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
include-changelog PR description should be included in next release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Deleting imported directory results in ValidationException when listing parent directory
2 participants