You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Vladimir Ozerov (JIRA)" <ji...@apache.org> on 2017/08/10 11:29:01 UTC

[jira] [Commented] (IGNITE-5991) SQL: lazy ResultSet for map query

    [ https://issues.apache.org/jira/browse/IGNITE-5991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16121498#comment-16121498 ] 

Vladimir Ozerov commented on IGNITE-5991:
-----------------------------------------

After consulting with H2 maintainers [1], the following solution was found: 
1) Add {{lazy}} hint to API
2) Apply it only to cases when there is only one map query
3) Set lazy execution flag on mapper on per-query basis through {{Session.setLazyQueryExecution}}
4) Create new thread pool - query engine obtains locks which must be released in the same thread
5) Handle {{GridQueryNextPageResponse.allRows == -1}} properly on client's side, currently it leads to extra {{GridQueryNextPageRequest}}

[1] https://github.com/h2database/h2database/issues/588

> SQL: lazy ResultSet for map query
> ---------------------------------
>
>                 Key: IGNITE-5991
>                 URL: https://issues.apache.org/jira/browse/IGNITE-5991
>             Project: Ignite
>          Issue Type: Improvement
>          Components: sql
>    Affects Versions: 2.1
>            Reporter: Vladimir Ozerov
>            Assignee: Vladimir Ozerov
>            Priority: Critical
>             Fix For: 2.2
>
>
> Currently we move the whole {{ResultSet}} to memory when executing SQL query on mapper. If result set is large enough, this could easily bring server down due to high GC pressure or even OOME. 
> To avoid that we should stream H2's {{ResultSet}} to our own consumer, which will construct a page and send it to the client  When a page is sent, consumer will block current thread until "next page request" is received. This approach has disadvantage - query thread will be blocked. However, implementation should be fairly easy and will allow us to avoid OOMEs on server. In future we will improve it to minimize blocking (or even avoid it completely).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)