Permalink
Browse files

Initial public import

  • Loading branch information...
0 parents commit 9b8dd7032d05e53ffcbde78d68ed3bd47f1d8081 @delamonpansie delamonpansie committed Aug 12, 2010
Showing with 55,582 additions and 0 deletions.
  1. +2 −0 .gdbinit
  2. +12 −0 .gitignore
  3. +25 −0 LICENSE
  4. +150 −0 Makefile
  5. +16 −0 README
  6. +14 −0 TODO
  7. +17 −0 cfg/Makefile
  8. +47 −0 cfg/core_cfg.cfg_tmpl
  9. +643 −0 cfg/tarantool_feeder_cfg.c
  10. +57 −0 cfg/tarantool_feeder_cfg.cfg
  11. +59 −0 cfg/tarantool_feeder_cfg.cfg_tmpl
  12. +85 −0 cfg/tarantool_feeder_cfg.h
  13. +1,231 −0 cfg/tarantool_silverbox_cfg.c
  14. +116 −0 cfg/tarantool_silverbox_cfg.cfg
  15. +113 −0 cfg/tarantool_silverbox_cfg.cfg_tmpl
  16. +150 −0 cfg/tarantool_silverbox_cfg.h
  17. +14 −0 cfg/warning.c
  18. +28 −0 core/Makefile
  19. +1,103 −0 core/admin.c
  20. +176 −0 core/admin.rl
  21. +76 −0 core/coro.c
  22. +1,069 −0 core/fiber.c
  23. +98 −0 core/iproto.c
  24. +1,257 −0 core/log_io.c
  25. +81 −0 core/log_io_internal.h
  26. +149 −0 core/log_io_remote.c
  27. +367 −0 core/palloc.c
  28. +221 −0 core/pickle.c
  29. +344 −0 core/salloc.c
  30. +131 −0 core/say.c
  31. +118 −0 core/stat.c
  32. +450 −0 core/tarantool.c
  33. +28 −0 core/tarantool_ev.c
  34. +213 −0 core/tbuf.c
  35. +65 −0 core/trace.c
  36. +143 −0 core/util.c
  37. +81 −0 doc/silverbox-protocol.txt
  38. +20 −0 extra/logger.pl
  39. +32 −0 include/admin.h
  40. +271 −0 include/bert.h
  41. +43 −0 include/coro.h
  42. +44 −0 include/debug.h
  43. +181 −0 include/fiber.h
  44. +71 −0 include/iproto.h
  45. +95 −0 include/log_io.h
  46. +42 −0 include/nbuf.h
  47. +52 −0 include/palloc.h
  48. +80 −0 include/pickle.h
  49. +42 −0 include/salloc.h
  50. +64 −0 include/say.h
  51. +36 −0 include/stat.h
  52. +57 −0 include/tarantool.h
  53. +46 −0 include/tarantool_ev.h
  54. +63 −0 include/tbuf.h
  55. +130 −0 include/util.h
  56. +5 −0 mod/feeder/Makefile
  57. +148 −0 mod/feeder/feeder.c
  58. +8 −0 mod/feeder/feeder_cfg.cfg_tmpl
  59. +8 −0 mod/silverbox/Makefile
  60. +98 −0 mod/silverbox/assoc.h
  61. +1,305 −0 mod/silverbox/box.c
  62. +141 −0 mod/silverbox/box.h
  63. +62 −0 mod/silverbox/box_cfg.cfg_tmpl
  64. +724 −0 mod/silverbox/client/perl/MR/IProto.pm
  65. +520 −0 mod/silverbox/client/perl/MR/SilverBox.pm
  66. +108 −0 mod/silverbox/client/perl/MR/Storage/Const.pm
  67. +3,779 −0 mod/silverbox/memcached.c
  68. +683 −0 mod/silverbox/memcached.rl
  69. +18 −0 mod/silverbox/t/TBox.pm
  70. +280 −0 mod/silverbox/t/box.pl
  71. +52 −0 mod/silverbox/t/box_tree.pl
  72. +50 −0 scripts/config_def.mk
  73. +6 −0 scripts/fixdep.sed
  74. +5 −0 scripts/indent
  75. +238 −0 scripts/run_test.sh
  76. +7 −0 scripts/slurp.sed
  77. +31 −0 scripts/trace.pl
  78. +9 −0 third_party/Makefile
  79. +4,357 −0 third_party/confetti/prscfg.c
  80. +51 −0 third_party/confetti/prscfg.h
  81. +26 −0 third_party/coro/LICENSE
  82. +6 −0 third_party/coro/README
  83. +154 −0 third_party/coro/conftest.c
  84. +406 −0 third_party/coro/coro.c
  85. +295 −0 third_party/coro/coro.h
  86. +747 −0 third_party/crc32.c
  87. +9 −0 third_party/crc32.h
  88. +87 −0 third_party/daemon.c
  89. +349 −0 third_party/khash.h
  90. +30 −0 third_party/libev/CVS/Entries
  91. +1 −0 third_party/libev/CVS/Repository
  92. +1 −0 third_party/libev/CVS/Root
  93. +338 −0 third_party/libev/Changes
  94. +36 −0 third_party/libev/LICENSE
  95. +18 −0 third_party/libev/Makefile.am
  96. +58 −0 third_party/libev/README
  97. +3 −0 third_party/libev/README.embed
  98. +72 −0 third_party/libev/Symbols.ev
  99. +21 −0 third_party/libev/Symbols.event
  100. +6 −0 third_party/libev/autogen.sh
  101. +18 −0 third_party/libev/configure.ac
  102. +808 −0 third_party/libev/ev++.h
  103. +4,674 −0 third_party/libev/ev.3
  104. +3,798 −0 third_party/libev/ev.c
  105. +767 −0 third_party/libev/ev.h
  106. +4,749 −0 third_party/libev/ev.pod
  107. +233 −0 third_party/libev/ev_epoll.c
  108. +199 −0 third_party/libev/ev_kqueue.c
  109. +148 −0 third_party/libev/ev_poll.c
  110. +165 −0 third_party/libev/ev_port.c
  111. +308 −0 third_party/libev/ev_select.c
  112. +187 −0 third_party/libev/ev_vars.h
  113. +153 −0 third_party/libev/ev_win32.c
  114. +178 −0 third_party/libev/ev_wrap.h
  115. +404 −0 third_party/libev/event.c
  116. +162 −0 third_party/libev/event.h
  117. +226 −0 third_party/libev/event_compat.h
  118. +131 −0 third_party/libev/import_libevent
  119. +39 −0 third_party/libev/libev.m4
  120. +19 −0 third_party/libev/update_ev_wrap
  121. +7 −0 third_party/libev/update_symbols
  122. +30 −0 third_party/memcached/COPYING
  123. +45 −0 third_party/memcached/doc/CONTRIBUTORS
  124. +1,258 −0 third_party/memcached/doc/Doxyfile
  125. +387 −0 third_party/memcached/doc/Makefile
  126. +20 −0 third_party/memcached/doc/Makefile.am
  127. +387 −0 third_party/memcached/doc/Makefile.in
  128. +143 −0 third_party/memcached/doc/memcached.1
  129. +95 −0 third_party/memcached/doc/memory_management.txt
  130. +226 −0 third_party/memcached/doc/protocol-binary-range.xml
  131. +1,467 −0 third_party/memcached/doc/protocol-binary.xml
  132. +662 −0 third_party/memcached/doc/protocol.txt
  133. +1 −0 third_party/memcached/doc/readme.txt
  134. +68 −0 third_party/memcached/doc/threads.txt
  135. +22 −0 third_party/memcached/doc/xml2rfc/reference.RFC.0768.xml
  136. +106 −0 third_party/memcached/doc/xml2rfc/rfc2629-noinc.xsl
  137. +61 −0 third_party/memcached/doc/xml2rfc/rfc2629-other.ent
  138. +81 −0 third_party/memcached/doc/xml2rfc/rfc2629-refchk.xsl
  139. +165 −0 third_party/memcached/doc/xml2rfc/rfc2629-xhtml.ent
  140. +304 −0 third_party/memcached/doc/xml2rfc/rfc2629.dtd
  141. +44 −0 third_party/memcached/t/64bit.t
  142. +23 −0 third_party/memcached/t/binary-get.t
  143. +13 −0 third_party/memcached/t/bogus-commands.t
  144. +157 −0 third_party/memcached/t/cas.t
  145. +64 −0 third_party/memcached/t/expirations.t
  146. +18 −0 third_party/memcached/t/flags.t
  147. +44 −0 third_party/memcached/t/flush-all.t
  148. +100 −0 third_party/memcached/t/getset.t
  149. +71 −0 third_party/memcached/t/incrdecr.t
  150. +260 −0 third_party/memcached/t/lib/MemcachedTest.pm
  151. +46 −0 third_party/memcached/t/multiversioning.t
  152. +44 −0 third_party/memcached/t/noreply.t
  153. +101 −0 third_party/memcached/t/stress-memcached.pl
  154. +64 −0 third_party/murmur_hash2.c
  155. +306 −0 third_party/proctitle.c
  156. +553 −0 third_party/queue.h
  157. +770 −0 third_party/tree.h
  158. +309 −0 third_party/valgrind/memcheck.h
  159. +4,020 −0 third_party/valgrind/valgrind.h
