Commit 0602da4d authored by unknown's avatar unknown
Browse files

BUG#10948 NDB Replication: Race condition with ALTER/DROP table

BUG#9826  Server crash on schema change ("drop table", "alter table") with NDB

See note on 10948 for detailed explanation.

struct a { void* a; long long b[1]; };

on PPC32 (and 32bit pa risc): 16
on x86: 12

so a malloc(sizeof(void*)+extra_bits) is wrong.

Assuming that the long long is 64 bit aligned as non-aligned 64bit accesses
are rather expensive on ppc.

Thanks to paulus for doing the PPC port of valgrind.
Without which I would no doubt still be trying to find this.


ndb/src/ndbapi/DictCache.cpp:
  Fix allocation size for Ndb_local_table_info for architectures such as PPC and PA-RISC (32bit)
  where
  struct a { void* a; long long b;};
  is 64 bit aligned (i.e. sizeof(struct a)==16)
ndb/src/ndbapi/DictCache.hpp:
  Add warning about having to be the last member in the structure
parent a681af90
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -24,7 +24,8 @@
Ndb_local_table_info *
Ndb_local_table_info::create(NdbTableImpl *table_impl, Uint32 sz)
{
  Uint32 tot_size= sizeof(NdbTableImpl *) + ((sz+7)>>3)<<3; // round to Uint64
  Uint32 tot_size= sizeof(Ndb_local_table_info) - sizeof(Uint64)
    + ((sz+7) & ~7); // round to Uint64
  void *data= malloc(tot_size);
  if (data == 0)
    return 0;
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ public:
  static Ndb_local_table_info *create(NdbTableImpl *table_impl, Uint32 sz=0);
  static void destroy(Ndb_local_table_info *);
  NdbTableImpl *m_table_impl;
  Uint64 m_local_data[1];
  Uint64 m_local_data[1]; // Must be last member. Used to access extra space.
private:
  Ndb_local_table_info(NdbTableImpl *table_impl);
  ~Ndb_local_table_info();