The message "memory is temporarily unavailable" is reported during the query.
ERROR: memory is temporarily unavailable
Query the error information according to CN logs, as shown in the following figure.
Connect to the DN for which the error is reported, execute the error statement repeatedly in another window, and check the PV_TOTAL_MEMORY_DETAIL view to view the changes of dynamic_used_memory.
As shown in the preceding figure, the value of dynamic_used_memory continuously increases. After the value exceeds the value of max_dynamic_memory, an error is reported on the client (an error may also occur when the value is about to exceed the value of max_dynamic_memory).
Therefore, the max_process_memory value needs to be modified to change the max_dynamic_memory value to a larger one.
The max_process_memory indicates the maximum available memory of the LibrA instance on the server node, including the maximum memory for shared_buffers, cstore_buffers, and comm_usable_memory (valid when comm_tcp_mode is set to false), as well as the dynamic memory allocated during execution. When the memory applied for by the job exceeds the limit, the exception handling is triggered because of memory application failure. When the concurrency is high, the memory of the DN will be insufficient if the value of max_process_memory is too small, the memory of the DN is insufficient.
Run the free -g command to check the performance of the customer's machine.
The memory can be calculated as follows:
CN: (RAM x 0.8)/(CN + 1) = (128 x 0.8)/(3 + 1) = 25.6
DN: (RAM x 0.8)/(DN + 1) = (128 x 0.8)/(3 + 1) = 25.6
Run the following command to set the value of the max_process_memory again:
gs_guc set -Z coordinator -D datadir -c "max_process_memory=25G"
gs_guc set -Z datanode -D datadir -c "max_process_memory=25G"
Run the following command to restart the system for the configuration to will take effect:
gs_om -t stop && gs_om -t start
1. Before using the cluster, check whether each GUC parameter meets the requirements.
2. Exercise caution when restarting the system.