@@ -0,0 +1,2 @@
+set history save on
+handle SIGPIPE nostop noprint pass
@@ -0,0 +1,12 @@
+.gitignore
+.gdb_history
+TAGS
+_*
+*.cfg
+config.mk
+lcov
+*.o
+*.d
+tarantool*
+*.snap
+*.xlog
25 LICENSE
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2010 Mail.RU
+ * Copyright (C) 2010 Yuriy Vostrikov
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
150 Makefile
@@ -0,0 +1,150 @@
+
+# This makefile based on ideas from http://make.paulandlesley.org/
+# Thanks to Paul D. Smith <psmith@gnu.org>
+
+ECHO=/bin/echo
+CAT=/bin/cat
+
+# make magick
+SUB_MAKE:=$(filter _%,$(notdir $(CURDIR)))
+OBJDIR:=$(shell $(ECHO) $(filter _%,$(MAKECMDGOALS)) | tr ' ' '\n' | cut -d/ -f1 | sort | uniq)
+ifeq (,$(SUB_MAKE))
+ifneq (,$(OBJDIR))
+.SUFFIXES:
+MAKEFLAGS += -rR --no-print-directory SRCDIR=$(CURDIR) VPATH=$(CURDIR)
+FILTERED_MAKECMDGOALS=$(subst $@/,,$(filter $@/%,$(MAKECMDGOALS)))
+MODULE=$(subst tarantool_,,$(FILTERED_MAKECMDGOALS))
+.PHONY: $(OBJDIR)
+$(OBJDIR):
+ +@mkdir -p $@
+ +@$(MAKE) -C $@ -f $(CURDIR)/Makefile OBJDIR=$@ module=$(MODULE) $(FILTERED_MAKECMDGOALS)
+
+Makefile: ;
+%.mk :: ;
+% :: $(OBJDIR) ; @:
+else
+SRCDIR:=$(CURDIR)
+endif
+endif
+
+# this global rules are always defined
+module ?= silverbox
+all: tarantool_$(module)
+
+ifeq ("$(origin module)", "command line")
+.PHONY: clean
+clean:
+ @rm -rf $(obj) $(dep) tarantool_$(module) _* lcov test
+else
+.PHONY: clean
+clean:
+ @for mod in mod/*; do make --no-print-directory module=`basename $$mod` clean; done
+endif
+.PHONY: TAGS
+tags:
+ ctags -R -e -f TAGS
+
+# then SRCDIR is defined, build type is selected and it's time to define build rules
+ifneq (,$(SRCDIR))
+-include $(SRCDIR)/config.mk $(SRCDIR)/scripts/config.mk
+include $(SRCDIR)/scripts/config_def.mk
+
+ifeq (_debug,$(OBJDIR))
+ DEBUG=0
+else ifeq (_test,$(OBJDIR))
+ CFLAGS += --coverage -DCOVERAGE -DNDEBUG
+else ifeq (_coverage,$(OBJDIR))
+ CFLAGS += --coverage -DCOVERAGE
+endif
+
+# build dir includes going first
+ifneq (,$(OBJDIR))
+CFLAGS += -I$(SRCDIR)/$(OBJDIR) -I$(SRCDIR)/$(OBJDIR)/include
+endif
+CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/include
+LIBS += -lm
+
+subdirs = third_party mod/$(module) cfg core
+include $(foreach dir,$(subdirs),$(SRCDIR)/$(dir)/Makefile)
+
+tarantool_$(module): $(obj)
+ $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $^ -o $@
+
+ifdef I
+$(info * build with $(filter -D%,$(CFLAGS)))
+endif
+
+# makefile change will force rebuild
+$(obj): $(wildcard ../*.mk) $(wildcard ../scripts/*.mk)
+$(obj): $(foreach dir,$(subdirs),$(SRCDIR)/$(dir)/Makefile)
+$(obj): Makefile
+
+dep = $(patsubst %.o,%.d,$(obj)) $(patsubst %.o,%.pd,$(obj))
+-include $(dep)
+
+ifneq (,$(OBJDIR))
+%.o: %.c
+ @mkdir -p $(dir $@)
+ $(CC) $(CFLAGS) -MD -c $< -o $@
+ @sed -n -f $(SRCDIR)/scripts/slurp.sed \
+ -f $(SRCDIR)/scripts/fixdep.sed \
+ -e 's!$(SRCDIR)/!!; p' \
+ < $(@:.o=.d) > $(@:.o=.pd)
+else
+%.o: %.c
+ @mkdir -p $(dir $@)
+ $(CC) $(CFLAGS) -MD -c $< -o $@
+endif
+
+# code gen targets
+.PRECIOUS: %.h %.c %.dot
+ifeq ($(HAVE_RAGEL),1)
+%.c: %.rl
+ @mkdir -p $(dir $@)
+ $(RAGEL) -G2 $< -o $@
+
+%.dot: %.rl
+ @mkdir -p $(dir $@)
+ $(RAGEL) -p -V $< -o $(basename $@).dot
+
+%.png: %.dot
+ @mkdir -p $(dir $@)
+ $(DOT) -Tpng $< -o $(basename $@).png
+endif
+ifeq ($(HAVE_CONFETTI),1)
+%.cfg: %.cfg_tmpl
+ @mkdir -p $(dir $@)
+ $(CONFETTI) -i $< -n tarantool_cfg -f $@
+
+%.h: %.cfg_tmpl
+ @mkdir -p $(dir $@)
+ $(CONFETTI) -i $< -n tarantool_cfg -h $@
+
+%.c: %.cfg_tmpl
+ @mkdir -p $(dir $@)
+ $(CONFETTI) -i $< -n tarantool_cfg -c $@
+endif
+
+ifeq ($(HAVE_GIT),1)
+tarantool_version.h: FORCE
+ @echo -n "const char tarantool_version_string[] = " > $@_
+ @git show HEAD | sed 's/commit \(.*\)/\"\1/;q' | tr -d \\n >> $@_
+ @git diff --quiet || (echo -n ' AND'; git diff --shortstat) | tr -d \\n >> $@_
+ @echo '";' >> $@_
+ @diff -q $@ $@_ 2>/dev/null >/dev/null || ($(ECHO) " GEN " $(notdir $@); cp $@_ $@)
+FORCE:
+endif
+
+
+ifeq ("$(origin V)", "command line")
+ VERBOSE = $(V)
+endif
+ifeq (,$(VERBOSE))
+ $(eval override CC = @$(ECHO) " CC " $$@; $(CC))
+ $(eval override RAGEL = @$(ECHO) " RGL " $$@; $(RAGEL))
+ $(eval override DOT = @$(ECHO) " DOT " $$@; $(DOT))
+ $(eval override CONFETTI = @$(ECHO) " CNF " $$@; $(CONFETTI))
+ $(eval override CAT = @$(ECHO) " CAT " $$@; $(CAT))
+endif
+
+endif
16 README
@@ -0,0 +1,16 @@
+Taranool.
+
+Yet another in-memory database.
+
+Key features:
+ * fast
+ * log streaming replication
+ * hot standby
+ * simple binary protocol
+ * memcached protocol emulation
+ * extensibility
+
+
+Cons:
+ * only tested on x86/Linux and x86/FreeBSD
+ * gcc is required to build
14 TODO
@@ -0,0 +1,14 @@
+* ber in lstr
+* handle OOM gracefully
+* link palloc red_zones and check integrety on prelease
+* handle follow failure gracefully
+* add comparer in repo
+* auto tests
+* support cheap palloc_create/palloc_destroy
+* reliable palloc stats (optional verbose)
+* EINTR handling
+* snapshot saving timer
+* remote_hot_standby status - show status 'connection' when connecting
+* rate limit io during dump
+* SEGV
+** with too small arena, when snapshot reading
@@ -0,0 +1,17 @@
+obj += cfg/warning.o
+obj += cfg/tarantool_$(module)_cfg.o
+
+ifeq ($(HAVE_CONFETTI),1)
+$(obj): cfg/tarantool_$(module)_cfg.h cfg/tarantool_$(module)_cfg.cfg
+cfg/tarantool_$(module)_cfg.cfg_tmpl: cfg/core_cfg.cfg_tmpl $(cfg_tmpl)
+ @mkdir -p $(dir $@)
+ @echo '%{ ' > $@
+ @echo "#include <third_party/confetti/prscfg.h>" >> $@
+ @echo "#include <cfg/tarantool_$(module)_cfg.h>" >> $@
+ @echo "void out_warning(ConfettyError r, char *format, ...);" >> $@
+ @echo '%}' >> $@
+ $(CAT) $^ >> $@
+endif
+
+CFLAGS += -DTARANTOOL_CONFIG='<cfg/tarantool_$(module)_cfg.h>'
+cfg/tarantool_$(module)_cfg.o: CFLAGS += -Wno-unused
@@ -0,0 +1,47 @@
+
+# username to switch to
+username=NULL
+
+# save core on abort/assert
+coredump=0
+
+# admin port
+# used for admin's connections
+admin_port=0
+
+# Log verbosity, possible values: ERROR=1, CRIT=2, WARN=3, INFO=4(default), DEBUG=5
+log_level=4
+
+# Size of slab arena in GiBs
+slab_alloc_arena=1.0
+# Size of minimal allocation unit
+slab_alloc_minimal=64
+# Growth factor, each subsecuent unit size is factor * prev unit size
+slab_alloc_factor=2.0
+
+# working directory (daemon will chdir(2) to it)
+work_dir=NULL
+
+# name of pid file
+pid_file="tarantool.pid"
+
+# logger command will be executed via /bin/sh -c {}
+# example: 'exec cronolog /var/log/taranul/%Y-%m/%Y-%m-%d/tarantool.log'
+# example: 'exec extra/logger.pl /var/log/taranul/tarantool.log'
+# when logger is not configured all logging going to STDERR
+logger=NULL
+
+# make logging nonblocking, this potentially can loss some logging data
+logger_nonblock=1
+
+# delay between loop iteraions
+io_collect_interval=0.0
+
+# do not write snapshot faster then snap_io_rate_limit MBytes/sec
+snap_io_rate_limit=0.0
+
+# size of listen backlog
+backlog=1024
+
+# network io readahead
+readahead=16320
Oops, something went wrong.

0 comments on commit 9b8dd70

Please sign in to comment.