[jira] [Updated] (DRILL-5443) Managed External Sort fails with OOM while spilling to disk

2017-08-29 Thread Robert Hou (JIRA)

 [ 
https://issues.apache.org/jira/browse/DRILL-5443?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Hou updated DRILL-5443:
--
Attachment: drill5443.drillbit.log
265a014b-8cae-30b5-adab-ff030b6c7086.sys.drill

> Managed External Sort fails with OOM while spilling to disk
> ---
>
> Key: DRILL-5443
> URL: https://issues.apache.org/jira/browse/DRILL-5443
> Project: Apache Drill
>  Issue Type: Bug
>  Components: Execution - Relational Operators
>Affects Versions: 1.10.0, 1.11.0
>Reporter: Rahul Challapalli
>Assignee: Paul Rogers
> Fix For: 1.12.0
>
> Attachments: 265a014b-8cae-30b5-adab-ff030b6c7086.sys.drill, 
> 27016969-ef53-40dc-b582-eea25371fa1c.sys.drill, drill5443.drillbit.log, 
> drillbit.log
>
>
> git.commit.id.abbrev=3e8b01d
> The below query fails with an OOM
> {code}
> ALTER SESSION SET `exec.sort.disable_managed` = false;
> alter session set `planner.width.max_per_node` = 1;
> alter session set `planner.disable_exchanges` = true;
> alter session set `planner.width.max_per_query` = 1;
> alter session set `planner.memory.max_query_memory_per_node` = 52428800;
> select s1.type type, flatten(s1.rms.rptd) rptds from (select d.type type, 
> d.uid uid, flatten(d.map.rm) rms from 
> dfs.`/drill/testdata/resource-manager/nested-large.json` d order by d.uid) s1 
> order by s1.rms.mapid;
> {code}
> Exception from the logs
> {code}
> 2017-04-24 17:22:59,439 [27016969-ef53-40dc-b582-eea25371fa1c:frag:0:0] INFO  
> o.a.d.e.p.i.x.m.ExternalSortBatch - User Error Occurred: External Sort 
> encountered an error while spilling to disk (Unable to allocate buffer of 
> size 524288 (rounded from 307197) due to memory limit. Current allocation: 
> 25886728)
> org.apache.drill.common.exceptions.UserException: RESOURCE ERROR: External 
> Sort encountered an error while spilling to disk
> [Error Id: a64e3790-3a34-42c8-b4ea-4cb1df780e63 ]
> at 
> org.apache.drill.common.exceptions.UserException$Builder.build(UserException.java:544)
>  ~[drill-common-1.11.0-SNAPSHOT.jar:1.11.0-SNAPSHOT]
> at 
> org.apache.drill.exec.physical.impl.xsort.managed.ExternalSortBatch.doMergeAndSpill(ExternalSortBatch.java:1445)
>  [drill-java-exec-1.11.0-SNAPSHOT.jar:1.11.0-SNAPSHOT]
> at 
> org.apache.drill.exec.physical.impl.xsort.managed.ExternalSortBatch.mergeAndSpill(ExternalSortBatch.java:1376)
>  [drill-java-exec-1.11.0-SNAPSHOT.jar:1.11.0-SNAPSHOT]
> at 
> org.apache.drill.exec.physical.impl.xsort.managed.ExternalSortBatch.mergeRuns(ExternalSortBatch.java:1372)
>  [drill-java-exec-1.11.0-SNAPSHOT.jar:1.11.0-SNAPSHOT]
> at 
> org.apache.drill.exec.physical.impl.xsort.managed.ExternalSortBatch.consolidateBatches(ExternalSortBatch.java:1299)
>  [drill-java-exec-1.11.0-SNAPSHOT.jar:1.11.0-SNAPSHOT]
> at 
> org.apache.drill.exec.physical.impl.xsort.managed.ExternalSortBatch.mergeSpilledRuns(ExternalSortBatch.java:1195)
>  [drill-java-exec-1.11.0-SNAPSHOT.jar:1.11.0-SNAPSHOT]
> at 
> org.apache.drill.exec.physical.impl.xsort.managed.ExternalSortBatch.load(ExternalSortBatch.java:689)
>  [drill-java-exec-1.11.0-SNAPSHOT.jar:1.11.0-SNAPSHOT]
> at 
> org.apache.drill.exec.physical.impl.xsort.managed.ExternalSortBatch.innerNext(ExternalSortBatch.java:559)
>  [drill-java-exec-1.11.0-SNAPSHOT.jar:1.11.0-SNAPSHOT]
> at 
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:162)
>  [drill-java-exec-1.11.0-SNAPSHOT.jar:1.11.0-SNAPSHOT]
> at 
> org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:215)
>  [drill-java-exec-1.11.0-SNAPSHOT.jar:1.11.0-SNAPSHOT]
> at 
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:119)
>  [drill-java-exec-1.11.0-SNAPSHOT.jar:1.11.0-SNAPSHOT]
> at 
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:109)
>  [drill-java-exec-1.11.0-SNAPSHOT.jar:1.11.0-SNAPSHOT]
> at 
> org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext(AbstractSingleRecordBatch.java:51)
>  [drill-java-exec-1.11.0-SNAPSHOT.jar:1.11.0-SNAPSHOT]
> at 
> org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.innerNext(RemovingRecordBatch.java:93)
>  [drill-java-exec-1.11.0-SNAPSHOT.jar:1.11.0-SNAPSHOT]
> at 
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:162)
>  [drill-java-exec-1.11.0-SNAPSHOT.jar:1.11.0-SNAPSHOT]
> at 
> org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:215)
>  [drill-java-exec-1.11.0-SNAPSHOT.jar:1.11.0-SNAPSHOT]
> at 
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.jav

