Allow starting Elasticsearch container with VM options in query runner#11405
Allow starting Elasticsearch container with VM options in query runner#11405ebyhr merged 1 commit intotrinodb:masterfrom
Conversation
There was a problem hiding this comment.
This should be a proper argument to the query runner, not a magic system property
There was a problem hiding this comment.
a proper argument to the query runner"
Do you mean passing as String[] args in the main method? The reason I used a system property is #3322 (comment)
There was a problem hiding this comment.
How is the server lifecycle managed? How does it get stopped?
There was a problem hiding this comment.
The underlying container would be managed by Testcontainers ryuk. It will be closed with some delay when stopping the query runner.
There was a problem hiding this comment.
We have some rudimentary support for "container reuse", which i think it what you're looking for.
I propose you use that, and let's avoid adding a yet new method of skipping container creation.
BTW, for manual testing, I find PT envs very useful. ptl env up .. --without-trino + DevelopmentServer is what i use locally. This requires no changes in the query runners. Of course, this works for manual testing, and doesn't work for running integration tests (those using QueryRunner), but i understand this is the use-case you're addressing here.
There was a problem hiding this comment.
BTW starting ElasticsearchServer should actually be the default (and maybe the only) behavior of ElasticsearchQueryRunner::main
There was a problem hiding this comment.
I don’t think so. When I wrote that class and method, the goal was to be able to run Trino against an external ES instance so that I could try multiple different ES configurations (single node, a cluster, AWS ES, etc) as I was developing it. Hardcoding it defeats that purpose.
There was a problem hiding this comment.
@martint i see your point, but that's not how QueryRunners.main are generally implemented.
They are self-contained first and foremost, and then re-usable if needed. I don't think ES should be special here.
There was a problem hiding this comment.
How about adding another query runner for external service usage? Then, we can use ElasticsearchQueryRunner for dockerized environment.
public final class ElasticsearchExternalQueryRunner
{
private ElasticsearchExternalQueryRunner() {}
public static void main(String[] args)
throws Exception
{
Logging.initialize();
DistributedQueryRunner queryRunner = createElasticsearchQueryRunner(
HostAndPort.fromParts("localhost", 9200),
TpchTable.getTables(),
ImmutableMap.of("http-server.http.port", "8080"),
ImmutableMap.of(),
3);
Logger log = Logger.get(ElasticsearchExternalQueryRunner.class);
log.info("======== SERVER STARTED ========");
log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
}There was a problem hiding this comment.
@ebyhr that sounds like a reasonable compromise.
in the ElasticsearchExternalQueryRunner please include a comment intructing hwo to start this external thing
137ebc8 to
146422d
Compare
There was a problem hiding this comment.
Use same version as one used in TestElasticsearch7ConnectorTest (define a constant)
Also, add ElasticsearchExternalQueryRunner to allow connecting to existing Elasticserver instances and define a constant for version 7 image name.
146422d to
f08c6b0
Compare
|
Merged. @martint You need to change IntelliJ run setting to use |
Description
Allow starting Elasticsearch container with VM options in query runner
Documentation
(x) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.
Release notes
(x) No release notes entries required.
( ) Release notes entries required with the following suggested text: