diff --git a/README.md b/README.md index ee81056..f96fdae 100644 --- a/README.md +++ b/README.md @@ -183,13 +183,19 @@ also known as namespace in some environments. ``` Type: string -Valid values: comma-separated list of key=value session properties +Valid values: semicolon-separated list of key:value session properties (e.g. key1:value1;key2:value2) Default: empty ``` The `session_properties` parameter must contain valid parameters accepted by the Trino server. Run `SHOW SESSION` in Trino to get the current list. +Example: + +``` +session_properties=query_max_run_time:2s;query_priority:1 +``` + ##### `custom_client` ``` @@ -256,7 +262,7 @@ http://user@localhost:8080?source=hello&catalog=default&schema=foobar ``` ``` -https://user@localhost:8443?session_properties=query_max_run_time=10m,query_priority=2 +https://user@localhost:8443?session_properties=query_max_run_time:10m;query_priority:2 ``` ## Data types diff --git a/trino/integration_test.go b/trino/integration_test.go index a871cab..9c85519 100644 --- a/trino/integration_test.go +++ b/trino/integration_test.go @@ -349,6 +349,23 @@ func waitForContainerHealth(containerID, containerName string) { } } +func waitForTrinoReady(t *testing.T, db *sql.DB) { + if err := pool.Retry(func() error { + row := db.QueryRow("SELECT count(*) FROM system.runtime.nodes WHERE state = 'active'") + var count int + if row.Scan(&count) != nil { + t.Logf("Failed to query nodes: %v", row.Err()) + return errors.New("Not ready") + } + if count > 0 { + return nil + } + return errors.New("Not ready") + }); err != nil { + log.Fatal("Timed out waiting for Trino to be ready") + } +} + func generateCerts(dir string) error { priv, err := rsa.GenerateKey(rand.Reader, 2048) if err != nil { @@ -474,6 +491,7 @@ func integrationOpen(t *testing.T, dsn ...string) *sql.DB { if err != nil { t.Fatal(err) } + waitForTrinoReady(t, db) return db }