ndb -

  Add DynArr256 which is a ndb-ish judy array
  Like the one used in ACC
parent 8e11f6f5
This diff is collapsed.
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef DYNARR256_HPP
#define DYNARR256_HPP
#include "Pool.hpp"
class DynArr256;
struct DA256Page;
class DynArr256Pool
{
friend class DynArr256;
public:
DynArr256Pool();
void init(Uint32 type_id, const Pool_context& pc);
protected:
Uint32 m_type_id;
Uint32 m_first_free;
Pool_context m_ctx;
struct DA256Page* m_memroot;
private:
Uint32 seize();
void release(Uint32);
};
class DynArr256
{
public:
struct Head
{
Head() { m_ptr_i = RNIL; m_sz = 0;}
Uint32 m_ptr_i;
Uint32 m_sz;
};
DynArr256(DynArr256Pool & pool, Head& head) :
m_head(head), m_pool(pool){}
Uint32* set(Uint32 pos);
Uint32* get(Uint32 pos) const ;
struct ReleaseIterator
{
Uint32 m_sz;
Uint32 m_pos;
Uint32 m_ptr_i[4];
};
void init(ReleaseIterator&);
bool release(ReleaseIterator&);
protected:
Head & m_head;
DynArr256Pool & m_pool;
bool expand(Uint32 pos);
void handle_invalid_ptr(Uint32 pos, Uint32 ptrI, Uint32 p0);
};
#endif
...@@ -20,7 +20,8 @@ libkernel_a_SOURCES = \ ...@@ -20,7 +20,8 @@ libkernel_a_SOURCES = \
Mutex.cpp SafeCounter.cpp \ Mutex.cpp SafeCounter.cpp \
Rope.cpp \ Rope.cpp \
ndbd_malloc.cpp ndbd_malloc_impl.cpp \ ndbd_malloc.cpp ndbd_malloc_impl.cpp \
Pool.cpp WOPool.cpp RWPool.cpp Pool.cpp WOPool.cpp RWPool.cpp \
DynArr256.cpp
INCLUDES_LOC = -I$(top_srcdir)/storage/ndb/src/mgmapi INCLUDES_LOC = -I$(top_srcdir)/storage/ndb/src/mgmapi
...@@ -44,7 +45,7 @@ libkernel.dsp: Makefile \ ...@@ -44,7 +45,7 @@ libkernel.dsp: Makefile \
@$(top_srcdir)/storage/ndb/config/win-sources $@ $(libkernel_a_SOURCES) @$(top_srcdir)/storage/ndb/config/win-sources $@ $(libkernel_a_SOURCES)
@$(top_srcdir)/storage/ndb/config/win-libraries $@ LIB $(LDADD) @$(top_srcdir)/storage/ndb/config/win-libraries $@ LIB $(LDADD)
EXTRA_PROGRAMS = ndbd_malloc_impl_test bench_pool EXTRA_PROGRAMS = ndbd_malloc_impl_test bench_pool testDynArr256
ndbd_malloc_impl_test_CXXFLAGS = -DUNIT_TEST ndbd_malloc_impl_test_CXXFLAGS = -DUNIT_TEST
ndbd_malloc_impl_test_SOURCES = ndbd_malloc_impl.cpp ndbd_malloc_impl_test_SOURCES = ndbd_malloc_impl.cpp
ndbd_malloc_impl_test_LDFLAGS = @ndb_bin_am_ldflags@ \ ndbd_malloc_impl_test_LDFLAGS = @ndb_bin_am_ldflags@ \
...@@ -54,9 +55,19 @@ ndbd_malloc_impl_test_LDFLAGS = @ndb_bin_am_ldflags@ \ ...@@ -54,9 +55,19 @@ ndbd_malloc_impl_test_LDFLAGS = @ndb_bin_am_ldflags@ \
$(top_builddir)/strings/libmystrings.a $(top_builddir)/strings/libmystrings.a
bench_pool_SOURCES = bench_pool.cpp bench_pool_SOURCES = bench_pool.cpp
bench_pool_LDFLAGS = @ndb_bin_am_ldflags@ ../SimBlockList.o \ bench_pool_LDFLAGS = @ndb_bin_am_ldflags@\
libkernel.a ../error/liberror.a \ libkernel.a ../error/liberror.a \
$(top_builddir)/storage/ndb/src/libndbclient.la \ $(top_builddir)/storage/ndb/src/libndbclient.la \
$(top_builddir)/mysys/libmysys.a \ $(top_builddir)/mysys/libmysys.a \
$(top_builddir)/dbug/libdbug.a \ $(top_builddir)/dbug/libdbug.a \
$(top_builddir)/strings/libmystrings.a $(top_builddir)/strings/libmystrings.a
testDynArr256_CXXFLAGS = -DUNIT_TEST
testDynArr256_SOURCES = DynArr256.cpp
testDynArr256_LDFLAGS = @ndb_bin_am_ldflags@ \
libkernel.a ../error/liberror.a \
$(top_builddir)/storage/ndb/src/libndbclient.la \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/strings/libmystrings.a
...@@ -60,7 +60,7 @@ Uint32 sizes = 7; ...@@ -60,7 +60,7 @@ Uint32 sizes = 7;
unsigned int seed; unsigned int seed;
Ndbd_mem_manager mm; Ndbd_mem_manager mm;
Configuration cfg; Configuration cfg;
Block_context ctx = { cfg, mm }; Block_context ctx(cfg, mm);
struct BB : public SimulatedBlock struct BB : public SimulatedBlock
{ {
BB(int no, Block_context& ctx) : SimulatedBlock(no, ctx) {} BB(int no, Block_context& ctx) : SimulatedBlock(no, ctx) {}
...@@ -548,6 +548,8 @@ main(int argc, char **argv) ...@@ -548,6 +548,8 @@ main(int argc, char **argv)
} }
Uint32 g_currentStartPhase; Uint32 g_currentStartPhase;
Uint32 g_start_type;
NdbNodeBitmask g_nowait_nodes;
void childExit(int code, Uint32 currentStartPhase) void childExit(int code, Uint32 currentStartPhase)
{ {
......
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