You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by ss...@apache.org on 2014/12/16 21:56:20 UTC
[1/2] tez git commit: TEZ-1836. Provide better error messages when
tez.runtime.io.sort.mb,
spill percentage is incorrectly configured. Contributed by Vasanth kumar RJ.
(cherry picked from commit 665801c6d4d3721d2b6d82df3a2e009548e209c3)
Repository: tez
Updated Branches:
refs/heads/branch-0.5 1fb43bd29 -> 7a1b11e52
TEZ-1836. Provide better error messages when tez.runtime.io.sort.mb,
spill percentage is incorrectly configured. Contributed by Vasanth kumar
RJ.
(cherry picked from commit 665801c6d4d3721d2b6d82df3a2e009548e209c3)
Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/2cb65281
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/2cb65281
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/2cb65281
Branch: refs/heads/branch-0.5
Commit: 2cb65281e8cd7d20b187091551a9e14b711d1a26
Parents: 1fb43bd
Author: Siddharth Seth <ss...@apache.org>
Authored: Tue Dec 16 12:53:16 2014 -0800
Committer: Siddharth Seth <ss...@apache.org>
Committed: Tue Dec 16 12:53:51 2014 -0800
----------------------------------------------------------------------
CHANGES.txt | 3 ++
.../common/sort/impl/ExternalSorter.java | 8 ++-
.../common/sort/impl/PipelinedSorter.java | 14 +-----
.../common/sort/impl/dflt/DefaultSorter.java | 13 ++---
.../library/output/TestOnFileSortedOutput.java | 53 ++++++++++++++++++++
5 files changed, 68 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tez/blob/2cb65281/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 35c48f9..29dc782 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -6,6 +6,9 @@ Release 0.5.4: Unreleased
ALL CHANGES:
TEZ-1800. Integer overflow in ExternalSorter.getInitialMemoryRequirement()
+Release 0.5.4: Unreleased
+ TEZ-1836. Provide better error messages when tez.runtime.io.sort.mb, spill percentage is incorrectly configured.
+
Release 0.5.3: Unreleased
ALL CHANGES:
http://git-wip-us.apache.org/repos/asf/tez/blob/2cb65281/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/ExternalSorter.java
----------------------------------------------------------------------
diff --git a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/ExternalSorter.java b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/ExternalSorter.java
index c73fc49..9aee53a 100644
--- a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/ExternalSorter.java
+++ b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/ExternalSorter.java
@@ -286,9 +286,13 @@ public abstract class ExternalSorter {
conf.getInt(
TezRuntimeConfiguration.TEZ_RUNTIME_IO_SORT_MB,
TezRuntimeConfiguration.TEZ_RUNTIME_IO_SORT_MB_DEFAULT);
- Preconditions.checkArgument(initialMemRequestMb != 0, "io.sort.mb should be larger than 0");
+ Preconditions.checkArgument(initialMemRequestMb > 0 && initialMemRequestMb <= 2047,
+ TezRuntimeConfiguration.TEZ_RUNTIME_IO_SORT_MB
+ + " should be larger than 0 and less than or equal to 2047");
long reqBytes = ((long) initialMemRequestMb) << 20;
- LOG.info("Requested SortBufferSize (io.sort.mb): " + initialMemRequestMb);
+ LOG.info("Requested SortBufferSize ("
+ + TezRuntimeConfiguration.TEZ_RUNTIME_IO_SORT_MB + "): "
+ + initialMemRequestMb);
return reqBytes;
}
}
http://git-wip-us.apache.org/repos/asf/tez/blob/2cb65281/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/PipelinedSorter.java
----------------------------------------------------------------------
diff --git a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/PipelinedSorter.java b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/PipelinedSorter.java
index afa2370..e353c00 100644
--- a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/PipelinedSorter.java
+++ b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/PipelinedSorter.java
@@ -100,22 +100,10 @@ public class PipelinedSorter extends ExternalSorter {
partitionBits = bitcount(partitions)+1;
//sanity checks
- final float spillper =
- this.conf.getFloat(
- TezRuntimeConfiguration.TEZ_RUNTIME_SORT_SPILL_PERCENT,
- TezRuntimeConfiguration.TEZ_RUNTIME_SORT_SPILL_PERCENT_DEFAULT);
final int sortmb = this.availableMemoryMb;
indexCacheMemoryLimit = this.conf.getInt(TezRuntimeConfiguration.TEZ_RUNTIME_INDEX_CACHE_MEMORY_LIMIT_BYTES,
TezRuntimeConfiguration.TEZ_RUNTIME_INDEX_CACHE_MEMORY_LIMIT_BYTES_DEFAULT);
- if (spillper > (float)1.0 || spillper <= (float)0.0) {
- throw new IOException("Invalid \"" + TezRuntimeConfiguration.TEZ_RUNTIME_SORT_SPILL_PERCENT +
- "\": " + spillper);
- }
- if ((sortmb & 0x7FF) != sortmb) {
- throw new IOException(
- "Invalid \"" + TezRuntimeConfiguration.TEZ_RUNTIME_IO_SORT_MB + "\": " + sortmb);
- }
-
+
// buffers and accounting
int maxMemUsage = sortmb << 20;
maxMemUsage -= maxMemUsage % METASIZE;
http://git-wip-us.apache.org/repos/asf/tez/blob/2cb65281/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/dflt/DefaultSorter.java
----------------------------------------------------------------------
diff --git a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/dflt/DefaultSorter.java b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/dflt/DefaultSorter.java
index 82ae225..f872e1f 100644
--- a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/dflt/DefaultSorter.java
+++ b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/sort/impl/dflt/DefaultSorter.java
@@ -52,6 +52,8 @@ import org.apache.tez.runtime.library.common.sort.impl.TezSpillRecord;
import org.apache.tez.runtime.library.common.sort.impl.IFile.Writer;
import org.apache.tez.runtime.library.common.sort.impl.TezMerger.Segment;
+import com.google.common.base.Preconditions;
+
@SuppressWarnings({"unchecked", "rawtypes"})
public class DefaultSorter extends ExternalSorter implements IndexedSortable {
@@ -122,14 +124,9 @@ public class DefaultSorter extends ExternalSorter implements IndexedSortable {
TezRuntimeConfiguration.TEZ_RUNTIME_SORT_SPILL_PERCENT,
TezRuntimeConfiguration.TEZ_RUNTIME_SORT_SPILL_PERCENT_DEFAULT);
final int sortmb = this.availableMemoryMb;
- if (spillper > (float) 1.0 || spillper <= (float) 0.0) {
- throw new IOException("Invalid \""
- + TezRuntimeConfiguration.TEZ_RUNTIME_SORT_SPILL_PERCENT + "\": " + spillper);
- }
- if ((sortmb & 0x7FF) != sortmb) {
- throw new IOException("Invalid \"" + TezRuntimeConfiguration.TEZ_RUNTIME_IO_SORT_MB
- + "\": " + sortmb);
- }
+ Preconditions.checkArgument(spillper <= (float) 1.0 && spillper > (float) 0.0,
+ TezRuntimeConfiguration.TEZ_RUNTIME_SORT_SPILL_PERCENT
+ + " should be greater than 0 and less than or equal to 1");
indexCacheMemoryLimit = this.conf.getInt(TezRuntimeConfiguration.TEZ_RUNTIME_INDEX_CACHE_MEMORY_LIMIT_BYTES,
TezRuntimeConfiguration.TEZ_RUNTIME_INDEX_CACHE_MEMORY_LIMIT_BYTES_DEFAULT);
http://git-wip-us.apache.org/repos/asf/tez/blob/2cb65281/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileSortedOutput.java
----------------------------------------------------------------------
diff --git a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileSortedOutput.java b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileSortedOutput.java
index b16936c..afd0090 100644
--- a/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileSortedOutput.java
+++ b/tez-runtime-library/src/test/java/org/apache/tez/runtime/library/output/TestOnFileSortedOutput.java
@@ -59,6 +59,7 @@ import java.util.Random;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Mockito.doAnswer;
@@ -158,6 +159,58 @@ public class TestOnFileSortedOutput {
}
@Test
+ public void testSortBufferSize() throws Exception{
+ OutputContext context = createTezOutputContext();
+ conf.setInt(TezRuntimeConfiguration.TEZ_RUNTIME_IO_SORT_MB, 2048);
+ UserPayload payLoad = TezUtils.createUserPayloadFromConf(conf);
+ doReturn(payLoad).when(context).getUserPayload();
+ sortedOutput = new OrderedPartitionedKVOutput(context, partitions);
+ try {
+ sortedOutput.initialize();
+ fail();
+ } catch(IllegalArgumentException e) {
+ assertTrue(e.getMessage().contains(TezRuntimeConfiguration.TEZ_RUNTIME_IO_SORT_MB));
+ }
+ conf.setInt(TezRuntimeConfiguration.TEZ_RUNTIME_IO_SORT_MB, 0);
+ payLoad = TezUtils.createUserPayloadFromConf(conf);
+ doReturn(payLoad).when(context).getUserPayload();
+ sortedOutput = new OrderedPartitionedKVOutput(context, partitions);
+ try {
+ sortedOutput.initialize();
+ fail();
+ } catch(IllegalArgumentException e) {
+ assertTrue(e.getMessage().contains(TezRuntimeConfiguration.TEZ_RUNTIME_IO_SORT_MB));
+ }
+ }
+
+ @Test
+ public void testSortSpillPercent() throws Exception {
+ OutputContext context = createTezOutputContext();
+ conf.setFloat(TezRuntimeConfiguration.TEZ_RUNTIME_SORT_SPILL_PERCENT, 0.0f);
+ UserPayload payLoad = TezUtils.createUserPayloadFromConf(conf);
+ doReturn(payLoad).when(context).getUserPayload();
+ sortedOutput = new OrderedPartitionedKVOutput(context, partitions);
+ try {
+ sortedOutput.initialize();
+ sortedOutput.start();
+ fail();
+ } catch(IllegalArgumentException e) {
+ assertTrue(e.getMessage().contains(TezRuntimeConfiguration.TEZ_RUNTIME_SORT_SPILL_PERCENT));
+ }
+ conf.setFloat(TezRuntimeConfiguration.TEZ_RUNTIME_SORT_SPILL_PERCENT, 1.1f);
+ payLoad = TezUtils.createUserPayloadFromConf(conf);
+ doReturn(payLoad).when(context).getUserPayload();
+ sortedOutput = new OrderedPartitionedKVOutput(context, partitions);
+ try {
+ sortedOutput.initialize();
+ sortedOutput.start();
+ fail();
+ } catch(IllegalArgumentException e) {
+ assertTrue(e.getMessage().contains(TezRuntimeConfiguration.TEZ_RUNTIME_SORT_SPILL_PERCENT));
+ }
+ }
+
+ @Test
public void baseTest() throws Exception {
startSortedOutput(partitions);
[2/2] tez git commit: Fixed 0.5.4 section in CHANGES.txt
Posted by ss...@apache.org.
Fixed 0.5.4 section in CHANGES.txt
Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/7a1b11e5
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/7a1b11e5
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/7a1b11e5
Branch: refs/heads/branch-0.5
Commit: 7a1b11e52447977f74c174700904e37b7a3338f9
Parents: 2cb6528
Author: Siddharth Seth <ss...@apache.org>
Authored: Tue Dec 16 12:55:59 2014 -0800
Committer: Siddharth Seth <ss...@apache.org>
Committed: Tue Dec 16 12:55:59 2014 -0800
----------------------------------------------------------------------
CHANGES.txt | 2 --
1 file changed, 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tez/blob/7a1b11e5/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 29dc782..6122255 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -5,8 +5,6 @@ Release 0.5.4: Unreleased
ALL CHANGES:
TEZ-1800. Integer overflow in ExternalSorter.getInitialMemoryRequirement()
-
-Release 0.5.4: Unreleased
TEZ-1836. Provide better error messages when tez.runtime.io.sort.mb, spill percentage is incorrectly configured.
Release 0.5.3: Unreleased