<#558 Refactor distributed query> Pull request ope...
# osctrl
g
#558 Refactor distributed query Pull request opened by zhuoyuan-liu @javuto , This PR is not completed but shows the idea of how we move all the calculations from each node's distributed query request to the distributed query creation. In this idea, we would create a new table that records which node should execute which query. In this case, we only iteration all nodes when we create the distributed query. When osquery sends the distributed query result, we only check this table and we don't need to go through the whole list of distributed queries. I also preferred a small change: • Use a single
status
column instead of several ones. It would be simplicity and readability. Also, it would be efficient when querying the status, we don't have to write a query for each column. A classic example would be
"active = ? AND completed = ? AND deleted = ? AND expired = ? AND type = ? AND environment_id = ?",
In this case, we can get rid of several tables, we only need one table to track the status of all distributed queries. TODO after this merged: • Update the logic of completing a distributed query • Update the logic shown expected node and completed node • Remove several tables that are no longer needed jmpsec/osctrl