Skip to content

Commit bd66d87

Browse files
github usernametanjialiang
authored andcommitted
Make arbitrator reserved capacity to be up-to-date with native config
1 parent ae10792 commit bd66d87

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

presto-spark-base/src/main/java/com/facebook/presto/spark/execution/property/NativeExecutionSystemConfig.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public class NativeExecutionSystemConfig
8181
private static final String MEMORY_ARBITRATOR_CAPACITY_GB = "query-memory-gb";
8282
// Set memory arbitrator reserved capacity. Since there is only one query
8383
// running at Presto-on-Spark at a time, then we shall set this to zero.
84-
private static final String MEMORY_ARBITRATOR_RESERVED_CAPACITY_GB = "query-reserved-memory-gb";
84+
private static final String SHARED_ARBITRATOR_RESERVED_CAPACITY = "shared-arbitrator.reserved-capacity";
8585
// Set the initial memory capacity when we create a query memory pool. For
8686
// Presto-on-Spark, we set it to 'query-memory-gb' to allocate all the
8787
// memory arbitrator capacity to the query memory pool on its creation as
@@ -137,7 +137,7 @@ public class NativeExecutionSystemConfig
137137
private boolean useMmapAllocator = true;
138138
private String memoryArbitratorKind = "SHARED";
139139
private int memoryArbitratorCapacityGb = 8;
140-
private int memoryArbitratorReservedCapacityGb;
140+
private DataSize sharedArbitratorReservedCapacity = new DataSize(0, DataSize.Unit.GIGABYTE);
141141
private long memoryPoolInitCapacity = 8L << 30;
142142
private long memoryPoolReservedCapacity;
143143
private long memoryPoolTransferCapacity = 2L << 30;
@@ -180,7 +180,7 @@ public Map<String, String> getAllProperties()
180180
.put(USE_MMAP_ALLOCATOR, String.valueOf(getUseMmapAllocator()))
181181
.put(MEMORY_ARBITRATOR_KIND, String.valueOf(getMemoryArbitratorKind()))
182182
.put(MEMORY_ARBITRATOR_CAPACITY_GB, String.valueOf(getMemoryArbitratorCapacityGb()))
183-
.put(MEMORY_ARBITRATOR_RESERVED_CAPACITY_GB, String.valueOf(getMemoryArbitratorReservedCapacityGb()))
183+
.put(SHARED_ARBITRATOR_RESERVED_CAPACITY, String.valueOf(getSharedArbitratorReservedCapacity()))
184184
.put(MEMORY_POOL_INIT_CAPACITY, String.valueOf(getMemoryPoolInitCapacity()))
185185
.put(MEMORY_POOL_RESERVED_CAPACITY, String.valueOf(getMemoryPoolReservedCapacity()))
186186
.put(MEMORY_POOL_TRANSFER_CAPACITY, String.valueOf(getMemoryPoolTransferCapacity()))
@@ -482,16 +482,16 @@ public int getMemoryArbitratorCapacityGb()
482482
return memoryArbitratorCapacityGb;
483483
}
484484

485-
@Config(MEMORY_ARBITRATOR_RESERVED_CAPACITY_GB)
486-
public NativeExecutionSystemConfig setMemoryArbitratorReservedCapacityGb(int memoryArbitratorReservedCapacityGb)
485+
@Config(SHARED_ARBITRATOR_RESERVED_CAPACITY)
486+
public NativeExecutionSystemConfig setSharedArbitratorReservedCapacity(DataSize sharedArbitratorReservedCapacity)
487487
{
488-
this.memoryArbitratorReservedCapacityGb = memoryArbitratorReservedCapacityGb;
488+
this.sharedArbitratorReservedCapacity = sharedArbitratorReservedCapacity;
489489
return this;
490490
}
491491

492-
public int getMemoryArbitratorReservedCapacityGb()
492+
public DataSize getSharedArbitratorReservedCapacity()
493493
{
494-
return memoryArbitratorReservedCapacityGb;
494+
return sharedArbitratorReservedCapacity;
495495
}
496496

497497
@Config(MEMORY_POOL_INIT_CAPACITY)

presto-spark-base/src/test/java/com/facebook/presto/spark/execution/property/TestNativeExecutionSystemConfig.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
import com.facebook.airlift.configuration.testing.ConfigAssertions;
1717
import io.airlift.units.DataSize;
18+
import io.airlift.units.DataSize.Unit;
1819
import org.testng.annotations.Test;
1920

2021
import java.io.File;
@@ -84,7 +85,7 @@ public void testNativeExecutionSystemConfig()
8485
.setUseMmapAllocator(true)
8586
.setMemoryArbitratorKind("SHARED")
8687
.setMemoryArbitratorCapacityGb(8)
87-
.setMemoryArbitratorReservedCapacityGb(0)
88+
.setSharedArbitratorReservedCapacity(new DataSize(0, Unit.GIGABYTE))
8889
.setMemoryPoolInitCapacity(8L << 30)
8990
.setMemoryPoolReservedCapacity(0)
9091
.setMemoryPoolTransferCapacity(2L << 30)
@@ -125,7 +126,7 @@ public void testNativeExecutionSystemConfig()
125126
.setUseMmapAllocator(false)
126127
.setMemoryArbitratorKind("")
127128
.setMemoryArbitratorCapacityGb(10)
128-
.setMemoryArbitratorReservedCapacityGb(8)
129+
.setSharedArbitratorReservedCapacity(new DataSize(8, Unit.GIGABYTE))
129130
.setMemoryPoolInitCapacity(7L << 30)
130131
.setMemoryPoolReservedCapacity(6L << 30)
131132
.setMemoryPoolTransferCapacity(1L << 30)

0 commit comments

Comments
 (0)