You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@tez.apache.org by "Saikat (JIRA)" <ji...@apache.org> on 2015/07/01 17:59:04 UTC
[jira] [Comment Edited] (TEZ-2575) Handle KeyValue pairs size which
do not fit in a single block
[ https://issues.apache.org/jira/browse/TEZ-2575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14610520#comment-14610520 ]
Saikat edited comment on TEZ-2575 at 7/1/15 3:58 PM:
-----------------------------------------------------
Correct I get your point [~rajesh.balamohan]
Please let me know what you think about the following points:
1. span.length() check in collect() has no way to know if this is the old span or a new span allocated in sort(). So we need some indication/status from sort() for that(else for a newspan, legth() will be always zero)
2. In the patch 2575.2 there is already a check to not add an empty span to merger thread. We can also put a check in the merger ready() function to return a false, if the merger is empty to break the spill() method if ready returns false.
3. for the example you have mentioned, 256 mb block(16mb kvmeta, 240 mb kvbuffer), 1 kv 40 already written, now we try to write 110 mb kv pair- with current implementation of next() and end() of SortSpan we cannot get to the next 256 mb block anyways. Here are the steps the algorithm follows:
3.1 write of 110 mb kv pair to remaining 200 mb space results in exception
3.2 sort() > next() > end() called
3.3 in end(), remaining[200mb] > METASIZE[16bytes] + peritem[which is 40mb]
3.4 in next() allocate a new span with the remaining(200mb)
3.5 in sort(), queue current span to merger thread, and make span = newspan
3.6 collect() called again recursion depth 1
3.7 again buffer exception for the 110 mb key, sort() > next() > end() called
3.8. this time in end(), items = 0 so end will return null and not fetch the next block from iterator.
3.9 next() gets remaining = null, returns null
3.10 sort() sees spills the span, resets the buffer list, allocates a new span of 256 mb(16mb kvmeta, 240mb kvbuffer)
3.11 now the key will fit into the buffer(so we didnt use the next buffer)
was (Author: saikatr):
Correct I get your point [~rajesh.balamohan]
Please let me know what you think about the following points:
1. span.length() check in collect() has no way to know if this is the old span or a new span allocated in sort(). So we need some indication/status from sort() for that(else for a newspan, legth() will be always zero)
2. In the patch 2575.2 there is already a check to not add an empty span to merger thread. We can also put a check in the merger ready() function to return a false, if the merger is empty to break the spill() method if ready returns false.
3. for the example you have mentioned, 256 mb block(16mb kvmeta, 240 mb kvbuffer), 1 kv 40 already written, now we try to write 110 mb kv pair- with current implementation of next() and end() of SortSpan we cannot get to the next 256 mb block anyways. Here are the steps the algorithm follows:
3.1 write of 110 mb kv pair to remaining 200 mb space results in exception
3.2 sort()->next()->end() called
3.3 in end(), remaining[200mb] > METASIZE[16bytes] + peritem[which is 40mb]
3.4 in next() allocate a new span with the remaining(200mb)
3.5 in sort(), queue current span to merger thread, and make span = newspan
3.6 collect() called again recursion depth 1
3.7 again buffer exception for the 110 mb key, sort()->next()->end() called
3.8. this time in end(), items = 0 so end will return null and not fetch the next block from iterator.
3.9 next() gets remaining = null, returns null
3.10 sort() sees spills the span, resets the buffer list, allocates a new span of 256 mb(16mb kvmeta, 240mb kvbuffer)
3.11 now the key will fit into the buffer(so we didnt use the next buffer)
> Handle KeyValue pairs size which do not fit in a single block
> -------------------------------------------------------------
>
> Key: TEZ-2575
> URL: https://issues.apache.org/jira/browse/TEZ-2575
> Project: Apache Tez
> Issue Type: Improvement
> Reporter: Saikat
> Assignee: Saikat
> Attachments: TEZ-2575.1.patch, TEZ-2575.2.patch, TEZ-2575.patch
>
>
> In the present implementation, the available buffer is divided into blocks (specified in the constructor for pipeline sort). and a linked list of these block byte buffers is maintained.
> A span is created out of the buffers.
> The present logic, doesnot handle scenario where a single key-value pair size doesnot fit into any of the blocks.
> example if 1mb total memory is divided into 4 blocks, (256 kb each),
> if a single KV pair is greater than the blocksize(~ignoring meta data size),
> then it fails with buffer exceptions.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)