Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9241#discussion_r43449223
  
    --- Diff: 
core/src/main/java/org/apache/spark/shuffle/sort/ShuffleExternalSorter.java ---
    @@ -108,42 +102,20 @@ public ShuffleExternalSorter(
           int initialSize,
           int numPartitions,
           SparkConf conf,
    -      ShuffleWriteMetrics writeMetrics) throws IOException {
    +      ShuffleWriteMetrics writeMetrics) {
    +    super(memoryManager);
         this.taskMemoryManager = memoryManager;
         this.blockManager = blockManager;
         this.taskContext = taskContext;
    -    this.initialSize = initialSize;
         this.peakMemoryUsedBytes = initialSize;
         this.numPartitions = numPartitions;
         // Use getSizeAsKb (not bytes) to maintain backwards compatibility if 
no units are provided
         this.fileBufferSizeBytes = (int) 
conf.getSizeAsKb("spark.shuffle.file.buffer", "32k") * 1024;
         this.numElementsForSpillThreshold =
           conf.getLong("spark.shuffle.spill.numElementsForceSpillThreshold", 
Long.MAX_VALUE);
    -    this.pageSizeBytes = (int) Math.min(
    -      PackedRecordPointer.MAXIMUM_PAGE_SIZE_BYTES, 
taskMemoryManager.pageSizeBytes());
    --- End diff --
    
    Is it safe to make this change? After this change, 
`PackedRecordPointer.MAXIMUM_PAGE_SIZE_BYTES` is only used in test code. The 
packed record pointer is used to compress pointers to addresses inside of 
memory pages (for use in the optimized sorter here) and thus imposes a limit on 
the size of pages that contain multiple sorted records. If we omit this check 
then we might run into corruption or other issues if 
`taskMemoryManager.pageSizeBytes()` is bigger than 
`PackedRecordPointer.MAXIMUM_PAGE_SIZE_BYTES`. This is only likely to be an 
issue on machines with huge heap sizes, but I still think we should guard 
against it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to