Skip to content

Commit 6f43816

Browse files
committed
remove sp assignment type check
Signed-off-by: Emelia Lei <wlei29@bloomberg.net>
1 parent e3f88b2 commit 6f43816

File tree

8 files changed

+0
-73
lines changed

8 files changed

+0
-73
lines changed

db/comdb2.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ int gbl_return_long_column_names = 1;
228228
int gbl_maxreclen;
229229
int gbl_penaltyincpercent = 20;
230230
int gbl_maxwthreadpenalty;
231-
int gbl_spstrictassignments = 0;
232231
int gbl_lock_conflict_trace = 0;
233232
int gbl_move_deadlk_max_attempt = 500;
234233

db/db_tunables.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ extern int gbl_debug_sleep_on_set_read_only;
100100
extern int gbl_debug_wait_on_verify_off;
101101
extern int gbl_debug_disttxn_trace;
102102
extern int gbl_sparse_lockerid_map;
103-
extern int gbl_spstrictassignments;
104103
extern int gbl_early;
105104
extern int gbl_exit_alarm_sec;
106105
extern int gbl_fdb_default_ver;

db/db_tunables.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,6 @@ REGISTER_TUNABLE("enable_sparse_lockerid_map",
501501
"If set, allocates a sparse map of lockers for deadlock "
502502
"resolution. (Default: on)",
503503
TUNABLE_BOOLEAN, &gbl_sparse_lockerid_map, READONLY | NOARG, NULL, NULL, NULL, NULL);
504-
REGISTER_TUNABLE("enable_sp_strict_assignments", NULL, TUNABLE_INTEGER,
505-
&gbl_spstrictassignments, READONLY | NOARG, NULL, NULL, NULL,
506-
NULL);
507504
REGISTER_TUNABLE(
508505
"enable_sq_flattening_optimization",
509506
"Enable subquery flattening optimization for OUTER JOINS (Default: off)",

lua/ltypes.c

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -891,12 +891,9 @@ void init_cmp(Lua lua)
891891
lua_setfield(lua, -2, "__le");
892892
}
893893

894-
static int l_typed_assignment(Lua);
895894
static int l_concat(Lua);
896895
void init_common(Lua lua)
897896
{
898-
lua_pushcfunction(lua, l_typed_assignment);
899-
lua_setfield(lua, -2, "__type");
900897
lua_pushcfunction(lua, l_column_cast);
901898
lua_setfield(lua, -2, "__cast");
902899
lua_pushcfunction(lua, l_concat);
@@ -2080,7 +2077,6 @@ static void init_blob(Lua L)
20802077
setup_method(L, "__lt", l_blob_lt);
20812078
setup_method(L, "__le", l_blob_le);
20822079
setup_method(L, "__cast", l_column_cast);
2083-
setup_method(L, "__type", l_typed_assignment);
20842080
setup_method(L, "__gc", l_blob_free);
20852081
setup_method(L, "__len", l_blob_length);
20862082

@@ -2179,16 +2175,6 @@ int luabb_isnull(lua_State *lua, int arg_index)
21792175
return 0;
21802176
}
21812177

