BUG#24143 Heavy file fragmentation with multiple ndbd on single fs

If we have the XFS headers (at build time) we can use XFS specific ioctls
(once testing the file is on XFS) to better allocate space.

This dramatically improves performance of mysql-test-run cases as well:

e.g.
number of extents for ndb_dd_basic tablespaces and log files
BEFORE this patch: 57, 13, 212, 95, 17, 113 
WITH this patch  :  ALL 1 or 2 extents

(results are consistent over multiple runs. BEFORE always has several files
with lots of extents).

As for timing of test run:
BEFORE
ndb_dd_basic                   [ pass ]         107727
real    3m2.683s
user    0m1.360s
sys     0m1.192s

AFTER
ndb_dd_basic                   [ pass ]          70060
real    2m30.822s
user    0m1.220s
sys     0m1.404s

(results are again consistent over various runs)

similar for other tests (BEFORE and AFTER):
ndb_dd_alter                   [ pass ]         245360
ndb_dd_alter                   [ pass ]         211632
parent aff23473
...@@ -697,6 +697,8 @@ AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \ ...@@ -697,6 +697,8 @@ AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \
sys/ioctl.h malloc.h sys/malloc.h sys/ipc.h sys/shm.h linux/config.h \ sys/ioctl.h malloc.h sys/malloc.h sys/ipc.h sys/shm.h linux/config.h \
sys/resource.h sys/param.h) sys/resource.h sys/param.h)
AC_CHECK_HEADERS([xfs/xfs.h])
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Check for system libraries. Adds the library to $LIBS # Check for system libraries. Adds the library to $LIBS
# and defines HAVE_LIBM etc # and defines HAVE_LIBM etc
......
...@@ -18,6 +18,10 @@ ...@@ -18,6 +18,10 @@
#include <my_sys.h> #include <my_sys.h>
#include <my_pthread.h> #include <my_pthread.h>
#ifdef HAVE_XFS_XFS_H
#include <xfs/xfs.h>
#endif
#include "AsyncFile.hpp" #include "AsyncFile.hpp"
#include <ErrorHandlingMacros.hpp> #include <ErrorHandlingMacros.hpp>
...@@ -459,6 +463,18 @@ no_odirect: ...@@ -459,6 +463,18 @@ no_odirect:
Uint32 index = 0; Uint32 index = 0;
Uint32 block = refToBlock(request->theUserReference); Uint32 block = refToBlock(request->theUserReference);
#ifdef HAVE_XFS_XFS_H
if(platform_test_xfs_fd(theFd))
{
ndbout_c("Using xfsctl(XFS_IOC_RESVSP64) to allocate disk space");
xfs_flock64_t fl;
fl.l_whence= 0;
fl.l_start= 0;
fl.l_len= (off64_t)sz;
if(xfsctl(NULL, theFd, XFS_IOC_RESVSP64, &fl) < 0)
ndbout_c("failed to optimally allocate disk space");
}
#endif
#ifdef HAVE_POSIX_FALLOCATE #ifdef HAVE_POSIX_FALLOCATE
posix_fallocate(theFd, 0, sz); posix_fallocate(theFd, 0, sz);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment