Skip to content

Log EventDataIds through the SND event and attribute data ETL steps - #985

Open
labkey-martyp wants to merge 4 commits into
release26.3-SNAPSHOTfrom
26.3_fb_snd_etl_id_logging
Open

Log EventDataIds through the SND event and attribute data ETL steps#985
labkey-martyp wants to merge 4 commits into
release26.3-SNAPSHOTfrom
26.3_fb_snd_etl_id_logging

Conversation

@labkey-martyp

@labkey-martyp labkey-martyp commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Rationale

Make it possible to tell from the ETL job log which event data rows ended up holding no attribute values. The _SND Event Data step clears attribute values as a side effect of its merge and only the _SND Attribute Data step restores them; because the two steps decide independently which rows to process, a mismatch leaves event data silently stripped. Newly inserted rows carry the same exposure, arriving with no attribute values and depending on that same second step to supply them. Until now nothing in the log identified the rows either step handled, so the problem could only be found by querying the database after the fact.

Related Pull Requests

None.

Changes

  • Both ETL steps log the EventDataIds they handled, so the two logs can be diffed against each other.
  • The event data step logs on every path that touches exp.Object: merge, insert, and delete.
  • The merge also logs which rows are about to have their attribute values cleared.
  • The attribute data step logs the rows it received, the rows it wrote, and the difference between them.
  • The attribute data step reports when its source rows arrive ungrouped, which is one way the values fail to be restored.
  • Failures that abort the attribute data step now name the row that failed and note that the batch was left with its attribute values cleared.
  • Id lists are sorted and chunked for diffing, and omitted above 2000 ids so the full batches of an initial load don't flood the log.
  • Everything logs at debug, which the ETL job logger runs at by default; the diagnostics that cost queries or memory are skipped when debug is off.
  • No change to what the merge writes.

The _SND Event Data step clears attribute values and only the _SND Attribute Data step restores them, and each step picks its rows independently, so a mismatch silently leaves event data with no attributes. Logging the ids on both sides makes the gap visible in the job log.
The exp.Object lookup added for this branch's id logging ran unguarded inside mergeRows, so a failure reading it would abort a merge that previously did no reads there at all. It now runs inside logAttributeDataToBeCleared, which logs a warning and lets the merge continue.

The lookup is also skipped once the batch exceeds MAX_LOGGED_IDS, the same threshold above which logIds suppresses the id list, capping the chunked queries at ten round trips instead of the hundreds a full merge batch would spend to produce a bare count. MAX_LOGGED_IDS is public now so both sites share one constant.
These two lines carried the property name but nothing identifying the row, so a single attribute dropped from an otherwise healthy EventDataId could not be joined back to the id sets the rest of this branch logs. Per-attribute loss was invisible to every one of them, since they all reconcile at EventDataId granularity and an id with any resolving value counts as written.
The event data step logged ids only from mergeRows, and only the subset that already carried attribute values, so there was nothing to diff against the id sets the attribute data step logs. importRows and deleteRows now log theirs as well: a newly inserted row the _SND Attribute Data step misses ends up just as stripped as a cleared one, and a deleted row otherwise reads as an attribute data miss.

Everything this branch adds now logs at debug, which the ETL job logger runs at by default. The pre-existing Begin/End updating exp.ObjectProperty lines are back at info, and the two diagnostics that cost real work - the exp.Object lookup for values about to be cleared, and the source ordering check - are skipped entirely when debug is off.

MAX_LOGGED_IDS drops to 2000, below the 5000 row ETL batch size, so the full batches of an initial load suppress the id lists while the smaller batches of an incremental run keep them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant