diff --git a/cfg/core_cfg.cfg_tmpl b/cfg/core_cfg.cfg_tmpl index b73e138195445e12eb73330fa66791a963b62f39..bb3580aa5ce2ee5dadcf0ecb0ba4aaf49ed52b0c 100644 --- a/cfg/core_cfg.cfg_tmpl +++ b/cfg/core_cfg.cfg_tmpl @@ -7,7 +7,7 @@ bind_ipaddr="INADDR_ANY", ro # save core on abort/assert # deprecated; use ulimit instead -coredump=0, ro +coredump=false, ro # admin port # used for admin's connections @@ -39,7 +39,7 @@ pid_file="tarantool.pid", ro logger=NULL, ro # make logging nonblocking, this potentially can lose some logging data -logger_nonblock=1, ro +logger_nonblock=true, ro # delay between loop iterations io_collect_interval=0.0, ro diff --git a/cfg/prscfg.c b/cfg/prscfg.c index 53d0490fb9b84f766a132bed28396254776e4c79..6f930b537c5f8981d0e3cf9913e0c664a239a608 100644 --- a/cfg/prscfg.c +++ b/cfg/prscfg.c @@ -15,12 +15,13 @@ static prscfg_yyscan_t prscfgScannerInitBuffer(char *buffer, prscfg_yy_extra_typ static void prscfgScannerFinish(prscfg_yyscan_t scanner); static int prscfgGetLineNo(prscfg_yyscan_t yyscanner); -/* A Bison parser, made by GNU Bison 2.4.3. */ + +/* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton interface for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. 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 @@ -76,7 +77,7 @@ static int prscfgGetLineNo(prscfg_yyscan_t yyscanner); typedef union YYSTYPE { -/* Line 1685 of yacc.c */ +/* Line 1676 of yacc.c */ #line 89 "prscfg.y" char *str; @@ -86,8 +87,8 @@ typedef union YYSTYPE -/* Line 1685 of yacc.c */ -#line 74 "y.tab.h" +/* Line 1676 of yacc.c */ +#line 75 "y.tab.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -97,12 +98,13 @@ typedef union YYSTYPE -/* A Bison parser, made by GNU Bison 2.4.3. */ + +/* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. 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 @@ -144,7 +146,7 @@ typedef union YYSTYPE #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.4.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -256,7 +258,7 @@ static OptDef *output; /* Line 189 of yacc.c */ -#line 161 "y.tab.c" +#line 162 "y.tab.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -315,7 +317,7 @@ typedef union YYSTYPE /* Line 214 of yacc.c */ -#line 220 "y.tab.c" +#line 221 "y.tab.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -327,7 +329,7 @@ typedef union YYSTYPE /* Line 264 of yacc.c */ -#line 232 "y.tab.c" +#line 233 "y.tab.c" #ifdef short # undef short @@ -377,7 +379,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS +# if YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -762,18 +764,9 @@ static const yytype_uint8 yystos[] = /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ + Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif #define YYRECOVERING() (!!yyerrstatus) @@ -830,7 +823,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +# if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -1574,35 +1567,35 @@ YYSTYPE yylval; { case 2: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 106 "prscfg.y" { output = (yyval.node) = (yyvsp[(1) - (1)].node); } break; case 3: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 110 "prscfg.y" { MakeAtom((yyval.atom), (yyvsp[(1) - (1)].str)); } break; case 4: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 111 "prscfg.y" { MakeAtom((yyval.atom), (yyvsp[(1) - (1)].str)); } break; case 5: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 115 "prscfg.y" { (yyval.atom) = (yyvsp[(1) - (1)].atom); } break; case 6: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 116 "prscfg.y" { (yyval.atom) = (yyvsp[(1) - (4)].atom); @@ -1614,21 +1607,21 @@ YYSTYPE yylval; case 7: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 125 "prscfg.y" { (yyval.atom) = (yyvsp[(1) - (1)].atom); } break; case 8: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 126 "prscfg.y" { MakeList((yyval.atom), (yyvsp[(1) - (3)].atom), (yyvsp[(3) - (3)].atom)); } break; case 9: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 130 "prscfg.y" { (yyval.atom) = (yyvsp[(1) - (4)].atom); @@ -1640,140 +1633,140 @@ YYSTYPE yylval; case 10: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 136 "prscfg.y" { MakeList((yyval.atom), (yyvsp[(1) - (3)].atom), (yyvsp[(3) - (3)].atom)); } break; case 11: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 140 "prscfg.y" { (yyval.node) = (yyvsp[(1) - (1)].node); } break; case 12: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 141 "prscfg.y" { MakeList((yyval.node), (yyvsp[(3) - (3)].node), (yyvsp[(1) - (3)].node)); /* plainOptDef will revert the list */ } break; case 13: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 145 "prscfg.y" { SetSection((yyval.node), (yyvsp[(4) - (4)].node), (yyvsp[(2) - (4)].atom)); } break; case 14: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 146 "prscfg.y" { SetSection((yyval.node), (yyvsp[(4) - (4)].node), (yyvsp[(2) - (4)].atom)); } break; case 15: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 150 "prscfg.y" { (yyval.node) = (yyvsp[(1) - (1)].node); } break; case 16: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 151 "prscfg.y" { (yyval.node) = (yyvsp[(1) - (1)].node); } break; case 17: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 152 "prscfg.y" { MakeList((yyval.node), (yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].node)); } break; case 18: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 156 "prscfg.y" { MakeScalarParam((yyval.node), number, (yyvsp[(1) - (3)].atom), (yyvsp[(3) - (3)].str)); } break; case 19: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 157 "prscfg.y" { MakeScalarParam((yyval.node), string, (yyvsp[(1) - (3)].atom), (yyvsp[(3) - (3)].str)); } break; case 20: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 158 "prscfg.y" { MakeScalarParam((yyval.node), string, (yyvsp[(1) - (3)].atom), (yyvsp[(3) - (3)].str)); } break; case 21: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 159 "prscfg.y" { MakeScalarParam((yyval.node), string, (yyvsp[(1) - (3)].atom), (yyvsp[(3) - (3)].str)); } break; case 22: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 160 "prscfg.y" { MakeScalarParam((yyval.node), string, (yyvsp[(1) - (3)].atom), NULL); free((yyvsp[(3) - (3)].str)); } break; case 23: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 161 "prscfg.y" { MakeScalarParam((yyval.node), struct, (yyvsp[(1) - (6)].atom), (yyvsp[(4) - (6)].node)); SetParent( (yyval.node), (yyvsp[(4) - (6)].node) ); } break; case 24: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 162 "prscfg.y" { (yyvsp[(4) - (6)].node)->name = (yyvsp[(1) - (6)].atom); (yyval.node) = (yyvsp[(4) - (6)].node); } break; case 25: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 163 "prscfg.y" { MakeScalarParam((yyval.node), array, (yyvsp[(1) - (4)].atom), NULL); } break; case 26: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 164 "prscfg.y" { MakeScalarParam((yyval.node), struct, (yyvsp[(1) - (6)].atom), (yyvsp[(4) - (6)].node)); SetParent( (yyval.node), (yyvsp[(4) - (6)].node) ); } break; case 27: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 168 "prscfg.y" { (yyval.str)=NULL; } break; case 28: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 169 "prscfg.y" { (yyval.str)=NULL; } break; case 29: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 173 "prscfg.y" { OptDef *str; @@ -1790,7 +1783,7 @@ YYSTYPE yylval; case 30: -/* Line 1464 of yacc.c */ +/* Line 1455 of yacc.c */ #line 184 "prscfg.y" { OptDef *str; @@ -1808,8 +1801,8 @@ YYSTYPE yylval; -/* Line 1464 of yacc.c */ -#line 1714 "y.tab.c" +/* Line 1455 of yacc.c */ +#line 1706 "y.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2020,7 +2013,7 @@ YYSTYPE yylval; -/* Line 1684 of yacc.c */ +/* Line 1675 of yacc.c */ #line 198 "prscfg.y" @@ -2314,7 +2307,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -2345,6 +2337,8 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -2418,7 +2412,15 @@ typedef void* yyscan_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -2759,7 +2761,7 @@ static YY_BUFFER_STATE buf = NULL; -#line 503 "prscfg_scan.c" +#line 512 "prscfg_scan.c" #define INITIAL 0 #define xQUOTED 1 @@ -2853,10 +2855,6 @@ int prscfg_yyget_lineno (yyscan_t yyscanner ); void prscfg_yyset_lineno (int line_number ,yyscan_t yyscanner ); -int prscfg_yyget_column (yyscan_t yyscanner ); - -void prscfg_yyset_column (int column_no ,yyscan_t yyscanner ); - YYSTYPE * prscfg_yyget_lval (yyscan_t yyscanner ); void prscfg_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); @@ -2893,7 +2891,12 @@ static int input (yyscan_t yyscanner ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -2912,7 +2915,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - unsigned n; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -3000,7 +3003,7 @@ YY_DECL #line 40 "prscfg.l" -#line 744 "prscfg_scan.c" +#line 754 "prscfg_scan.c" yylval = yylval_param; @@ -3316,7 +3319,7 @@ YY_RULE_SETUP #line 182 "prscfg.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1060 "prscfg_scan.c" +#line 1070 "prscfg_scan.c" case YY_END_OF_BUFFER: { @@ -4045,8 +4048,8 @@ YY_BUFFER_STATE prscfg_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner /** Setup the input buffer state to scan the given bytes. The next call to prscfg_yylex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ diff --git a/cfg/tarantool_box_cfg.c b/cfg/tarantool_box_cfg.c index 4e4d564a1fc3d354d3ae765b18a5faddbaebc442..c434286a48856fe3ca6716ce4780f81bb239c478 100644 --- a/cfg/tarantool_box_cfg.c +++ b/cfg/tarantool_box_cfg.c @@ -30,7 +30,7 @@ init_tarantool_cfg(tarantool_cfg *c) { c->username = NULL; c->bind_ipaddr = NULL; - c->coredump = 0; + c->coredump = false; c->admin_port = 0; c->replication_port = 0; c->log_level = 0; @@ -40,7 +40,7 @@ init_tarantool_cfg(tarantool_cfg *c) { c->work_dir = NULL; c->pid_file = NULL; c->logger = NULL; - c->logger_nonblock = 0; + c->logger_nonblock = false; c->io_collect_interval = 0; c->backlog = 0; c->readahead = 0; @@ -52,17 +52,17 @@ init_tarantool_cfg(tarantool_cfg *c) { c->custom_proc_title = NULL; c->memcached_port = 0; c->memcached_namespace = 0; - c->memcached_expire = 0; + c->memcached_expire = false; c->memcached_expire_per_loop = 0; c->memcached_expire_full_sweep = 0; c->snap_io_rate_limit = 0; c->rows_per_wal = 0; c->wal_fsync_delay = 0; c->wal_writer_inbox_size = 0; - c->local_hot_standby = 0; + c->local_hot_standby = false; c->wal_dir_rescan_delay = 0; - c->panic_on_snap_error = 0; - c->panic_on_wal_error = 0; + c->panic_on_snap_error = false; + c->panic_on_wal_error = false; c->replication_source = NULL; c->namespace = NULL; } @@ -74,7 +74,7 @@ fill_default_tarantool_cfg(tarantool_cfg *c) { c->username = NULL; c->bind_ipaddr = strdup("INADDR_ANY"); if (c->bind_ipaddr == NULL) return CNF_NOMEMORY; - c->coredump = 0; + c->coredump = false; c->admin_port = 0; c->replication_port = 0; c->log_level = 4; @@ -85,7 +85,7 @@ fill_default_tarantool_cfg(tarantool_cfg *c) { c->pid_file = strdup("tarantool.pid"); if (c->pid_file == NULL) return CNF_NOMEMORY; c->logger = NULL; - c->logger_nonblock = 1; + c->logger_nonblock = true; c->io_collect_interval = 0; c->backlog = 1024; c->readahead = 16320; @@ -99,17 +99,17 @@ fill_default_tarantool_cfg(tarantool_cfg *c) { c->custom_proc_title = NULL; c->memcached_port = 0; c->memcached_namespace = 23; - c->memcached_expire = 0; + c->memcached_expire = false; c->memcached_expire_per_loop = 1024; c->memcached_expire_full_sweep = 3600; c->snap_io_rate_limit = 0; c->rows_per_wal = 500000; c->wal_fsync_delay = 0; c->wal_writer_inbox_size = 128; - c->local_hot_standby = 0; + c->local_hot_standby = false; c->wal_dir_rescan_delay = 0.1; - c->panic_on_snap_error = 1; - c->panic_on_wal_error = 0; + c->panic_on_snap_error = true; + c->panic_on_wal_error = false; c->replication_source = NULL; c->namespace = NULL; return 0; @@ -341,6 +341,7 @@ acceptValue(tarantool_cfg* c, OptDef* opt, int check_rdonly) { errno = 0; if (check_rdonly && ( (opt->paramValue.stringval == NULL && c->username == NULL) || strcmp(opt->paramValue.stringval, c->username) != 0)) return CNF_RDONLY; + if (c->username) free(c->username); c->username = (opt->paramValue.stringval) ? strdup(opt->paramValue.stringval) : NULL; if (opt->paramValue.stringval && c->username == NULL) return CNF_NOMEMORY; @@ -352,23 +353,35 @@ acceptValue(tarantool_cfg* c, OptDef* opt, int check_rdonly) { errno = 0; if (check_rdonly && ( (opt->paramValue.stringval == NULL && c->bind_ipaddr == NULL) || strcmp(opt->paramValue.stringval, c->bind_ipaddr) != 0)) return CNF_RDONLY; + if (c->bind_ipaddr) free(c->bind_ipaddr); c->bind_ipaddr = (opt->paramValue.stringval) ? strdup(opt->paramValue.stringval) : NULL; if (opt->paramValue.stringval && c->bind_ipaddr == NULL) return CNF_NOMEMORY; } else if ( cmpNameAtoms( opt->name, _name__coredump) ) { - if (opt->paramType != numberType ) + if (opt->paramType != stringType ) return CNF_WRONGTYPE; c->__confetti_flags &= ~CNF_FLAG_STRUCT_NOTSET; errno = 0; - long int i32 = strtol(opt->paramValue.numberval, NULL, 10); - if (i32 == 0 && errno == EINVAL) - return CNF_WRONGINT; - if ( (i32 == LONG_MIN || i32 == LONG_MAX) && errno == ERANGE) + bool bln; + + if (strcasecmp(opt->paramValue.stringval, "true") == 0 || + strcasecmp(opt->paramValue.stringval, "yes") == 0 || + strcasecmp(opt->paramValue.stringval, "enable") == 0 || + strcasecmp(opt->paramValue.stringval, "on") == 0 || + strcasecmp(opt->paramValue.stringval, "1") == 0 ) + bln = true; + else if (strcasecmp(opt->paramValue.stringval, "false") == 0 || + strcasecmp(opt->paramValue.stringval, "no") == 0 || + strcasecmp(opt->paramValue.stringval, "disable") == 0 || + strcasecmp(opt->paramValue.stringval, "off") == 0 || + strcasecmp(opt->paramValue.stringval, "0") == 0 ) + bln = false; + else return CNF_WRONGRANGE; - if (check_rdonly && c->coredump != i32) + if (check_rdonly && c->coredump != bln) return CNF_RDONLY; - c->coredump = i32; + c->coredump = bln; } else if ( cmpNameAtoms( opt->name, _name__admin_port) ) { if (opt->paramType != numberType ) @@ -455,6 +468,7 @@ acceptValue(tarantool_cfg* c, OptDef* opt, int check_rdonly) { errno = 0; if (check_rdonly && ( (opt->paramValue.stringval == NULL && c->work_dir == NULL) || strcmp(opt->paramValue.stringval, c->work_dir) != 0)) return CNF_RDONLY; + if (c->work_dir) free(c->work_dir); c->work_dir = (opt->paramValue.stringval) ? strdup(opt->paramValue.stringval) : NULL; if (opt->paramValue.stringval && c->work_dir == NULL) return CNF_NOMEMORY; @@ -466,6 +480,7 @@ acceptValue(tarantool_cfg* c, OptDef* opt, int check_rdonly) { errno = 0; if (check_rdonly && ( (opt->paramValue.stringval == NULL && c->pid_file == NULL) || strcmp(opt->paramValue.stringval, c->pid_file) != 0)) return CNF_RDONLY; + if (c->pid_file) free(c->pid_file); c->pid_file = (opt->paramValue.stringval) ? strdup(opt->paramValue.stringval) : NULL; if (opt->paramValue.stringval && c->pid_file == NULL) return CNF_NOMEMORY; @@ -477,23 +492,35 @@ acceptValue(tarantool_cfg* c, OptDef* opt, int check_rdonly) { errno = 0; if (check_rdonly && ( (opt->paramValue.stringval == NULL && c->logger == NULL) || strcmp(opt->paramValue.stringval, c->logger) != 0)) return CNF_RDONLY; + if (c->logger) free(c->logger); c->logger = (opt->paramValue.stringval) ? strdup(opt->paramValue.stringval) : NULL; if (opt->paramValue.stringval && c->logger == NULL) return CNF_NOMEMORY; } else if ( cmpNameAtoms( opt->name, _name__logger_nonblock) ) { - if (opt->paramType != numberType ) + if (opt->paramType != stringType ) return CNF_WRONGTYPE; c->__confetti_flags &= ~CNF_FLAG_STRUCT_NOTSET; errno = 0; - long int i32 = strtol(opt->paramValue.numberval, NULL, 10); - if (i32 == 0 && errno == EINVAL) - return CNF_WRONGINT; - if ( (i32 == LONG_MIN || i32 == LONG_MAX) && errno == ERANGE) + bool bln; + + if (strcasecmp(opt->paramValue.stringval, "true") == 0 || + strcasecmp(opt->paramValue.stringval, "yes") == 0 || + strcasecmp(opt->paramValue.stringval, "enable") == 0 || + strcasecmp(opt->paramValue.stringval, "on") == 0 || + strcasecmp(opt->paramValue.stringval, "1") == 0 ) + bln = true; + else if (strcasecmp(opt->paramValue.stringval, "false") == 0 || + strcasecmp(opt->paramValue.stringval, "no") == 0 || + strcasecmp(opt->paramValue.stringval, "disable") == 0 || + strcasecmp(opt->paramValue.stringval, "off") == 0 || + strcasecmp(opt->paramValue.stringval, "0") == 0 ) + bln = false; + else return CNF_WRONGRANGE; - if (check_rdonly && c->logger_nonblock != i32) + if (check_rdonly && c->logger_nonblock != bln) return CNF_RDONLY; - c->logger_nonblock = i32; + c->logger_nonblock = bln; } else if ( cmpNameAtoms( opt->name, _name__io_collect_interval) ) { if (opt->paramType != numberType ) @@ -540,6 +567,7 @@ acceptValue(tarantool_cfg* c, OptDef* opt, int check_rdonly) { errno = 0; if (check_rdonly && ( (opt->paramValue.stringval == NULL && c->snap_dir == NULL) || strcmp(opt->paramValue.stringval, c->snap_dir) != 0)) return CNF_RDONLY; + if (c->snap_dir) free(c->snap_dir); c->snap_dir = (opt->paramValue.stringval) ? strdup(opt->paramValue.stringval) : NULL; if (opt->paramValue.stringval && c->snap_dir == NULL) return CNF_NOMEMORY; @@ -551,6 +579,7 @@ acceptValue(tarantool_cfg* c, OptDef* opt, int check_rdonly) { errno = 0; if (check_rdonly && ( (opt->paramValue.stringval == NULL && c->wal_dir == NULL) || strcmp(opt->paramValue.stringval, c->wal_dir) != 0)) return CNF_RDONLY; + if (c->wal_dir) free(c->wal_dir); c->wal_dir = (opt->paramValue.stringval) ? strdup(opt->paramValue.stringval) : NULL; if (opt->paramValue.stringval && c->wal_dir == NULL) return CNF_NOMEMORY; @@ -600,6 +629,7 @@ acceptValue(tarantool_cfg* c, OptDef* opt, int check_rdonly) { errno = 0; if (check_rdonly && ( (opt->paramValue.stringval == NULL && c->custom_proc_title == NULL) || strcmp(opt->paramValue.stringval, c->custom_proc_title) != 0)) return CNF_RDONLY; + if (c->custom_proc_title) free(c->custom_proc_title); c->custom_proc_title = (opt->paramValue.stringval) ? strdup(opt->paramValue.stringval) : NULL; if (opt->paramValue.stringval && c->custom_proc_title == NULL) return CNF_NOMEMORY; @@ -633,18 +663,29 @@ acceptValue(tarantool_cfg* c, OptDef* opt, int check_rdonly) { c->memcached_namespace = i32; } else if ( cmpNameAtoms( opt->name, _name__memcached_expire) ) { - if (opt->paramType != numberType ) + if (opt->paramType != stringType ) return CNF_WRONGTYPE; c->__confetti_flags &= ~CNF_FLAG_STRUCT_NOTSET; errno = 0; - long int i32 = strtol(opt->paramValue.numberval, NULL, 10); - if (i32 == 0 && errno == EINVAL) - return CNF_WRONGINT; - if ( (i32 == LONG_MIN || i32 == LONG_MAX) && errno == ERANGE) + bool bln; + + if (strcasecmp(opt->paramValue.stringval, "true") == 0 || + strcasecmp(opt->paramValue.stringval, "yes") == 0 || + strcasecmp(opt->paramValue.stringval, "enable") == 0 || + strcasecmp(opt->paramValue.stringval, "on") == 0 || + strcasecmp(opt->paramValue.stringval, "1") == 0 ) + bln = true; + else if (strcasecmp(opt->paramValue.stringval, "false") == 0 || + strcasecmp(opt->paramValue.stringval, "no") == 0 || + strcasecmp(opt->paramValue.stringval, "disable") == 0 || + strcasecmp(opt->paramValue.stringval, "off") == 0 || + strcasecmp(opt->paramValue.stringval, "0") == 0 ) + bln = false; + else return CNF_WRONGRANGE; - if (check_rdonly && c->memcached_expire != i32) + if (check_rdonly && c->memcached_expire != bln) return CNF_RDONLY; - c->memcached_expire = i32; + c->memcached_expire = bln; } else if ( cmpNameAtoms( opt->name, _name__memcached_expire_per_loop) ) { if (opt->paramType != numberType ) @@ -725,18 +766,29 @@ acceptValue(tarantool_cfg* c, OptDef* opt, int check_rdonly) { c->wal_writer_inbox_size = i32; } else if ( cmpNameAtoms( opt->name, _name__local_hot_standby) ) { - if (opt->paramType != numberType ) + if (opt->paramType != stringType ) return CNF_WRONGTYPE; c->__confetti_flags &= ~CNF_FLAG_STRUCT_NOTSET; errno = 0; - long int i32 = strtol(opt->paramValue.numberval, NULL, 10); - if (i32 == 0 && errno == EINVAL) - return CNF_WRONGINT; - if ( (i32 == LONG_MIN || i32 == LONG_MAX) && errno == ERANGE) + bool bln; + + if (strcasecmp(opt->paramValue.stringval, "true") == 0 || + strcasecmp(opt->paramValue.stringval, "yes") == 0 || + strcasecmp(opt->paramValue.stringval, "enable") == 0 || + strcasecmp(opt->paramValue.stringval, "on") == 0 || + strcasecmp(opt->paramValue.stringval, "1") == 0 ) + bln = true; + else if (strcasecmp(opt->paramValue.stringval, "false") == 0 || + strcasecmp(opt->paramValue.stringval, "no") == 0 || + strcasecmp(opt->paramValue.stringval, "disable") == 0 || + strcasecmp(opt->paramValue.stringval, "off") == 0 || + strcasecmp(opt->paramValue.stringval, "0") == 0 ) + bln = false; + else return CNF_WRONGRANGE; - if (check_rdonly && c->local_hot_standby != i32) + if (check_rdonly && c->local_hot_standby != bln) return CNF_RDONLY; - c->local_hot_standby = i32; + c->local_hot_standby = bln; } else if ( cmpNameAtoms( opt->name, _name__wal_dir_rescan_delay) ) { if (opt->paramType != numberType ) @@ -751,38 +803,61 @@ acceptValue(tarantool_cfg* c, OptDef* opt, int check_rdonly) { c->wal_dir_rescan_delay = dbl; } else if ( cmpNameAtoms( opt->name, _name__panic_on_snap_error) ) { - if (opt->paramType != numberType ) + if (opt->paramType != stringType ) return CNF_WRONGTYPE; c->__confetti_flags &= ~CNF_FLAG_STRUCT_NOTSET; errno = 0; - long int i32 = strtol(opt->paramValue.numberval, NULL, 10); - if (i32 == 0 && errno == EINVAL) - return CNF_WRONGINT; - if ( (i32 == LONG_MIN || i32 == LONG_MAX) && errno == ERANGE) + bool bln; + + if (strcasecmp(opt->paramValue.stringval, "true") == 0 || + strcasecmp(opt->paramValue.stringval, "yes") == 0 || + strcasecmp(opt->paramValue.stringval, "enable") == 0 || + strcasecmp(opt->paramValue.stringval, "on") == 0 || + strcasecmp(opt->paramValue.stringval, "1") == 0 ) + bln = true; + else if (strcasecmp(opt->paramValue.stringval, "false") == 0 || + strcasecmp(opt->paramValue.stringval, "no") == 0 || + strcasecmp(opt->paramValue.stringval, "disable") == 0 || + strcasecmp(opt->paramValue.stringval, "off") == 0 || + strcasecmp(opt->paramValue.stringval, "0") == 0 ) + bln = false; + else return CNF_WRONGRANGE; - if (check_rdonly && c->panic_on_snap_error != i32) + if (check_rdonly && c->panic_on_snap_error != bln) return CNF_RDONLY; - c->panic_on_snap_error = i32; + c->panic_on_snap_error = bln; } else if ( cmpNameAtoms( opt->name, _name__panic_on_wal_error) ) { - if (opt->paramType != numberType ) + if (opt->paramType != stringType ) return CNF_WRONGTYPE; c->__confetti_flags &= ~CNF_FLAG_STRUCT_NOTSET; errno = 0; - long int i32 = strtol(opt->paramValue.numberval, NULL, 10); - if (i32 == 0 && errno == EINVAL) - return CNF_WRONGINT; - if ( (i32 == LONG_MIN || i32 == LONG_MAX) && errno == ERANGE) + bool bln; + + if (strcasecmp(opt->paramValue.stringval, "true") == 0 || + strcasecmp(opt->paramValue.stringval, "yes") == 0 || + strcasecmp(opt->paramValue.stringval, "enable") == 0 || + strcasecmp(opt->paramValue.stringval, "on") == 0 || + strcasecmp(opt->paramValue.stringval, "1") == 0 ) + bln = true; + else if (strcasecmp(opt->paramValue.stringval, "false") == 0 || + strcasecmp(opt->paramValue.stringval, "no") == 0 || + strcasecmp(opt->paramValue.stringval, "disable") == 0 || + strcasecmp(opt->paramValue.stringval, "off") == 0 || + strcasecmp(opt->paramValue.stringval, "0") == 0 ) + bln = false; + else return CNF_WRONGRANGE; - if (check_rdonly && c->panic_on_wal_error != i32) + if (check_rdonly && c->panic_on_wal_error != bln) return CNF_RDONLY; - c->panic_on_wal_error = i32; + c->panic_on_wal_error = bln; } else if ( cmpNameAtoms( opt->name, _name__replication_source) ) { if (opt->paramType != stringType ) return CNF_WRONGTYPE; c->__confetti_flags &= ~CNF_FLAG_STRUCT_NOTSET; errno = 0; + if (c->replication_source) free(c->replication_source); c->replication_source = (opt->paramValue.stringval) ? strdup(opt->paramValue.stringval) : NULL; if (opt->paramValue.stringval && c->replication_source == NULL) return CNF_NOMEMORY; @@ -870,6 +945,7 @@ acceptValue(tarantool_cfg* c, OptDef* opt, int check_rdonly) { errno = 0; if (check_rdonly && ( (opt->paramValue.stringval == NULL && c->namespace[opt->name->index]->index[opt->name->next->index]->type == NULL) || strcmp(opt->paramValue.stringval, c->namespace[opt->name->index]->index[opt->name->next->index]->type) != 0)) return CNF_RDONLY; + if (c->namespace[opt->name->index]->index[opt->name->next->index]->type) free(c->namespace[opt->name->index]->index[opt->name->next->index]->type); c->namespace[opt->name->index]->index[opt->name->next->index]->type = (opt->paramValue.stringval) ? strdup(opt->paramValue.stringval) : NULL; if (opt->paramValue.stringval && c->namespace[opt->name->index]->index[opt->name->next->index]->type == NULL) return CNF_NOMEMORY; @@ -954,6 +1030,7 @@ acceptValue(tarantool_cfg* c, OptDef* opt, int check_rdonly) { errno = 0; if (check_rdonly && ( (opt->paramValue.stringval == NULL && c->namespace[opt->name->index]->index[opt->name->next->index]->key_field[opt->name->next->next->index]->type == NULL) || strcmp(opt->paramValue.stringval, c->namespace[opt->name->index]->index[opt->name->next->index]->key_field[opt->name->next->next->index]->type) != 0)) return CNF_RDONLY; + if (c->namespace[opt->name->index]->index[opt->name->next->index]->key_field[opt->name->next->next->index]->type) free(c->namespace[opt->name->index]->index[opt->name->next->index]->key_field[opt->name->next->next->index]->type); c->namespace[opt->name->index]->index[opt->name->next->index]->key_field[opt->name->next->next->index]->type = (opt->paramValue.stringval) ? strdup(opt->paramValue.stringval) : NULL; if (opt->paramValue.stringval && c->namespace[opt->name->index]->index[opt->name->next->index]->key_field[opt->name->next->next->index]->type == NULL) return CNF_NOMEMORY; @@ -1157,13 +1234,13 @@ tarantool_cfg_iterator_next(tarantool_cfg_iterator_t* i, tarantool_cfg *c, char i->state = S_name__coredump; return buf; case S_name__coredump: - *v = malloc(32); + *v = malloc(8); if (*v == NULL) { free(i); out_warning(CNF_NOMEMORY, "No memory to output value"); return NULL; } - sprintf(*v, "%"PRId32, c->coredump); + sprintf(*v, "%s", c->coredump ? "true" : "false"); snprintf(buf, PRINTBUFLEN-1, "coredump"); i->state = S_name__admin_port; return buf; @@ -1264,13 +1341,13 @@ tarantool_cfg_iterator_next(tarantool_cfg_iterator_t* i, tarantool_cfg *c, char i->state = S_name__logger_nonblock; return buf; case S_name__logger_nonblock: - *v = malloc(32); + *v = malloc(8); if (*v == NULL) { free(i); out_warning(CNF_NOMEMORY, "No memory to output value"); return NULL; } - sprintf(*v, "%"PRId32, c->logger_nonblock); + sprintf(*v, "%s", c->logger_nonblock ? "true" : "false"); snprintf(buf, PRINTBUFLEN-1, "logger_nonblock"); i->state = S_name__io_collect_interval; return buf; @@ -1393,13 +1470,13 @@ tarantool_cfg_iterator_next(tarantool_cfg_iterator_t* i, tarantool_cfg *c, char i->state = S_name__memcached_expire; return buf; case S_name__memcached_expire: - *v = malloc(32); + *v = malloc(8); if (*v == NULL) { free(i); out_warning(CNF_NOMEMORY, "No memory to output value"); return NULL; } - sprintf(*v, "%"PRId32, c->memcached_expire); + sprintf(*v, "%s", c->memcached_expire ? "true" : "false"); snprintf(buf, PRINTBUFLEN-1, "memcached_expire"); i->state = S_name__memcached_expire_per_loop; return buf; @@ -1470,13 +1547,13 @@ tarantool_cfg_iterator_next(tarantool_cfg_iterator_t* i, tarantool_cfg *c, char i->state = S_name__local_hot_standby; return buf; case S_name__local_hot_standby: - *v = malloc(32); + *v = malloc(8); if (*v == NULL) { free(i); out_warning(CNF_NOMEMORY, "No memory to output value"); return NULL; } - sprintf(*v, "%"PRId32, c->local_hot_standby); + sprintf(*v, "%s", c->local_hot_standby ? "true" : "false"); snprintf(buf, PRINTBUFLEN-1, "local_hot_standby"); i->state = S_name__wal_dir_rescan_delay; return buf; @@ -1492,24 +1569,24 @@ tarantool_cfg_iterator_next(tarantool_cfg_iterator_t* i, tarantool_cfg *c, char i->state = S_name__panic_on_snap_error; return buf; case S_name__panic_on_snap_error: - *v = malloc(32); + *v = malloc(8); if (*v == NULL) { free(i); out_warning(CNF_NOMEMORY, "No memory to output value"); return NULL; } - sprintf(*v, "%"PRId32, c->panic_on_snap_error); + sprintf(*v, "%s", c->panic_on_snap_error ? "true" : "false"); snprintf(buf, PRINTBUFLEN-1, "panic_on_snap_error"); i->state = S_name__panic_on_wal_error; return buf; case S_name__panic_on_wal_error: - *v = malloc(32); + *v = malloc(8); if (*v == NULL) { free(i); out_warning(CNF_NOMEMORY, "No memory to output value"); return NULL; } - sprintf(*v, "%"PRId32, c->panic_on_wal_error); + sprintf(*v, "%s", c->panic_on_wal_error ? "true" : "false"); snprintf(buf, PRINTBUFLEN-1, "panic_on_wal_error"); i->state = S_name__replication_source; return buf; @@ -1803,10 +1880,10 @@ int dup_tarantool_cfg(tarantool_cfg* dst, tarantool_cfg* src) { tarantool_cfg_iterator_t iterator, *i = &iterator; - dst->username = src->username == NULL ? NULL : strdup(src->username); + if (dst->username) free(dst->username);dst->username = src->username == NULL ? NULL : strdup(src->username); if (src->username != NULL && dst->username == NULL) return CNF_NOMEMORY; - dst->bind_ipaddr = src->bind_ipaddr == NULL ? NULL : strdup(src->bind_ipaddr); + if (dst->bind_ipaddr) free(dst->bind_ipaddr);dst->bind_ipaddr = src->bind_ipaddr == NULL ? NULL : strdup(src->bind_ipaddr); if (src->bind_ipaddr != NULL && dst->bind_ipaddr == NULL) return CNF_NOMEMORY; dst->coredump = src->coredump; @@ -1816,29 +1893,29 @@ dup_tarantool_cfg(tarantool_cfg* dst, tarantool_cfg* src) { dst->slab_alloc_arena = src->slab_alloc_arena; dst->slab_alloc_minimal = src->slab_alloc_minimal; dst->slab_alloc_factor = src->slab_alloc_factor; - dst->work_dir = src->work_dir == NULL ? NULL : strdup(src->work_dir); + if (dst->work_dir) free(dst->work_dir);dst->work_dir = src->work_dir == NULL ? NULL : strdup(src->work_dir); if (src->work_dir != NULL && dst->work_dir == NULL) return CNF_NOMEMORY; - dst->pid_file = src->pid_file == NULL ? NULL : strdup(src->pid_file); + if (dst->pid_file) free(dst->pid_file);dst->pid_file = src->pid_file == NULL ? NULL : strdup(src->pid_file); if (src->pid_file != NULL && dst->pid_file == NULL) return CNF_NOMEMORY; - dst->logger = src->logger == NULL ? NULL : strdup(src->logger); + if (dst->logger) free(dst->logger);dst->logger = src->logger == NULL ? NULL : strdup(src->logger); if (src->logger != NULL && dst->logger == NULL) return CNF_NOMEMORY; dst->logger_nonblock = src->logger_nonblock; dst->io_collect_interval = src->io_collect_interval; dst->backlog = src->backlog; dst->readahead = src->readahead; - dst->snap_dir = src->snap_dir == NULL ? NULL : strdup(src->snap_dir); + if (dst->snap_dir) free(dst->snap_dir);dst->snap_dir = src->snap_dir == NULL ? NULL : strdup(src->snap_dir); if (src->snap_dir != NULL && dst->snap_dir == NULL) return CNF_NOMEMORY; - dst->wal_dir = src->wal_dir == NULL ? NULL : strdup(src->wal_dir); + if (dst->wal_dir) free(dst->wal_dir);dst->wal_dir = src->wal_dir == NULL ? NULL : strdup(src->wal_dir); if (src->wal_dir != NULL && dst->wal_dir == NULL) return CNF_NOMEMORY; dst->primary_port = src->primary_port; dst->secondary_port = src->secondary_port; dst->too_long_threshold = src->too_long_threshold; - dst->custom_proc_title = src->custom_proc_title == NULL ? NULL : strdup(src->custom_proc_title); + if (dst->custom_proc_title) free(dst->custom_proc_title);dst->custom_proc_title = src->custom_proc_title == NULL ? NULL : strdup(src->custom_proc_title); if (src->custom_proc_title != NULL && dst->custom_proc_title == NULL) return CNF_NOMEMORY; dst->memcached_port = src->memcached_port; @@ -1854,7 +1931,7 @@ dup_tarantool_cfg(tarantool_cfg* dst, tarantool_cfg* src) { dst->wal_dir_rescan_delay = src->wal_dir_rescan_delay; dst->panic_on_snap_error = src->panic_on_snap_error; dst->panic_on_wal_error = src->panic_on_wal_error; - dst->replication_source = src->replication_source == NULL ? NULL : strdup(src->replication_source); + if (dst->replication_source) free(dst->replication_source);dst->replication_source = src->replication_source == NULL ? NULL : strdup(src->replication_source); if (src->replication_source != NULL && dst->replication_source == NULL) return CNF_NOMEMORY; @@ -1878,7 +1955,7 @@ dup_tarantool_cfg(tarantool_cfg* dst, tarantool_cfg* src) { while (src->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index] != NULL) { ARRAYALLOC(dst->namespace[i->idx_name__namespace]->index, i->idx_name__namespace__index + 1, _name__namespace__index, 0, 0); - dst->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->type = src->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->type == NULL ? NULL : strdup(src->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->type); + if (dst->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->type) free(dst->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->type);dst->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->type = src->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->type == NULL ? NULL : strdup(src->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->type); if (src->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->type != NULL && dst->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->type == NULL) return CNF_NOMEMORY; dst->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->unique = src->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->unique; @@ -1892,7 +1969,7 @@ dup_tarantool_cfg(tarantool_cfg* dst, tarantool_cfg* src) { ARRAYALLOC(dst->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->key_field, i->idx_name__namespace__index__key_field + 1, _name__namespace__index__key_field, 0, 0); dst->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->key_field[i->idx_name__namespace__index__key_field]->fieldno = src->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->key_field[i->idx_name__namespace__index__key_field]->fieldno; - dst->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->key_field[i->idx_name__namespace__index__key_field]->type = src->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->key_field[i->idx_name__namespace__index__key_field]->type == NULL ? NULL : strdup(src->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->key_field[i->idx_name__namespace__index__key_field]->type); + if (dst->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->key_field[i->idx_name__namespace__index__key_field]->type) free(dst->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->key_field[i->idx_name__namespace__index__key_field]->type);dst->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->key_field[i->idx_name__namespace__index__key_field]->type = src->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->key_field[i->idx_name__namespace__index__key_field]->type == NULL ? NULL : strdup(src->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->key_field[i->idx_name__namespace__index__key_field]->type); if (src->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->key_field[i->idx_name__namespace__index__key_field]->type != NULL && dst->namespace[i->idx_name__namespace]->index[i->idx_name__namespace__index]->key_field[i->idx_name__namespace__index__key_field]->type == NULL) return CNF_NOMEMORY; diff --git a/cfg/tarantool_box_cfg.h b/cfg/tarantool_box_cfg.h index e0e8c2856de184f62bd7a9fe25828472a02a488c..f8afefaf2b17a115a624fd4d948a48ca41d94c82 100644 --- a/cfg/tarantool_box_cfg.h +++ b/cfg/tarantool_box_cfg.h @@ -50,7 +50,7 @@ typedef struct tarantool_cfg { * save core on abort/assert * deprecated; use ulimit instead */ - int32_t coredump; + bool coredump; /* * admin port @@ -88,7 +88,7 @@ typedef struct tarantool_cfg { char* logger; /* make logging nonblocking, this potentially can lose some logging data */ - int32_t logger_nonblock; + bool logger_nonblock; /* delay between loop iterations */ double io_collect_interval; @@ -130,7 +130,7 @@ typedef struct tarantool_cfg { int32_t memcached_namespace; /* Memcached expiration is on if memcached_expire is set. */ - int32_t memcached_expire; + bool memcached_expire; /* maximum rows to consider per expire loop iteration */ int32_t memcached_expire_per_loop; @@ -160,7 +160,7 @@ typedef struct tarantool_cfg { * until it is able to bind to the primary port. * In local hot standby mode the server only accepts reads. */ - int32_t local_hot_standby; + bool local_hot_standby; /* * Delay, in seconds, between successive re-readings of wal_dir. @@ -173,8 +173,8 @@ typedef struct tarantool_cfg { * By default, panic on any snapshot reading error and ignore errors * when reading WALs. */ - int32_t panic_on_snap_error; - int32_t panic_on_wal_error; + bool panic_on_snap_error; + bool panic_on_wal_error; /* * Replication mode (if enabled, the server, once diff --git a/doc/user/configuration-reference.xml b/doc/user/configuration-reference.xml index 4fd47605ea6ee363ee0218545adb201a15342817..d74d2ab3a0b4ce88e7f66be08f9ea6854f20c63e 100644 --- a/doc/user/configuration-reference.xml +++ b/doc/user/configuration-reference.xml @@ -483,7 +483,7 @@ tarantool_box: primary@sessions pri:33013 sec:33014 adm:33015</programlisting> <row> <entry>panic_on_snap_error</entry> <entry>boolean</entry> - <entry>1</entry> + <entry>true</entry> <entry>no</entry> <entry>no</entry> <entry>If there is an error reading the snapshot (at @@ -493,7 +493,7 @@ tarantool_box: primary@sessions pri:33013 sec:33014 adm:33015</programlisting> <row> <entry>panic_on_wal_error</entry> <entry>boolean</entry> - <entry>0</entry> + <entry>false</entry> <entry>no</entry> <entry>no</entry> <entry>If there is an error reading from a write ahead @@ -778,8 +778,8 @@ tarantool_box: primary@sessions pri:33013 sec:33014 adm:33015</programlisting> <row> <entry>memcached_port</entry> - <entry>integer</entry> - <entry>0</entry> + <entry>boolean</entry> + <entry>false</entry> <entry>no</entry> <entry>no</entry> <entry> @@ -820,7 +820,7 @@ tarantool_box: primary@sessions pri:33013 sec:33014 adm:33015</programlisting> <row> <entry>memcached_expire</entry> <entry>boolean</entry> - <entry>0</entry> + <entry>false</entry> <entry>no</entry> <entry>no</entry> <entry> diff --git a/mod/box/box_cfg.cfg_tmpl b/mod/box/box_cfg.cfg_tmpl index b2592128c8d4d5afd98473931b5742462bbed29a..6c30401bc4b2240605c0134f547ea48b5f8c9a12 100644 --- a/mod/box/box_cfg.cfg_tmpl +++ b/mod/box/box_cfg.cfg_tmpl @@ -25,7 +25,7 @@ memcached_port=0, ro # namespace used for memcached emulation memcached_namespace=23, ro # Memcached expiration is on if memcached_expire is set. -memcached_expire=0, ro +memcached_expire=false, ro # maximum rows to consider per expire loop iteration memcached_expire_per_loop=1024 # tarantool will try to iterate over all rows within this time @@ -49,7 +49,7 @@ wal_writer_inbox_size=128, ro # standby mode, continuously fetching WAL records from wal_dir, # until it is able to bind to the primary port. # In local hot standby mode the server only accepts reads. -local_hot_standby=0, ro +local_hot_standby=false, ro # Delay, in seconds, between successive re-readings of wal_dir. # The re-scan is necessary to discover new WAL files or snapshots. wal_dir_rescan_delay=0.1, ro @@ -58,8 +58,8 @@ wal_dir_rescan_delay=0.1, ro # Panic if there is an error reading a snapshot or WAL. # By default, panic on any snapshot reading error and ignore errors # when reading WALs. -panic_on_snap_error=1, ro -panic_on_wal_error=0, ro +panic_on_snap_error=true, ro +panic_on_wal_error=false, ro # Replication mode (if enabled, the server, once # bound to the primary port, will connect to diff --git a/test/box/show.result b/test/box/show.result index 8ada7a0ec027c87fc6249d5507b884105ec360e0..aaab02d3317cc6d401478953c45913e938b6673b 100644 --- a/test/box/show.result +++ b/test/box/show.result @@ -29,7 +29,7 @@ show configuration configuration: username: (null) bind_ipaddr: "INADDR_ANY" - coredump: "0" + coredump: "false" admin_port: "33015" replication_port: "0" log_level: "4" @@ -39,7 +39,7 @@ configuration: work_dir: (null) pid_file: "box.pid" logger: "cat - >> tarantool.log" - logger_nonblock: "1" + logger_nonblock: "true" io_collect_interval: "0" backlog: "1024" readahead: "16320" @@ -51,17 +51,17 @@ configuration: custom_proc_title: (null) memcached_port: "0" memcached_namespace: "23" - memcached_expire: "0" + memcached_expire: "false" memcached_expire_per_loop: "1024" memcached_expire_full_sweep: "3600" snap_io_rate_limit: "0" rows_per_wal: "50" wal_fsync_delay: "0" wal_writer_inbox_size: "128" - local_hot_standby: "0" + local_hot_standby: "false" wal_dir_rescan_delay: "0.1" - panic_on_snap_error: "1" - panic_on_wal_error: "0" + panic_on_snap_error: "true" + panic_on_wal_error: "false" replication_source: (null) namespace[0].enabled: "1" namespace[0].cardinality: "-1" diff --git a/test/box_memcached/tarantool.cfg b/test/box_memcached/tarantool.cfg index 17c8e67b722141981f5e6be698673b796786e1b4..f6aba15b2717334e122a45a9a07c4e7f08e23503 100644 --- a/test/box_memcached/tarantool.cfg +++ b/test/box_memcached/tarantool.cfg @@ -18,5 +18,5 @@ namespace[0].index[0].key_field[0].fieldno = 0 namespace[0].index[0].key_field[0].type = "NUM" memcached_namespace = 2 -memcached_expire=1 +memcached_expire=true