diff --git a/doc/www-data.in/_text/benchmark.md b/doc/www-data.in/_text/benchmark.md index 2760b841e7861fa68ce65e7b9978464eee35b0bf..9b59fda3a02c25e45e4bfe31677d4f0a1f942ca1 100644 --- a/doc/www-data.in/_text/benchmark.md +++ b/doc/www-data.in/_text/benchmark.md @@ -8,8 +8,8 @@ benchmark: Comparing Tarantool with other systems, apples to apples, is not strictly correct: the server networking subsystem is fully asynchronous and it's possible to proxy all clients via a single - socket. In this case, responses to queries are sent as soon they - are ready. Most production application use asynchronous and + socket. In this case, responses to queries are sent as soon as they + are ready. Most production applications use asynchronous and batched I/O with Tarantool. As long as the overhead of system calls and context switches is @@ -17,7 +17,7 @@ benchmark: request, use of batched and multiplexed I/O produces an order of magnitude better results, when compared with traditional multi-threaded workloads. A tool we developed for our own use, - [nosqlbench](http://github.com/mailru/nosqlbench), is utilizing + [nosqlbench](http://github.com/mailru/nosqlbench), utilizes this approach at full. However, to compare with the rest of the world, a standardized diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5606c223416f8238b63352bf6e52a7291fead073..fc83ef126591539af8c8af6f38d96d15d19c06d6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,6 +26,7 @@ lua_source(lua_sources lua/bsdsocket.lua) lua_source(lua_sources lua/errno.lua) lua_source(lua_sources lua/log.lua) lua_source(lua_sources lua/box_net_box.lua) +lua_source(lua_sources lua/help.lua) file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/third_party/luafun) lua_source(lua_sources ../third_party/luafun/fun.lua) @@ -170,6 +171,6 @@ if (TARGET_OS_DARWIN) LINK_FLAGS "-pagezero_size 10000 -image_base 100000000") elseif (TARGET_OS_FREEBSD AND NOT TARGET_OS_DEBIAN_FREEBSD) # Helps symbol resolution of plug-ins - set_target_properties(tarantool LINK_FLAGS "-rdynamic") + set_target_properties(tarantool PROPERTIES LINK_FLAGS "-rdynamic") endif() install (TARGETS tarantool DESTINATION bin) diff --git a/src/lua/bsdsocket.lua b/src/lua/bsdsocket.lua index 014e6c4fee30bec99db18595a672b7ef6b231169..487f867b72c71802fd67a601bd7f2460b8be5070 100644 --- a/src/lua/bsdsocket.lua +++ b/src/lua/bsdsocket.lua @@ -926,6 +926,7 @@ local function tcp_connect(host, port, timeout) end if s:writable(timeout) then + boxerrno(0) return s end end diff --git a/src/lua/help.lua b/src/lua/help.lua new file mode 100644 index 0000000000000000000000000000000000000000..4fadcf3b095485cdf7743605a63003e51f563aa0 --- /dev/null +++ b/src/lua/help.lua @@ -0,0 +1,43 @@ +help = {} +help[1] = {} +help[1]["Help topics"] = { "Tutorial", "Basics", "Administration" } +help[2] = "To get help on a topic, type help('topic') (with quotes)" +help[3] = "To get help on a function/object, type help(function) (without quotes)" + +local help_function_data = {}; +help_function_data["Administration"] = {} +help_function_data["Administration"]["Server administrative commands"] = +{ "box.snapshot()", + "box.info()", + "box.stat()", + "box.slab.info()", + "box.slab.check()", + "box.fiber.info()", + "box.plugin.info()", + "box.cfg()", + "box.coredump()" +} +help_function_data["Basics"] = "First thing to be done before any database object can be created, is calling box.cfg() to configure and bootstrap the database instance. Once this is done, define database objects using box.schema, for example type box.schema.space.create('test') to create space 'test'. To add an index on a space, type box.space.test:create_index(). With an index, the space can accept tuples. Insert a tuple with box.space.test:insert{1, 'First tuple'}" + +local help_object_data = {} + +local function help_call(table, param) + if type(param) == 'string' then + if help_function_data[param] ~= nil then + return help_function_data[param] + end + end + if type(param) == 'table' then + if help_object_data[param] ~= nil then + return help_object_data[param] + end + end + if param ~= nil then + return "Help object not found" + end + return table +end + +setmetatable(help, { __call = help_call }) + + diff --git a/src/lua/init.cc b/src/lua/init.cc index 0e6cfb64f34f4e945f759ec9c2629253e552aa25..85e57d201d2f1dea042c632776ecf6f3d556ad79 100644 --- a/src/lua/init.cc +++ b/src/lua/init.cc @@ -77,11 +77,13 @@ extern char uuid_lua[], init_lua[], log_lua[], console_lua[], - box_net_box_lua[]; + box_net_box_lua[], + help_lua[]; static const char *lua_sources[] = { init_lua, session_lua, + help_lua, NULL }; @@ -392,7 +394,8 @@ run_script(va_list ap) if (luaL_loadfile(L, NULL) != 0) panic("%s", lua_tostring(L, -1)); } else { - say_crit("version %s", tarantool_version()); + say_crit("version %s\ntype 'help' for interactive help", + tarantool_version()); /* get console.repl from package.loaded */ lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); lua_getfield(L, -1, "console"); diff --git a/src/lua/init.lua b/src/lua/init.lua index ca24c82300b400d6883c97a0fb946acea8829b5d..30802616168b7c5c538c8ce2fbeb407076a44a10 100644 --- a/src/lua/init.lua +++ b/src/lua/init.lua @@ -28,23 +28,6 @@ dostring = function(s, ...) return chunk(...) end --- This function automatically called by console client --- on help command. -function help() - return "server admin commands", { - "box.snapshot()", - "box.info()", - "box.stat()", - "box.slab.info()", - "box.slab.check()", - "box.fiber.info()", - "box.plugin.info()", - "box.cfg()", - "box.cfg.reload()", - "box.coredump()" - } -end - -- This function automatically called by the server for -- any new admin client. function motd() diff --git a/test/box/admin.result b/test/box/admin.result index 957102b1efa098463232bdd553a3b4e168189cfa..498e699f825166cef1d9839abbaf5b758469c5af 100644 --- a/test/box/admin.result +++ b/test/box/admin.result @@ -10,17 +10,12 @@ space:create_index('primary', { type = 'hash' }) --# push filter 'admin_port: .*' to 'admin_port: <number>' help() --- -- server admin commands -- - box.snapshot() - - box.info() - - box.stat() - - box.slab.info() - - box.slab.check() - - box.fiber.info() - - box.plugin.info() - - box.cfg() - - box.cfg.reload() - - box.coredump() +- - Help topics: + - Tutorial + - Basics + - Administration + - To get help on a topic, type help('topic') (with quotes) + - To get help on a function/object, type help(function) (without quotes) ... box.cfg ---