storage/StorageManager.cpp
/**
 * @brief Set or validate the buffer pool slots. When automatically picking a
 *        default value, check if the system is "small" or "large." Set the
 *        buffer pool space to 70% of the installed main memory for small
 *        and 80% otherwise.
 *        This method follows the signature that is set by the gflags module.
 * @param flagname The name of the buffer pool flag.
 * @param value The value of this flag from the command line, or default (0)
 * @return True if the value was set to a legimate value, false otherwise.
 *         Currently this method aims to always find some legitimate value,
 *         and never returns false.
 **/
@brief Set or validate the buffer pool slots. When automatically picking a
default value, check if the system is "small" or "large." Set the
buffer pool space to 70% of the installed main memory for small
and 80% otherwise.
This method follows the signature that is set by the gflags module.
@param flagname The name of the buffer pool flag.
@param value The value of this flag from the command line, or default (0)
@return True if the value was set to a legimate value, false otherwise.
Currently this method aims to always find some legitimate value,
and never returns false.
@brief Set or validate the buffer pool slots . When automatically picking a default value check if the system is " small " or " large . " Set the buffer pool space to 70% of the installed main memory for small and 80% otherwise . This method follows the signature that is set by the gflags module . @param flagname The name of the buffer pool flag . @param value The value of this flag from the command line or default ( 0 ) @return True if the value was set to a legimate value false otherwise . Currently this method aims to always find some legitimate value and never returns false .
static bool SetOrValidateBufferPoolSlots(const char *flagname,
                                         std::uint64_t value) {
  if (value != 0) {
    return true;  
  }
  std::uint64_t total_memory;
  if (utility::system::calculateTotalMemoryInBytes(&total_memory)) {
    if (total_memory/kAGigaByte < kLargeMemorySystemThresholdInGB) {
      FLAGS_buffer_pool_slots
          = (total_memory*kPercentageToGrabForSmallSystems)/(kSlotSizeBytes*100);
    } else {
      FLAGS_buffer_pool_slots
          = (total_memory*kPercentageToGrabForLargeSystems)/(kSlotSizeBytes*100);
    }
    return true;
  }
  LOG(INFO) << "Unable to determine an appropriate buffer pool size. "
            << "Using a default value of 2GB.\n";
  FLAGS_buffer_pool_slots = kDefaultBufferPoolSizeInSlots;
  return true;
}
static bool SetOrValidateBufferPoolSlots ( const char * flagname , std :: uint64_t value ) { if ( value != 0 ) { return true ; } std :: uint64_t total_memory ; if ( utility :: system :: calculateTotalMemoryInBytes ( & total_memory ) ) { if ( total_memory / kAGigaByte < kLargeMemorySystemThresholdInGB ) { FLAGS_buffer_pool_slots = ( total_memory * kPercentageToGrabForSmallSystems ) / ( kSlotSizeBytes * 100 ) ; } else { FLAGS_buffer_pool_slots = ( total_memory * kPercentageToGrabForLargeSystems ) / ( kSlotSizeBytes * 100 ) ; } return true ; } LOG ( INFO ) << " " << " \n " ; FLAGS_buffer_pool_slots = kDefaultBufferPoolSizeInSlots ; return true ; }
@brief Set or validate the buffer pool slots.
@brief Set or validate the buffer pool slots .
// TODO(jmp): Check if this value is safe and warn the user if it is not. // User supplied value is > 0 and we simply use that value. // Need to automatically pick the buffer pool size. // Detected the total installed memory. Now set the buffer pool size //   based on whether the system is large or small. // This is a "small" system. Leave a litte more memory for others. // This is a "large" system. Grab nearly all of the installed memory. // Could not calculate the installed memory. Use a default value of 1k slots.