[jira] [Updated] (DRILL-5443) Managed External Sort fails with OOM while spilling to disk

2017-04-24 Thread Rahul Challapalli (JIRA)

 [ 
https://issues.apache.org/jira/browse/DRILL-5443?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rahul Challapalli updated DRILL-5443:
-
Attachment: 27016969-ef53-40dc-b582-eea25371fa1c.sys.drill
drillbit.log

The data set is ~1.6 GB in size and is generated by replicating the below 
content ~10 times
{code}
{
  "uid" : 1,
  "uid_str" : "01",
  "type" : "web",
  "max_trans_amount" : 1000,
  "events" : [
{ "evnt_id":"e1", "campaign_id":"c1", "event_name":"e1_name", 
"event_time":100, "type" : "cmpgn1"},
{ "evnt_id":"e2", "campaign_id":"c1", "event_name":"e2_name", 
"event_time":200, "type" : "cmpgn4"},
{ "evnt_id":"e3", "campaign_id":"c1", "event_name":"e3_name", 
"event_time":300, "type" : "cmpgn1"},
{ "evnt_id":"e4", "campaign_id":"c1", "event_name":"e4_name", 
"event_time":400, "type" : "cmpgn1"},
{ "evnt_id":"e5", "campaign_id":"c2", "event_name":"e5_name", 
"event_time":500, "type" : "cmpgn3"},
{ "evnt_id":"e6", "campaign_id":"c1", "event_name":"e6_name", 
"event_time":600, "type" : "cmpgn9"},
{ "evnt_id":"e7", "campaign_id":"c1", "event_name":"e7_name", 
"event_time":700, "type" : "cmpgn3"},
{ "evnt_id":"e8", "campaign_id":"c2", "event_name":"e8_name", 
"event_time":800, "type" : "cmpgn2"},
{ "evnt_id":"e9", "campaign_id":"c2", "event_name":"e9_name", 
"event_time":900, "type" : "cmpgn4"}
  ],
  "transactions" : [
   { "trans_id":"t1", "amount":100, "trans_time":777, "type":"sports"},
   { "trans_id":"t2", "amount":1000, "trans_time":888, 
"type":"groceries"}
  ],
  "map":{"rm": [ 
{"mapid":"m1","mapvalue":{"col1":1,"col2":[0,1,2,3,4,5]},"rptd": [{ "a": 
"foo"},{"b":"boo"}]},
{"mapid":"m2","mapvalue":{"col1":0,"col2":[]},"rptd": [{ "a": 
"bar"},{"c":1},{"d":4.5}]}
  ]},
  "sub": [{"z1":"hello"},{"z2":1}],
  "features": [
{
"type": "Feature",
"properties": {
"mag": 6.9,
"time": 1405954481000,
"updated": 1405983436259
},
"geometry": {
"type": "Point",
"coordinates": "100,90"
},
"id": "usb000ruzk",
"location": {
"zip": "95134",
"street": "zanker",
"bldgs": {
"bldg1" : "HQ1",
"bldg2" : "HQ2"
}
}
}
],
  "lst_lst" : [[1,2,3,4,5],[2,3,4,5,6]]
}
{
  "uid" : 2,
  "uid_str" : "02",
  "type" : "store",
  "max_trans_amount" : 2001,
  "events" : [
{ "evnt_id":"e1", "campaign_id":"c1", "event_name":"e1_name", 
"event_time":100, "type" : "cmpgn9"},
{ "evnt_id":"e2", "campaign_id":"c1", "event_name":"e2_name", 
"event_time":200, "type" : "cmpgn4"},
{ "evnt_id":"e3", "campaign_id":"c1", "event_name":"e3_name", 
"event_time":300, "type" : "cmpgn1"},
{ "evnt_id":"e4", "campaign_id":"c1", "event_name":"e4_name", 
"event_time":400, "type" : "cmpgn1"},
{ "evnt_id":"e5", "campaign_id":"c2", "event_name":"e5_name", 
"event_time":500, "type" : "cmpgn2"},
{ "evnt_id":"e6", "campaign_id":"c1", "event_name":"e6_name", 
"event_time":600, "type" : "cmpgn9"},
{ "evnt_id":"e7", "campaign_id":"c1", "event_name":"e7_name", 
"event_time":700, "type" : "cmpgn3"},
{ "evnt_id":"e8", "campaign_id":"c2", "event_name":"e8_name", 
"event_time":800, "type" : "cmpgn2"},
{ "evnt_id":"e9", "campaign_id":"c2", "event_name":"e9_name", 
"event_time":900, "type" : "cmpgn4"}
  ],
  "transactions" : [
   { "trans_id":"t1", "amount":100, "trans_time":777, "type":"sports"},
   { "trans_id":"t2", "amount":1000, "trans_time":888, 
"type":"groceries"}
  ],
  "map":{"rm": [ 
{"mapid":"m0","mapvalue":{"col1":1,"col2":[0,1,2,3,4,5]},"rptd": [{ "a": 
"foo1"},{"b":"boo"}]},
{"mapid":"m1","mapvalue":{"col1":0,"col2":[]},"rptd": [{ "a": 
"bar"},{"c":-1},{"d":4.5}]}
  ]},
  "sub": [{"z1":"hello"},{"z2":10}],
  "features": [
{
"type": "cmpgn9",
"properties": {
"mag": 6.9,
"time": 1405954481000,
"updated": 1405983436259
},
"geometry": {
"type": "Point",
"coordinates": "100,90"
},
"id": "usb000ruzk",
"location": {
"zip": "95134",
"street": "zanker",
"bldgs": {
"bldg1" : "HQ1",
"bldg2" : "HQ2"
}
}
}
],
  "lst_lst" : [[1,2,3,4,5],[2,3,4,5,6]]
}
{code}

> Managed External Sort fails with OOM while spilling to disk
> ---
>
> Key: DRILL-5443
> URL: h