add skip_scripts.lua

v4
suxb201 2 years ago committed by suxb201
parent 0fd2c5d72f
commit 8a444ac483
  1. 3
      filters/print.lua
  2. 8
      filters/skip_scripts.lua
  3. 2
      filters/swap_db.lua
  4. 3374
      internal/commands/table.go
  5. 40
      scripts/gen_table_json_from_commands.py
  6. 2311
      scripts/table.json

@ -18,9 +18,6 @@
--- @db_id number: redirection database id
function filter(id, is_base, group, cmd_name, keys, slots, db_id, timestamp_ms)
local keys_size = #keys
local slots_size = #slots -- slots_size should be equal to keys_size
print(string.format("lua filter. id=[%d], is_base=[%s], db_id=[%d], group=[%s], cmd_name=[%s], keys=[%s], slots=[%s], timestamp_ms=[%d]",
id, tostring(is_base), db_id, group, cmd_name, table.concat(keys, ", "), table.concat(slots, ", "), timestamp_ms))
return 0, db_id

@ -0,0 +1,8 @@
-- skip all scripts included LUA scripts and Redis Functions.
function filter(id, is_base, group, cmd_name, keys, slots, db_id, timestamp_ms)
if group == "SCRIPTING" then
return 1, db_id -- disallow
else
return 0, db_id -- allow
end
end

@ -3,10 +3,8 @@
--- dbid: others -> drop
function filter(id, is_base, group, cmd_name, keys, slots, db_id, timestamp_ms)
if db_id == 0 then
-- print("db_id is 0, redirect to 1")
return 0, 1
elseif db_id == 1 then
-- print("db_id is 1, redirect to 0")
return 0, 0
else
return 1, db_id

File diff suppressed because it is too large Load Diff

@ -11,32 +11,26 @@ for file in files:
j = j[cmd_name]
print(cmd_name)
if cmd_name == "SORT" or cmd_name == "MIGRATE":
continue
if "command_flags" not in j:
print(f"{file} No command_flags.")
if cmd_name in ("SORT", "SORT_RO", "MIGRATE"):
continue
flags = j["command_flags"]
group = j["group"]
if (("WRITE" in flags or "MAY_REPLICATE" in flags) and "BLOCKING" not in flags) or cmd_name in ("PING", "SELECT"):
key_specs = []
if "key_specs" in j:
for key_spec in j["key_specs"]:
begin_search = key_spec["begin_search"]
find_keys = key_spec["find_keys"]
key_specs.append({
"begin_search": begin_search,
"find_keys": find_keys
})
if "container" in j:
cmd_name = j["container"] + "-" + cmd_name
container.add(j["container"])
print(f"group: {group}")
print(f"flags: {flags}")
if group not in table:
table[group] = {}
table[group][cmd_name] = key_specs
key_specs = []
if "key_specs" in j:
for key_spec in j["key_specs"]:
begin_search = key_spec["begin_search"]
find_keys = key_spec["find_keys"]
key_specs.append({
"begin_search": begin_search,
"find_keys": find_keys
})
if "container" in j:
cmd_name = j["container"] + "-" + cmd_name
container.add(j["container"])
if group not in table:
table[group] = {}
table[group][cmd_name] = key_specs
with open("table.json", "w") as f:
json.dump({

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save