2182-
int luabb_istyped(lua_State *lua, int arg_index)
2183-
{
2184-
int type = lua_type(lua, arg_index);
2185-
if (type == LUA_TUSERDATA) {
2186-
const lua_dbtypes_t *n = lua_topointer(lua, arg_index);
2187-
return n->is_typed;
2188-
}
2189-
return 0;
2190-
}
2191-
21922178
void luabb_pushnull(Lua lua, int dbtype)
21932179
{
21942180
switch (dbtype) {
@@ -2256,39 +2242,6 @@ char *luabb_newblob(Lua lua, int len, void **blob)
22562242
return (char *)b->val.data;
22572243
}
22582244

2259-
static int l_typed_assignment(lua_State *lua)
2260-
{
2261-
const char *name1 = NULL;
2262-
const char *name2 = NULL;
2263-
if ((lua_type(lua, 1) == LUA_TUSERDATA)) {
2264-
if (luabb_istyped(lua,1)) {
2265-
lua_getmetatable(lua, 1);
2266-
lua_pushstring(lua, "__metatable");
2267-
lua_gettable(lua, -2);
2268-
name1 = lua_tostring(lua, -1);
2269-
lua_getmetatable(lua, 2);
2270-
lua_pushstring(lua, "__metatable");
2271-
lua_gettable(lua, -2);
2272-
name2 = lua_tostring(lua, -1);
2273-
if (name1 && name2 && strcmp(name1, name2) == 0) {
2274-
lua_pop(lua,4);
2275-
lua_remove(lua,1);
2276-
} else {
2277-
/* Remove everything and push nil. */
2278-
lua_settop(lua, 0);
2279-
if (name1) {
2280-
luabb_error(lua, NULL, "Invalid assignment, invalid typed assignment for type %s", name1);
2281-
} else {
2282-
luabb_error(lua, NULL, "Invalid assignment, invalid typed assignment");
2283-
}
2284-
}
2285-
}
2286-
} else {
2287-
lua_remove(lua,1);
2288-
}
2289-
return 1;
2290-
}
2291-
22922245
int l_column_cast(Lua L)
22932246
{
22942247
if (lua_isnil(L, -2)) {

lua/ltypes.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
#include <lua.h>
2222
#include <comdb2.h>
2323

24-
extern int gbl_spstrictassignments;
25-
2624
// one switch to rule them all
2725
#define DBTYPES \
2826
XMACRO_DBTYPES(DBTYPES_LNIL, "nil", t0, NULL)\
@@ -94,7 +92,6 @@ extern const char *dbtypes_str[];
9492
#define DBTYPES_COMMON \
9593
int magic; \
9694
dbtypes_enum dbtype; \
97-
int is_typed; \
9895
int is_null
9996

10097
typedef struct {
@@ -150,7 +147,6 @@ typedef struct {
150147
#define init_new_t(n, DBTYPE) \
151148
(n)->magic = DBTYPES_MAGIC;\
152149
(n)->is_null = 0;\
153-
(n)->is_typed = gbl_spstrictassignments;\
154150
(n)->dbtype = DBTYPE
155151

156152
#define new_lua_t_sz(L, n, DBTYPE, sz) \

lua/sp.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4579,20 +4579,6 @@ static int db_setnull(Lua lua)
45794579
return 0;
45804580
}
45814581

4582-
static int db_settyped(Lua lua)
4583-
{
4584-
if (lua_type(lua, -1) != LUA_TUSERDATA) {
4585-
return luaL_error(lua, "bad argument to 'settyped'");
4586-
}
4587-
4588-
lua_dbtypes_t *t = (lua_dbtypes_t *)lua_topointer(lua, -1);
4589-
assert(t->magic == DBTYPES_MAGIC);
4590-
assert(t->dbtype > DBTYPES_MINTYPE);
4591-
assert(t->dbtype < DBTYPES_MAXTYPE);
4592-
t->is_typed = 1;
4593-
return 0;
4594-
}
4595-
45964582
static int db_setmaxinstructions(Lua L)
45974583
{
45984584
luaL_checkudata(L, 1, dbtypes.db);
@@ -5044,7 +5030,6 @@ static const luaL_Reg db_funcs[] = {
50445030
{"setmaxinstructions", db_setmaxinstructions},
50455031
{"setnull", db_setnull},
50465032
{"settimezone", db_settimezone},
5047-
{"settyped", db_settyped},
50485033
{"sp", db_sp},
50495034
{"sqlerror", db_error}, // every error isn't from SQL -- deprecate
50505035
{"table", db_table},

lua/sp_int.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ void luabb_pushnull(Lua, int dbtype);
117117
void luabb_pushreal(Lua, double);
118118

119119
int luabb_isnull(Lua, int index);
120-
int luabb_istyped(Lua, int index);
121120

122121
/* must be called before any exposed functionality is available in lua */
123122
void init_dbtypes(Lua);

tests/tunables.test/t00_all_tunables.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,6 @@
344344
(name='enable_seqnum_generations', description='', type='BOOLEAN', value='OFF', read_only='N')
345345
(name='enable_serial_isolation', description='Enable to allow SERIALIZABLE level transactions to run against the database. (Default: off)', type='BOOLEAN', value='OFF', read_only='Y')
346346
(name='enable_snapshot_isolation', description='Enable to allow SNAPSHOT level transactions to run against the database. (Default: off)', type='BOOLEAN', value='OFF', read_only='Y')
347-
(name='enable_sp_strict_assignments', description='', type='INTEGER', value='0', read_only='Y')
348347
(name='enable_sparse_lockerid_map', description='If set, allocates a sparse map of lockers for deadlock resolution. (Default: on)', type='BOOLEAN', value='ON', read_only='Y')
349348
(name='enable_sql_stmt_caching', description='Enable caching of query plans. If followed by "all" will cache all queries, including those without parameters. (Default: on)', type='ENUM', value='ALL', read_only='Y')
350349
(name='enable_tagged_api', description='Enables tagged api requests. (Default: on)', type='BOOLEAN', value='OFF', read_only='N')

0 commit comments

Comments
 (0)