Search in sources :

Example 1 with LatestByAllIndexedJob

use of io.questdb.griffin.engine.table.LatestByAllIndexedJob in project questdb by bluestreak01.

the class LatestByParallelTest method execute.

protected static void execute(@Nullable WorkerPool pool, LatestByRunnable runnable, CairoConfiguration configuration) throws Exception {
    final int workerCount = pool == null ? 1 : pool.getWorkerCount();
    try (final CairoEngine engine = new CairoEngine(configuration);
        final SqlCompiler compiler = new SqlCompiler(engine)) {
        try (final SqlExecutionContext sqlExecutionContext = new SqlExecutionContextImpl(engine, workerCount)) {
            try {
                if (pool != null) {
                    pool.assignCleaner(Path.CLEANER);
                    pool.assign(new LatestByAllIndexedJob(engine.getMessageBus()));
                    pool.start(LOG);
                }
                runnable.run(engine, compiler, sqlExecutionContext);
                Assert.assertEquals(0, engine.getBusyWriterCount());
                Assert.assertEquals(0, engine.getBusyReaderCount());
            } finally {
                if (pool != null) {
                    pool.halt();
                }
            }
        }
    }
}
Also used : CairoEngine(io.questdb.cairo.CairoEngine) LatestByAllIndexedJob(io.questdb.griffin.engine.table.LatestByAllIndexedJob)

Example 2 with LatestByAllIndexedJob

use of io.questdb.griffin.engine.table.LatestByAllIndexedJob in project questdb by bluestreak01.

the class HttpServer method addDefaultEndpoints.

public static void addDefaultEndpoints(HttpServer server, HttpServerConfiguration configuration, CairoEngine cairoEngine, WorkerPool workerPool, HttpRequestProcessorBuilder jsonQueryProcessorBuilder, FunctionFactoryCache functionFactoryCache) {
    server.bind(new HttpRequestProcessorFactory() {

        @Override
        public HttpRequestProcessor newInstance() {
            return jsonQueryProcessorBuilder.newInstance();
        }

        @Override
        public String getUrl() {
            return "/exec";
        }
    });
    server.bind(new HttpRequestProcessorFactory() {

        @Override
        public HttpRequestProcessor newInstance() {
            return new TextImportProcessor(cairoEngine);
        }

        @Override
        public String getUrl() {
            return "/imp";
        }
    });
    server.bind(new HttpRequestProcessorFactory() {

        @Override
        public HttpRequestProcessor newInstance() {
            return new TextQueryProcessor(configuration.getJsonQueryProcessorConfiguration(), cairoEngine, workerPool.getWorkerCount(), functionFactoryCache);
        }

        @Override
        public String getUrl() {
            return "/exp";
        }
    });
    server.bind(new HttpRequestProcessorFactory() {

        @Override
        public HttpRequestProcessor newInstance() {
            return new TableStatusCheckProcessor(cairoEngine, configuration.getJsonQueryProcessorConfiguration());
        }

        @Override
        public String getUrl() {
            return "/chk";
        }
    });
    server.bind(new HttpRequestProcessorFactory() {

        @Override
        public HttpRequestProcessor newInstance() {
            return new StaticContentProcessor(configuration);
        }

        @Override
        public String getUrl() {
            return HttpServerConfiguration.DEFAULT_PROCESSOR_URL;
        }
    });
    // jobs that help parallel execution of queries
    workerPool.assign(new ColumnIndexerJob(cairoEngine.getMessageBus()));
    workerPool.assign(new GroupByJob(cairoEngine.getMessageBus()));
    workerPool.assign(new LatestByAllIndexedJob(cairoEngine.getMessageBus()));
}
Also used : GroupByJob(io.questdb.griffin.engine.groupby.vect.GroupByJob) LatestByAllIndexedJob(io.questdb.griffin.engine.table.LatestByAllIndexedJob) ColumnIndexerJob(io.questdb.cairo.ColumnIndexerJob)

Aggregations

LatestByAllIndexedJob (io.questdb.griffin.engine.table.LatestByAllIndexedJob)2 CairoEngine (io.questdb.cairo.CairoEngine)1 ColumnIndexerJob (io.questdb.cairo.ColumnIndexerJob)1 GroupByJob (io.questdb.griffin.engine.groupby.vect.GroupByJob)1