Skip to content
Snippets Groups Projects
Commit 93f8cf3f authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

Implement the new data dictionary.

Store the information about spaces in a pre-recreated
system space.

https://blueprints.launchpad.net/tarantool/+spec/space-ddl

Remove space configuration from confetti.
Use transaction and space triggers to run post-DML
actions to perform DDL changes.

Implement a Lua FFI binding to disable tests.

Temporarily disable space-loading code in tarancheck
and tarantar (this breaks them).

Mostly all tests are broken.
Memcached is disabled (non-functional).
parent 90ebc525
No related branches found
No related tags found
No related merge requests found
Showing
with 1122 additions and 811 deletions
...@@ -71,10 +71,6 @@ snap_io_rate_limit=0.0 ...@@ -71,10 +71,6 @@ snap_io_rate_limit=0.0
# Write no more rows in WAL # Write no more rows in WAL
rows_per_wal=500000, ro rows_per_wal=500000, ro
# OBSOLETE
# Starting from 1.4.5, this variable has no effect.
wal_writer_inbox_size=16384, ro
# Defines fiber/data synchronization fsync(2) policy: # Defines fiber/data synchronization fsync(2) policy:
# "none": does not write to WAL # "none": does not write to WAL
# "write": fibers wait for their data to be written to the log. # "write": fibers wait for their data to be written to the log.
......
This diff is collapsed.
...@@ -13,30 +13,6 @@ ...@@ -13,30 +13,6 @@
* Autogenerated file, do not edit it! * Autogenerated file, do not edit it!
*/ */
typedef struct tarantool_cfg_space_index_key_field {
unsigned char __confetti_flags;
int32_t fieldno;
char* type;
} tarantool_cfg_space_index_key_field;
typedef struct tarantool_cfg_space_index {
unsigned char __confetti_flags;
char* type;
confetti_bool_t unique;
tarantool_cfg_space_index_key_field** key_field;
} tarantool_cfg_space_index;
typedef struct tarantool_cfg_space {
unsigned char __confetti_flags;
confetti_bool_t enabled;
int32_t arity;
int32_t estimated_rows;
tarantool_cfg_space_index** index;
} tarantool_cfg_space;
typedef struct tarantool_cfg { typedef struct tarantool_cfg {
unsigned char __confetti_flags; unsigned char __confetti_flags;
...@@ -126,12 +102,6 @@ typedef struct tarantool_cfg { ...@@ -126,12 +102,6 @@ typedef struct tarantool_cfg {
/* Write no more rows in WAL */ /* Write no more rows in WAL */
int32_t rows_per_wal; int32_t rows_per_wal;
/*
* OBSOLETE
* Starting from 1.4.5, this variable has no effect.
*/
int32_t wal_writer_inbox_size;
/* /*
* Defines fiber/data synchronization fsync(2) policy: * Defines fiber/data synchronization fsync(2) policy:
* "none": does not write to WAL * "none": does not write to WAL
...@@ -204,7 +174,6 @@ typedef struct tarantool_cfg { ...@@ -204,7 +174,6 @@ typedef struct tarantool_cfg {
* only accepts reads. * only accepts reads.
*/ */
char* replication_source; char* replication_source;
tarantool_cfg_space** space;
} tarantool_cfg; } tarantool_cfg;
#ifndef CNF_FLAG_STRUCT_NEW #ifndef CNF_FLAG_STRUCT_NEW
......
...@@ -439,11 +439,13 @@ int tc_generate(struct tc_options *opts) ...@@ -439,11 +439,13 @@ int tc_generate(struct tc_options *opts)
int rc = tc_space_init(&s); int rc = tc_space_init(&s);
if (rc == -1) if (rc == -1)
return -1; return -1;
#if 0
rc = tc_space_fill(&s, opts); rc = tc_space_fill(&s, opts);
if (rc == -1) { if (rc == -1) {
tc_space_free(&s); tc_space_free(&s);
return -1; return -1;
} }
#endif
printf("configured spaces: %d\n", mh_size(s.t)); printf("configured spaces: %d\n", mh_size(s.t));
printf("snap_dir: %s\n", opts->cfg.snap_dir); printf("snap_dir: %s\n", opts->cfg.snap_dir);
printf("wal_dir: %s\n", opts->cfg.wal_dir); printf("wal_dir: %s\n", opts->cfg.wal_dir);
......
...@@ -122,6 +122,7 @@ tc_space_key_typeof(char *name) ...@@ -122,6 +122,7 @@ tc_space_key_typeof(char *name)
return TC_SPACE_KEY_UNKNOWN; return TC_SPACE_KEY_UNKNOWN;
} }
#if 0
static int static int
tc_space_key_init(struct tc_space *s, tarantool_cfg_space *cs) tc_space_key_init(struct tc_space *s, tarantool_cfg_space *cs)
{ {
...@@ -196,3 +197,4 @@ int tc_space_fill(struct tc_spaces *s, struct tc_options *opts) ...@@ -196,3 +197,4 @@ int tc_space_fill(struct tc_spaces *s, struct tc_options *opts)
} }
return 0; return 0;
} }
#endif
...@@ -35,6 +35,7 @@ void tc_space_free(struct tc_spaces *s); ...@@ -35,6 +35,7 @@ void tc_space_free(struct tc_spaces *s);
struct tc_space *tc_space_create(struct tc_spaces *s, uint32_t id); struct tc_space *tc_space_create(struct tc_spaces *s, uint32_t id);
struct tc_space *tc_space_match(struct tc_spaces *s, uint32_t id); struct tc_space *tc_space_match(struct tc_spaces *s, uint32_t id);
#if 0
int tc_space_fill(struct tc_spaces *s, struct tc_options *opts); int tc_space_fill(struct tc_spaces *s, struct tc_options *opts);
#endif
#endif #endif
...@@ -186,10 +186,12 @@ int tc_verify(struct tc_options *opts) ...@@ -186,10 +186,12 @@ int tc_verify(struct tc_options *opts)
int rc = tc_space_init(&ss); int rc = tc_space_init(&ss);
if (rc == -1) if (rc == -1)
return -1; return -1;
#if 0
rc = tc_space_fill(&ss, opts); rc = tc_space_fill(&ss, opts);
if (rc == -1) if (rc == -1)
goto error; goto error;
#endif
/* 2. load signature file */ /* 2. load signature file */
uint64_t last_xlog_lsn = 0; uint64_t last_xlog_lsn = 0;
uint64_t last_snap_lsn = 0; uint64_t last_snap_lsn = 0;
......
...@@ -147,12 +147,14 @@ int main(int argc, char *argv[]) ...@@ -147,12 +147,14 @@ int main(int argc, char *argv[])
ts_options_free(&tss.opts); ts_options_free(&tss.opts);
return 1; return 1;
} }
#if 0
rc = ts_space_fill(&tss.s, &tss.opts); rc = ts_space_fill(&tss.s, &tss.opts);
if (rc == -1) { if (rc == -1) {
ts_space_free(&tss.s); ts_space_free(&tss.s);
ts_options_free(&tss.opts); ts_options_free(&tss.opts);
return 1; return 1;
} }
#endif
printf("snap_dir: %s\n", tss.opts.cfg.snap_dir); printf("snap_dir: %s\n", tss.opts.cfg.snap_dir);
printf("wal_dir: %s\n", tss.opts.cfg.wal_dir); printf("wal_dir: %s\n", tss.opts.cfg.wal_dir);
......
...@@ -140,6 +140,7 @@ ts_space_key_typeof(char *name) ...@@ -140,6 +140,7 @@ ts_space_key_typeof(char *name)
return TS_SPACE_KEY_UNKNOWN; return TS_SPACE_KEY_UNKNOWN;
} }
#if 0
static int static int
ts_space_key_init(struct ts_space *s, tarantool_cfg_space *cs) ts_space_key_init(struct ts_space *s, tarantool_cfg_space *cs)
{ {
...@@ -249,6 +250,7 @@ int ts_space_fill(struct ts_spaces *s, struct ts_options *opts) ...@@ -249,6 +250,7 @@ int ts_space_fill(struct ts_spaces *s, struct ts_options *opts)
} }
return 0; return 0;
} }
#endif
static inline struct ts_key* static inline struct ts_key*
ts_space_keyalloc_sha(struct ts_space *s, struct tnt_tuple *t, int fileid, ts_space_keyalloc_sha(struct ts_space *s, struct tnt_tuple *t, int fileid,
......
...@@ -44,7 +44,9 @@ void ts_space_recycle(struct ts_spaces *s); ...@@ -44,7 +44,9 @@ void ts_space_recycle(struct ts_spaces *s);
struct ts_space *ts_space_create(struct ts_spaces *s, uint32_t id); struct ts_space *ts_space_create(struct ts_spaces *s, uint32_t id);
struct ts_space *ts_space_match(struct ts_spaces *s, uint32_t id); struct ts_space *ts_space_match(struct ts_spaces *s, uint32_t id);
#if 0
int ts_space_fill(struct ts_spaces *s, struct ts_options *opts); int ts_space_fill(struct ts_spaces *s, struct ts_options *opts);
#endif
struct ts_key* struct ts_key*
ts_space_keyalloc(struct ts_space *s, struct tnt_tuple *t, int fileid, ts_space_keyalloc(struct ts_space *s, struct tnt_tuple *t, int fileid,
......
...@@ -100,9 +100,6 @@ macro(enable_tnt_compile_flags) ...@@ -100,9 +100,6 @@ macro(enable_tnt_compile_flags)
add_compile_flags("CXX" "-std=gnu++0x") add_compile_flags("CXX" "-std=gnu++0x")
endif() endif()
# Disable Run-time type information
add_compile_flags("CXX" "-fno-rtti")
add_compile_flags("C;CXX" add_compile_flags("C;CXX"
"-Wall" "-Wall"
"-Wextra" "-Wextra"
......
...@@ -1331,7 +1331,7 @@ lua box.cjson.decode('{"hello": "world"}').hello ...@@ -1331,7 +1331,7 @@ lua box.cjson.decode('{"hello": "world"}').hello
<emphasis role="lua" <emphasis role="lua"
xml:id="box.space.select_reverse_range" xml:id="box.space.select_reverse_range"
xreflabel="box.space.select_reverse_range"> xreflabel="box.space.select_reverse_range">
space:select_reverse_range(limit, key)</emphasis> space:select_reverse_range(index_no, limit, key)</emphasis>
</term> </term>
<listitem> <listitem>
<simpara> <simpara>
......
lua _schema = box.space[box.schema.SCHEMA_ID]
lua _space = box.space[box.schema.SPACE_ID]
lua _index = box.space[box.schema.INDEX_ID]
-- destroy everything - save snapshot produces an empty snapshot now
lua _schema:run_triggers(false)
lua _schema:truncate()
lua _space:run_triggers(false)
lua _space:truncate()
lua _index:run_triggers(false)
lua _index:truncate()
lua _schema = box.space[box.schema.SCHEMA_ID]
lua _space = box.space[box.schema.SPACE_ID]
lua _index = box.space[box.schema.INDEX_ID]
-- define schema version
lua _schema:insert('version', 1, 6)
-- define system spaces
lua _space:insert(_schema.n, 0, '_schema')
lua _space:insert(_space.n, 0, '_space')
lua _space:insert(_index.n, 0, '_index')
-- define indexes
lua _index:insert(_schema.n, 0, 'primary', 'tree', 1, 1, 0, 'str')
-- space name is unique
lua _index:insert(_space.n, 0, 'primary', 'tree', 1, 1, 0, 'num')
lua _index:insert(_space.n, 1, 'name', 'tree', 1, 1, 2, 'str')
-- index name is unique within a space
lua _index:insert(_index.n, 0, 'primary', 'tree', 1, 2, 0, 'num', 1, 'num')
lua _index:insert(_index.n, 1, 'name', 'tree', 1, 2, 0, 'num', 2, 'str')
--
...@@ -55,10 +55,10 @@ enum { TNT_ERRMSG_MAX = 512 }; ...@@ -55,10 +55,10 @@ enum { TNT_ERRMSG_MAX = 512 };
/* 2 */_(ER_ILLEGAL_PARAMS, 2, "Illegal parameters, %s") \ /* 2 */_(ER_ILLEGAL_PARAMS, 2, "Illegal parameters, %s") \
/* 3 */_(ER_SECONDARY, 2, "Can't modify data upon a request on the secondary port.") \ /* 3 */_(ER_SECONDARY, 2, "Can't modify data upon a request on the secondary port.") \
/* 4 */_(ER_TUPLE_IS_RO, 1, "Tuple is marked as read-only") \ /* 4 */_(ER_TUPLE_IS_RO, 1, "Tuple is marked as read-only") \
/* 5 */_(ER_INDEX_TYPE, 2, "Unsupported index type: %s") \ /* 5 */_(ER_INDEX_TYPE, 2, "Unsupported index type supplied for index %u in space %u") \
/* 6 */_(ER_SPACE_EXISTS, 2, "Space %u already exists") \ /* 6 */_(ER_SPACE_EXISTS, 2, "Space %u already exists") \
/* 7 */_(ER_MEMORY_ISSUE, 1, "Failed to allocate %u bytes in %s for %s") \ /* 7 */_(ER_MEMORY_ISSUE, 1, "Failed to allocate %u bytes in %s for %s") \
/* 8 */_(ER_UNUSED8, 2, "Unused8") \ /* 8 */_(ER_CREATE_SPACE, 2, "Failed to create space %u: %s") \
/* 9 */_(ER_INJECTION, 2, "Error injection '%s'") \ /* 9 */_(ER_INJECTION, 2, "Error injection '%s'") \
/* 10 */_(ER_UNSUPPORTED, 2, "%s does not support %s") \ /* 10 */_(ER_UNSUPPORTED, 2, "%s does not support %s") \
/* silverproxy error codes */ \ /* silverproxy error codes */ \
...@@ -76,13 +76,13 @@ enum { TNT_ERRMSG_MAX = 512 }; ...@@ -76,13 +76,13 @@ enum { TNT_ERRMSG_MAX = 512 };
/* 22 */_(ER_RESERVED22, 0, "Reserved22") \ /* 22 */_(ER_RESERVED22, 0, "Reserved22") \
/* 23 */_(ER_RESERVED23, 0, "Reserved23") \ /* 23 */_(ER_RESERVED23, 0, "Reserved23") \
/* end of silverproxy error codes */ \ /* end of silverproxy error codes */ \
/* 24 */_(ER_UNUSED24, 2, "Unused24") \ /* 24 */_(ER_DROP_SPACE, 2, "Can't drop space %u: %s") \
/* 25 */_(ER_UNUSED25, 2, "Unused25") \ /* 25 */_(ER_ALTER_SPACE, 2, "Can't modify space %u: %s") \
/* 26 */_(ER_FIBER_STACK, 2, "Can not create a new fiber: recursion limit reached") \ /* 26 */_(ER_FIBER_STACK, 2, "Can not create a new fiber: recursion limit reached") \
/* 27 */_(ER_UNUSED27, 2, "Unused27") \ /* 27 */_(ER_MODIFY_INDEX, 2, "Can't modify index %u in space %u: %s") \
/* 28 */_(ER_TUPLE_FORMAT_LIMIT, 2, "Tuple format limit reached: %u") \ /* 28 */_(ER_TUPLE_FORMAT_LIMIT, 2, "Tuple format limit reached: %u") \
/* 29 */_(ER_UNUSED29, 2, "Unused29") \ /* 29 */_(ER_LAST_DROP, 2, "Can't drop the primary key in a system space, space id %u") \
/* 30 */_(ER_UNUSED30, 2, "Unused30") \ /* 30 */_(ER_DROP_PRIMARY_KEY, 2, "Can't drop primary key in space %u while secondary keys exist") \
/* 31 */_(ER_UNUSED31, 2, "Unused31") \ /* 31 */_(ER_UNUSED31, 2, "Unused31") \
/* 32 */_(ER_UNUSED32, 2, "Unused32") \ /* 32 */_(ER_UNUSED32, 2, "Unused32") \
/* 33 */_(ER_UNUSED33, 2, "Unused33") \ /* 33 */_(ER_UNUSED33, 2, "Unused33") \
......
...@@ -35,13 +35,11 @@ struct tarantool_cfg; ...@@ -35,13 +35,11 @@ struct tarantool_cfg;
void void
memcached_init(const char *bind_ipaddr, int memcached_port); memcached_init(const char *bind_ipaddr, int memcached_port);
void
memcached_space_init();
int int
memcached_check_config(struct tarantool_cfg *conf); memcached_check_config(struct tarantool_cfg *conf);
void memcached_start_expire(); int
void memcached_stop_expire(); memcached_reload_config(struct tarantool_cfg *oldcfg,
struct tarantool_cfg *newcfg);
#endif /* TARANTOOL_MEMCACHED_H_INCLUDED */ #endif /* TARANTOOL_MEMCACHED_H_INCLUDED */
...@@ -5,6 +5,7 @@ endif() ...@@ -5,6 +5,7 @@ endif()
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/src/box/lua) file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/src/box/lua)
set(lua_sources) set(lua_sources)
lua_source(lua_sources lua/schema.lua)
lua_source(lua_sources lua/box.lua) lua_source(lua_sources lua/box.lua)
lua_source(lua_sources lua/box_net.lua) lua_source(lua_sources lua/box_net.lua)
lua_source(lua_sources lua/misc.lua) lua_source(lua_sources lua/misc.lua)
...@@ -25,6 +26,7 @@ tarantool_module("box" ...@@ -25,6 +26,7 @@ tarantool_module("box"
tree_index.cc tree_index.cc
bitset_index.cc bitset_index.cc
space.cc space.cc
alter.cc
schema.cc schema.cc
port.cc port.cc
request.cc request.cc
......
This diff is collapsed.
#ifndef INCLUDES_TARANTOOL_BOX_ALTER_H
#define INCLUDES_TARANTOOL_BOX_ALTER_H
/*
* 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 <COPYRIGHT HOLDER> ``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
* <COPYRIGHT HOLDER> 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.
*/
#include "trigger.h"
extern struct trigger alter_space_on_replace_space;
extern struct trigger alter_space_on_replace_index;
#endif /* INCLUDES_TARANTOOL_BOX_ALTER_H */
...@@ -43,7 +43,6 @@ extern "C" { ...@@ -43,7 +43,6 @@ extern "C" {
#include <stat.h> #include <stat.h>
#include <tarantool.h> #include <tarantool.h>
#include "tuple.h" #include "tuple.h"
#include "memcached.h"
#include "box_lua.h" #include "box_lua.h"
#include "schema.h" #include "schema.h"
#include "space.h" #include "space.h"
...@@ -157,8 +156,6 @@ box_enter_master_or_replica_mode(struct tarantool_cfg *conf) ...@@ -157,8 +156,6 @@ box_enter_master_or_replica_mode(struct tarantool_cfg *conf)
} else { } else {
box_process = process_rw; box_process = process_rw;
memcached_start_expire();
snprintf(status, sizeof(status), "primary%s", snprintf(status, sizeof(status), "primary%s",
custom_proc_title); custom_proc_title);
title("primary%s", custom_proc_title); title("primary%s", custom_proc_title);
...@@ -219,22 +216,6 @@ box_check_config(struct tarantool_cfg *conf) ...@@ -219,22 +216,6 @@ box_check_config(struct tarantool_cfg *conf)
return -1; return -1;
} }
/* check if at least one space is defined */
if (conf->space == NULL && conf->memcached_port == 0) {
out_warning(CNF_OK, "at least one space or memcached port must be defined");
return -1;
}
/* check configured spaces */
if (check_spaces(conf) != 0) {
return -1;
}
/* check memcached configuration */
if (memcached_check_config(conf) != 0) {
return -1;
}
return 0; return 0;
} }
...@@ -255,10 +236,6 @@ box_reload_config(struct tarantool_cfg *old_conf, struct tarantool_cfg *new_conf ...@@ -255,10 +236,6 @@ box_reload_config(struct tarantool_cfg *old_conf, struct tarantool_cfg *new_conf
return -1; return -1;
} }
if (!old_is_replica && new_is_replica)
memcached_stop_expire();
if (recovery_state->remote) if (recovery_state->remote)
recovery_stop_remote(recovery_state); recovery_stop_remote(recovery_state);
...@@ -283,8 +260,6 @@ box_init() ...@@ -283,8 +260,6 @@ box_init()
tuple_init(); tuple_init();
schema_init(); schema_init();
/* configure memcached space */
memcached_space_init();
/* recovery initialization */ /* recovery initialization */
recovery_init(cfg.snap_dir, cfg.wal_dir, recovery_init(cfg.snap_dir, cfg.wal_dir,
...@@ -337,6 +312,8 @@ snapshot_space(struct space *sp, void *udata) ...@@ -337,6 +312,8 @@ snapshot_space(struct space *sp, void *udata)
struct tuple *tuple; struct tuple *tuple;
struct snapshot_space_param *ud = (struct snapshot_space_param *) udata; struct snapshot_space_param *ud = (struct snapshot_space_param *) udata;
Index *pk = space_index(sp, 0); Index *pk = space_index(sp, 0);
if (pk == NULL)
return;
struct iterator *it = pk->position(); struct iterator *it = pk->position();
pk->initIterator(it, ITER_ALL, NULL, 0); pk->initIterator(it, ITER_ALL, NULL, 0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment