Skip to content
  • Dinesh Surya Prakash's avatar
    079a482b
    Bug#29304517 NDB BUILD FAILURE WHEN COMPILED WITH -DWITH_SYSTEM_LIBS=ON · 079a482b
    Dinesh Surya Prakash authored
    PROBLEM:
    -DWITH_ZLIB cmake flag takes two options 'system' and 'bundled'. If -DWITH_ZLIB
    is used with 'bundled', then cmake uses the ZLIB from the mysql tree. If
    -DWITH_ZLIB is used with 'system', then cmake uses the ZLIB installed in
    the system.
    
    NDB uses Zlibs for data compression. Zlibs gives callbacks to allocate and
    free memory. So, NDB registers those callback functions(ndbz_alloc and
    ndbz_free) and manage the entire memory required for the compression
    activity by itself. NDB does not encourage the usage of dynamic memory
    after the data nodes are initialized. So, NDB tries to allocate the complete
    memory required by the Zlib apis(inflateInit2() and deflateInit2()) before
    init. So, NDB uses the private Zlib files (located in mysql tree /extra/zlib),
    to get the size of the data structures of Zlib internals and creates a big
    pool of memory which is sufficient for Zlib init apis.
    
    As the header is private, it won't be available in an standard Zlib
    installations. So, NDB build will be successful only with -DWITH_ZLIB=bundled.
    
    Recently, a new option "WITH_SYSTEM_LIBS" is added to mysql make file. If
    this option is set, it forces all the common libraries to use "system"
    instead of "bundled". This also sets the -DWITH_ZLIB option to 'system'. So,
    when NDB build is requested with -DWITH_SYSTEM_LIBS=ON, build fails as it
    won't be able to find the private ZLIB header files.
    
    FIX:
    Introduced probe_alloc() and probe_free() functions to calculate the memory
    required by inflateInit2() and deflateInit2() Zlib apis. Thus, without
    using Zlib private header files, the total amount of memory used by Zlib apis is
    calculated and this in turn makes NDB build possible with -DWITH_ZLIB=system.
    
    Change-Id: I0ca5fe462dc0f0a385a58896fe6f2b3a62039c5c
    079a482b
    Bug#29304517 NDB BUILD FAILURE WHEN COMPILED WITH -DWITH_SYSTEM_LIBS=ON
    Dinesh Surya Prakash authored
    PROBLEM:
    -DWITH_ZLIB cmake flag takes two options 'system' and 'bundled'. If -DWITH_ZLIB
    is used with 'bundled', then cmake uses the ZLIB from the mysql tree. If
    -DWITH_ZLIB is used with 'system', then cmake uses the ZLIB installed in
    the system.
    
    NDB uses Zlibs for data compression. Zlibs gives callbacks to allocate and
    free memory. So, NDB registers those callback functions(ndbz_alloc and
    ndbz_free) and manage the entire memory required for the compression
    activity by itself. NDB does not encourage the usage of dynamic memory
    after the data nodes are initialized. So, NDB tries to allocate the complete
    memory required by the Zlib apis(inflateInit2() and deflateInit2()) before
    init. So, NDB uses the private Zlib files (located in mysql tree /extra/zlib),
    to get the size of the data structures of Zlib internals and creates a big
    pool of memory which is sufficient for Zlib init apis.
    
    As the header is private, it won't be available in an standard Zlib
    installations. So, NDB build will be successful only with -DWITH_ZLIB=bundled.
    
    Recently, a new option "WITH_SYSTEM_LIBS" is added to mysql make file. If
    this option is set, it forces all the common libraries to use "system"
    instead of "bundled". This also sets the -DWITH_ZLIB option to 'system'. So,
    when NDB build is requested with -DWITH_SYSTEM_LIBS=ON, build fails as it
    won't be able to find the private ZLIB header files.
    
    FIX:
    Introduced probe_alloc() and probe_free() functions to calculate the memory
    required by inflateInit2() and deflateInit2() Zlib apis. Thus, without
    using Zlib private header files, the total amount of memory used by Zlib apis is
    calculated and this in turn makes NDB build possible with -DWITH_ZLIB=system.
    
    Change-Id: I0ca5fe462dc0f0a385a58896fe6f2b3a62039c5c
Loading