Project

General

Profile

Actions

Architecture #17921

open

improve searching in ruddersysevents for the reports in store run agents

Added by Nicolas CHARLES almost 4 years ago. Updated about 1 month ago.

Status:
New
Priority:
N/A
Assignee:
-
Category:
Performance and scalability
Target version:
Effort required:
Name check:
To do
Fix check:
To do
Regression:

Description

for the moment, we are doing a

select max(id) as id from RudderSysEvents where id > ${fromId} and executionTimeStamp < before

which is widly inefficient (see https://issues.rudder.io/issues/11147 )

then we do

select distinct
  T.nodeid, T.executiontimestamp, coalesce(C.keyvalue, '') as nodeconfigid, coalesce(C.iscomplete, false) as complete, T.insertionid
from
  (select nodeid, executiontimestamp, min(id) as insertionid from ruddersysevents where id > ? and id <= ? group by nodeid, executiontimestamp) as T
left join
  (select
    true as iscomplete, nodeid, executiontimestamp, keyvalue
  from
    ruddersysevents where id > ? and id <= ? and
    eventtype = 'control' and
    component = 'end'
  ) as C
on T.nodeid = C.nodeid and T.executiontimestamp = C.executiontimestamp

agent run being out of order, we cannot simply take execution timestamp from last id as min execution time - risk is that the node is in the future, and prevent any compliance from a long time
we could have some heuristics:

  • take the lowest time from the previous batch considered as the min time where to look from (so we need to store that), minus x minutes
  • if the lowest is in the future from current time, take current time -x minutes?
  • and even always ensure that there is a minimum from now to the min

of we could have the rudder-relay storing this information in reportsexecution, and skip the first part altogether, and then updating a table with the information of which runs have been updated, and from there have the webapp catchup on these and compute the compliance


Related issues 3 (3 open0 closed)

Related to Rudder - Architecture #17180: Compliance incorrectly computed with old reports or runs not sent in node chronological orderNewFrançois ARMANDActions
Related to Rudder - Architecture #16830: nodecompliance and nodecompliancelevels don't contain "no answer" reportsNewActions
Related to Rudder - Architecture #15000: While Rudder is fetching changes from the database, it cannot display the compliance for node list NewActions
Actions #1

Updated by Nicolas CHARLES almost 4 years ago

  • Tracker changed from Bug to Architecture
  • Priority deleted (0)

Note: rudder-relayd could also store the last run for each node, in a new tale, rather than using the infarious

select r.nodeid, r.date, r.nodeconfigid, r.complete, r.insertionid,
                         c.nodeid, c.nodeconfigid, c.begindate, c.enddate, c.configuration
from (
                 select reportsexecution.nodeid, reportsexecution.date, reportsexecution.nodeconfigid, reportsexecution.complete, reportsexecution.insertionid from
                    reportsexecution where (nodeid, insertionid) in (
                      select nodeid, max(insertionid) as insertionid
                        from reportsexecution
                        where complete = true
                        and nodeid in """ ++
              Fragment.const(s"""(values ${nodes.mkString(",")} )""") ++
              fr""" 
                        GROUP BY nodeid
                     )
                  ) as r
left outer join nodeconfigurations as c
                         on r.nodeId = c.nodeid and r.nodeconfigid = c.nodeconfigid
                     

Actions #2

Updated by François ARMAND almost 4 years ago

  • Related to Architecture #17180: Compliance incorrectly computed with old reports or runs not sent in node chronological order added
Actions #3

Updated by Nicolas CHARLES almost 4 years ago

  • Related to Architecture #16830: nodecompliance and nodecompliancelevels don't contain "no answer" reports added
Actions #4

Updated by Nicolas CHARLES almost 4 years ago

  • Related to Architecture #15000: While Rudder is fetching changes from the database, it cannot display the compliance for node list added
Actions #5

Updated by Vincent MEMBRÉ over 3 years ago

  • Target version changed from 6.2.0~beta1 to 6.2.0~rc1
Actions #6

Updated by François ARMAND over 3 years ago

  • Target version changed from 6.2.0~rc1 to 7.0.0~beta1
Actions #7

Updated by Vincent MEMBRÉ over 2 years ago

  • Target version changed from 7.0.0~beta1 to 7.0.0~beta2
Actions #8

Updated by Vincent MEMBRÉ over 2 years ago

  • Target version changed from 7.0.0~beta2 to 7.0.0~beta3
Actions #9

Updated by Alexis Mousset over 2 years ago

  • Target version changed from 7.0.0~beta3 to 7.1.0~beta1
Actions #10

Updated by Vincent MEMBRÉ about 2 years ago

  • Target version changed from 7.1.0~beta1 to 7.1.0~beta2
Actions #11

Updated by Vincent MEMBRÉ about 2 years ago

  • Target version changed from 7.1.0~beta2 to 7.1.0~rc1
Actions #12

Updated by Alexis Mousset about 2 years ago

  • Target version changed from 7.1.0~rc1 to 7.2.0~beta1
Actions #13

Updated by Alexis Mousset almost 2 years ago

  • Target version changed from 7.2.0~beta1 to 7.3.0~beta1
Actions #14

Updated by Vincent MEMBRÉ about 1 year ago

  • Target version changed from 7.3.0~beta1 to 7.3.0~rc1
Actions #15

Updated by Vincent MEMBRÉ about 1 year ago

  • Target version changed from 7.3.0~rc1 to 7.3.0
Actions #16

Updated by Vincent MEMBRÉ about 1 year ago

  • Target version changed from 7.3.0 to 7.3.1
Actions #17

Updated by Vincent MEMBRÉ 12 months ago

  • Target version changed from 7.3.1 to 7.3.2
Actions #18

Updated by Vincent MEMBRÉ 11 months ago

  • Target version changed from 7.3.2 to 7.3.3
Actions #19

Updated by Vincent MEMBRÉ 10 months ago

  • Target version changed from 7.3.3 to 7.3.4
Actions #20

Updated by Vincent MEMBRÉ 9 months ago

  • Target version changed from 7.3.4 to 7.3.5
Actions #21

Updated by Alexis Mousset 8 months ago

  • Target version changed from 7.3.5 to 7.3.6
Actions #22

Updated by Vincent MEMBRÉ 7 months ago

  • Target version changed from 7.3.6 to 7.3.7
Actions #23

Updated by Vincent MEMBRÉ 7 months ago

  • Target version changed from 7.3.7 to 7.3.8
Actions #24

Updated by Vincent MEMBRÉ 6 months ago

  • Target version changed from 7.3.8 to 7.3.9
Actions #25

Updated by Vincent MEMBRÉ 5 months ago

  • Target version changed from 7.3.9 to 7.3.10
Actions #26

Updated by Vincent MEMBRÉ 4 months ago

  • Target version changed from 7.3.10 to 7.3.11
Actions #27

Updated by Vincent MEMBRÉ 3 months ago

  • Target version changed from 7.3.11 to 7.3.12
Actions #28

Updated by Vincent MEMBRÉ about 2 months ago

  • Target version changed from 7.3.12 to 7.3.13
Actions #29

Updated by Vincent MEMBRÉ about 1 month ago

  • Target version changed from 7.3.13 to 7.3.14
Actions

Also available in: Atom PDF