#include #include #if defined(__linux__) #include #endif #include namespace ProfileEvents { extern const Event CreatedReadBufferOrdinary; extern const Event CreatedReadBufferAIO; } namespace DB { #if !defined(__linux__) namespace ErrorCodes { extern const int NOT_IMPLEMENTED; } #endif std::unique_ptr createReadBufferFromFileBase(const std::string & filename_, size_t estimated_size, size_t aio_threshold, size_t buffer_size_, int flags_, char * existing_memory_, size_t alignment) { if ((aio_threshold == 0) || (estimated_size < aio_threshold)) { ProfileEvents::increment(ProfileEvents::CreatedReadBufferOrdinary); return std::make_unique(filename_, buffer_size_, flags_, existing_memory_, alignment); } else { #if defined(__linux__) ProfileEvents::increment(ProfileEvents::CreatedReadBufferAIO); return std::make_unique(filename_, buffer_size_, flags_, existing_memory_); #else throw Exception("AIO is not implemented yet on non-Linux OS", ErrorCodes::NOT_IMPLEMENTED); #endif } } }