Query not completing process and returning no result

Hi guys,

I am using druid 0.9.1.1 stable version

I am facing one big problem while querying historical. I have loaded 5MB segment in historical with 10154 Rows.

Query :

{

“queryType”: “timeseries”,

“dataSource”: “test_cluster”,

“granularity”: “all”,

“aggregations”: [

{

“type”: “count”,

“name”: “numz_count”,

“fieldName”: “numz”

}

],

“intervals”: [

“2016-07-28T00:00/2016-07-28T00:01”

]

}

this query is not working when sending through Rest Client and my different nodes.

Its working correctly as expect if I do CURL directly :

**curl -X POST ‘http://xx.xx.xx.xx:80/druid/v2/?pretty’ -H ‘Content-Type:application/json’ -d ‘{ “queryType”: “timeseries”, “dataSource”: “test_cluster”, “granularity”: “all”, “aggregations”: [ { “type”: “count”, “name”: “numz_count”, “fieldName”: “numz” } ], “intervals”: [ “2016-07-28T00:00/2016-07-28T00:01” ] }’ **

When I am querying from Rest Client or through java.net.HttpURLConnection its not returning any result.

I have attached historical log after querying.

This issue is very hard to understad for me.

I have build all setup of druid with new version but lastly this issue troubling me. Please help me to get this.

Thanks,

Jitesh

queryLog.txt (23.4 KB)

Hey Jitesh,

Do you get data when you query the broker?

One thing the historicals do is that when you query by intervals, they only return data for time ranges where they have the full segment set. So it can look like data is missing when you query them directly. If you try going through the broker you might have better luck.

Thanks for the reply.

Same problem in facing in broker also. Same logs are coming

Hi Jitesh,
Can you also try doing a timeboundary query for your datasource to check that the interval you are quering matches your data interval.

Also, In case timeboundary returns empty result, there might be some issues with loading the segments from deep storage, If that is the case, coordinator and historical node logs should have more information on the root cause.

Cheers,

Nishant

Hi Nishant,

When I do query from that server using curl it is working perfectly.

**curl -X POST ‘http://xx.xx.xx.xx:80/druid/v2/?pretty’ -H ‘Content-Type:application/json’ -d ‘{ “queryType”: “timeseries”, “dataSource”: “test_cluster”, “granularity”: “all”, “aggregations”: [ { “type”: “count”, “name”: “numz_count”, “fieldName”: “numz” } ], “intervals”: [ “2016-07-28T00:00/2016-07-28T00:01” ] }’ **

[{“timestamp”:“2016-07-28T00:00:00.000Z”,“result”:{“numz_count”:10154}}]

But when I am querying from Rest Client. It is not returning proper data.

got it, in that case something is wrong with the rest client that you have written. Hard to tell exactly whats wrong without looking at the client code.
Take a look at the rest client druid integration-tests use for querying broker and make sure you have set correct headers and request type while sending query to druid -

https://github.com/druid-io/druid/blob/master/integration-tests/src/main/java/io/druid/testing/clients/QueryResourceTestClient.java

Thanks Nishant.

I am trying to query with this.

Query :

{

“queryType”: “timeseries”,

“dataSource”: “test_cluster”,

“granularity”: “all”,

“aggregations”: [

{

“type”: “count”,

“name”: “numz_count”,

“fieldName”: “numz”

}

],

“intervals”: [

“2016-07-28T00:00/2016-07-28T00:01”

]

}

Exception :

2016-08-01T18:51:18,511 WARN [qtp718934456-69 - /druid/v2/] io.druid.server.QueryResource [] - Exception occurred on request [unparsable query]

com.fasterxml.jackson.databind.JsonMappingException: Unexpected token (VALUE_STRING), expected FIELD_NAME: missing property ‘queryType’ that is to contain type id (for class io.druid.query.Query)

** at [Source: HttpInputOverHTTP@3bd33b15; line: 1, column: 1]**

am I missing something here ?

If I do with java.net.HttpURLConnection jar Connection reset by peer is coming

java.io.IOException: Connection reset by peer

at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:1.7.0_101]

at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) ~[?:1.7.0_101]

at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) ~[?:1.7.0_101]

at sun.nio.ch.IOUtil.read(IOUtil.java:197) ~[?:1.7.0_101]

at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:384) ~[?:1.7.0_101]

at org.eclipse.jetty.io.ChannelEndPoint.fill(ChannelEndPoint.java:140) [jetty-io-9.2.5.v20141112.jar:9.2.5.v20141112]

at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:230) [jetty-server-9.2.5.v20141112.jar:9.2.5.v20141112]

at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) [jetty-io-9.2.5.v20141112.jar:9.2.5.v20141112]

at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:620) [jetty-util-9.2.5.v20141112.jar:9.2.5.v20141112]

at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:540) [jetty-util-9.2.5.v20141112.jar:9.2.5.v20141112]

at java.lang.Thread.run(Thread.java:745) [?:1.7.0_101]

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;

public class HttpConnection {

    public static String sendPOST(String task, String postURL) throws IOException {
        URL obj = new URL(postURL);
        HttpURLConnection con = (HttpURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Content-Type", "application/json");

        // For POST only - START
        con.setDoOutput(true);
        OutputStream os = con.getOutputStream();
        os.write(task.getBytes());
        os.flush();
        os.close();
        // For POST only - END

        int responseCode = con.getResponseCode();
        System.out.println("POST Response Code :: " + responseCode);

        if (responseCode == HttpURLConnection.HTTP_OK) { //success
            BufferedReader in = new BufferedReader(new InputStreamReader(
                    con.getInputStream()));
            String inputLine;
            StringBuffer response = new StringBuffer();

            while ((inputLine = in.readLine()) != null) {
                response.append(inputLine);
            }
            in.close();

            // print result
            System.out.println(response.toString());
            return response.toString();
        } else {
            System.out.println("POST request not worked");
        }
        return task;
    }

}

``

I made this function. Just need your task as a string and the post url (broker). Can you try it ? It works for me.
Can you try with POSTMAN too ?

it works.

Big Thanks to you.

Thank you

Benjamin, Nishant and Gian !!!