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 TASK_SCALE_WRITERS_MAX_WRITER_COUNT in test #18276

Merged
merged 1 commit into from
Jul 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
package io.trino.plugin.jdbc;

import io.trino.Session;
import io.trino.spi.connector.ConnectorSession;
import io.trino.testing.AbstractTestQueryFramework;
import org.intellij.lang.annotations.Language;
Expand All @@ -28,6 +29,7 @@
import java.util.concurrent.atomic.AtomicInteger;

import static com.google.common.base.Verify.verify;
import static io.trino.SystemSessionProperties.TASK_SCALE_WRITERS_MAX_WRITER_COUNT;
import static java.util.Collections.synchronizedMap;
import static java.util.Objects.requireNonNull;
import static org.assertj.core.api.Assertions.assertThat;
Expand Down Expand Up @@ -61,7 +63,11 @@ protected void assertJdbcConnections(@Language("SQL") String query, int expected
assertQueryFails(query, errorMessage.get());
}
else {
getQueryRunner().execute(query);
// Disabling writers scaling to make expected number of opened connections constant
Session querySession = Session.builder(getSession())
.setSystemProperty(TASK_SCALE_WRITERS_MAX_WRITER_COUNT, "4")
Copy link
Member

Choose a reason for hiding this comment

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

nit: add a comment

Copy link
Member Author

Choose a reason for hiding this comment

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

added

Copy link
Member

@gaurav8297 gaurav8297 Jul 13, 2023

Choose a reason for hiding this comment

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

@kokosing To disable scaling it might be better to set task_scale_writers_enabled to false.

https://trino.io/docs/current/admin/properties-writer-scaling.html#task-scale-writers-enabled

.build();
getQueryRunner().execute(querySession, query);
}
int after = connectionFactory.openConnections.get();
assertThat(after - before).isEqualTo(expectedJdbcConnectionsCount);
Expand Down