private synchronized MemoryPoolAssignmentsRequest updateAssignments ( Iterable < QueryExecution > queries ) { ClusterMemoryPool reservedPool = pools . get ( RESERVED_POOL ) ; ClusterMemoryPool generalPool = pools . get ( GENERAL_POOL ) ; verify ( generalPool != null , "generalPool is null" ) ; verify ( reservedPool != null , "reservedPool is null" ) ; long version = memoryPoolAssignmentsVersion . incrementAndGet ( ) ; // Check that all previous assignments have propagated to the visible nodes. This doesn't account for temporary network issues, // and is more of a safety check than a guarantee if ( allAssignmentsHavePropagated ( queries ) ) { if ( reservedPool . getAssignedQueries ( ) == 0 && generalPool . getBlockedNodes ( ) > 0 ) { QueryExecution biggestQuery = null ; long maxMemory = - 1 ; for ( QueryExecution queryExecution : queries ) { if ( resourceOvercommit ( queryExecution . getSession ( ) ) ) { // Don't promote queries that requested resource overcommit to the reserved pool, // since their memory usage is unbounded. continue ; } long bytesUsed = getQueryMemoryReservation ( queryExecution ) ; if ( bytesUsed > maxMemory ) { biggestQuery = queryExecution ; maxMemory = bytesUsed ; } } if ( biggestQuery != null ) { log . info ( "Moving query %s to the reserved pool" , biggestQuery . getQueryId ( ) ) ; biggestQuery . setMemoryPool ( new VersionedMemoryPoolId ( RESERVED_POOL , version ) ) ; } } } ImmutableList . Builder < MemoryPoolAssignment > assignments = ImmutableList . builder ( ) ; for ( QueryExecution queryExecution : queries ) { assignments . add ( new MemoryPoolAssignment ( queryExecution . getQueryId ( ) , queryExecution . getMemoryPool ( ) . getId ( ) ) ) ; } return new MemoryPoolAssignmentsRequest ( coordinatorId , version , assignments . build ( ) ) ; }
RemoteNodeMemory as we don t need to POST anything .