Database

The service owns the ftfcc schema and reads the schema of the Auto Configuration Server (ACS).

The ftfcc schema

The schema ftfcc belongs to this service. The service reads and writes it, and its own Liquibase migrates it. Nothing else migrates it.

The schema holds thirteen tables:

Schema-wide rules

Six rules hold in every changelog.

Rule Reason

No foreign keys at all

The application enforces the integrity. That is the house convention. A schema without foreign keys also makes a bulk load and a later re-partitioning simpler.

An enumeration column is VARCHAR(32) with the constant name, never a number

A number breaks in silence when somebody inserts a value in the middle of the enumeration, because the existing rows then mean something else. A number is also unreadable in a query written by hand during an incident.

A byte counter is a 64-bit number

The legacy schema used a 32-bit column, and that overflows. A gigabit line moves about 3.75 GB in a 30-second upload test.

Four audit columns on every table

The framework fills them. The author is the user header during a request, or the literal system for a write by a poller or a watchdog. This is what makes who did this answerable in a regulatory export.

Every type comes from a paired property

A changelog names only the type properties declared once in the properties file. A raw MySQL type would break Oracle in silence at install time.

Every index is named and serves one named query

The schema carries no index without a reader.

A migration that has run at an installation is never edited. A new column or index therefore arrives in a migration of its own. A live installation refuses a migration that moved under it.

fcc_test

The campaign, as the operator wrote it. A campaign is not a run. Every execution is a row in fcc_activation, and a campaign with a recurrence produces many of them.

Column Type Meaning

id

BIGINT PK

domain_id

INT NOT NULL

The domain of the campaign. Every read is filtered by it. See Identity contract.

name

VARCHAR(255) NOT NULL

legacy_result_kind

VARCHAR(32)

SPEED or LATENCY, and empty for every campaign this service created. It says which half of a legacy group an imported anchor is. See One group can become two anchors.

state

VARCHAR(32) NOT NULL

NOT_ACTIVE, SCHEDULED, RUNNING, PAUSED, STOPPED, ERROR, SCHEDULED_FOR_REACTIVATION, COMPLETED or ARCHIVED. See Campaign states. Only the legacy import writes ARCHIVED.

source

VARCHAR(32) NOT NULL

ACS_STREAM or LEGACY. A legacy campaign has no command history and can never be activated.

legacy_ug_id

INT

The id of the legacy group, for a legacy campaign only.

scheduled_at

DATETIME(3)

The booked start instant.

reactivation_days

INT NOT NULL

A count of runs, never a duration. A 0 means one single run. The name was wrong on the first day, and a rename would move a migration, the state machine, the planner and the import to change a string no caller sees. On the wire the field is the reactivation count.

reactivation_repeat_every

INT

Days between two runs. The default of 1 is the constant the planner used to hard-code, so a campaign stored before this column keeps its cadence. Both readers answer 1 for an empty value, because a planner cannot refuse and a form cannot render an empty cadence.

reactivation_starts_on

DATETIME(3)

The anchor the slots are counted from. Run number n opens at the anchor plus n periods. An empty value makes the planner measure from the last closed run. This is not a second schedule: the booking lives in its own column, so a recurrence rule cannot move it.

command_seq

BIGINT NOT NULL

The monotonic command counter of the campaign. The service raises it in the same transaction as the outbox row. The ACS rejects a command without a higher number, and that is what stops a replayed command from restarting a finished campaign.

activation_count

INT NOT NULL

The number of runs created so far. A value above 0 freezes the fleet. See [fleet-immutability].

version

BIGINT NOT NULL

The optimistic lock. A user edit and a poller activation of one campaign must not overwrite each other.

Two indexes serve this table. The pair of domain and state serves the campaign list. That read is always narrowed to the domain of the caller, and usually to a state. The pair of state and booked instant serves the poller, because it scans every domain on every tick and must not read the whole table.

fcc_test_config

One configuration of a campaign: which diagnostic to run, on which devices, with which timing. A campaign holds several of these, one per element of the configuration array. Each one has its own settings row, its own frozen fleet and its own run on the ACS.

The level matches Group Update one to one.

Group Update Here Content

update_group

fcc_test

The campaign: name, domain, state, schedule, recurrence

update_group_child

fcc_test_config

The configuration: what to measure, on which devices, with which settings

ug_task and ug_fcc

The two settings tables

The parameters of one configuration

the device selection of the child

fcc_test_device

The frozen fleet of one configuration

Mixed kinds in one campaign are allowed. A speed configuration may stand beside a latency one, exactly as one legacy group carries two task types. That is why the campaign has no type column. A campaign no longer has one type. Such a column would pick one configuration and call its type the type of the campaign.

The timing columns are shared by both kinds. A latency configuration has the same window, the same iteration length and the same sampling policy as a speed one. The caller states them once per campaign. The save writes the same values to every configuration row, and the read answers them from the first row.

Column Type Meaning

test_id

BIGINT NOT NULL

The campaign. A plain id column with no foreign key.

seq

INT NOT NULL

The position in the configuration array, counted from 1, and the identity of the configuration inside its campaign. The array you send is the array you get back. An element without an id means the configuration at this position. A save in another order would move a fleet of twenty thousand devices from one configuration to another with nothing in the answer to say so.

type

VARCHAR(32) NOT NULL

SPEED or LATENCY. It decides three things: the settings table of the parameters, the filled half of the run snapshot, and the targets of the command.

only_online

TINYINT(1)

Skip devices the ACS reports as offline.

push

TINYINT(1)

Use a connection request instead of the next device call.

total_duration_h, single_duration_min, batch_interval_min

INT

The window. A batch interval of 0 means one single batch.

retry_failed, retry_wan

INT

The two retry counts.

wan_sample_gap_sec, wan_retry_interval_sec, wan_step_timeout_sec, diag_timeout_sec

INT

The timing of the WAN sampling. The step timeout waits for the WAN answer, and the diagnostic timeout waits for the measurement.

manufacturer, model

VARCHAR(255)

What the operator chose, beside the fleet it resolved to. Nullable, because a campaign saved before these columns has no recorded choice, and a back-fill would write the facts of today into the snapshot of yesterday.

source_type

VARCHAR(32)

The constant name of the device source: All, Condition, Individual or File.

condition_id

INT

The id of a saved condition in the portal schema. Stored, never resolved again. The condition is evaluated once at save time, and the fleet it selected is in the fleet table. This column lets the read answer the name of the condition and lets an edit show where the frozen fleet came from. A deleted condition leaves the id pointing at nothing, and the read answers an empty name instead of an error.

The fleet table is the fleet. These four columns are the choice that produced it. The service never resolves them again, because the fleet is a frozen snapshot. A details screen renders the choice, and an export has to carry it.

One unique index on the campaign and the position serves the configuration read and enforces one configuration per position. A campaign therefore cannot hold two configurations claiming one slot.

fcc_test_setting_speed

The speed parameters of one configuration, one row per configuration of that type. Latency has its own table, and nothing is shared between the two.

The row belongs to the configuration and not to the campaign. That is what lets one campaign carry two speed configurations with different URLs or tiers.

Column Type Meaning

config_id

BIGINT NOT NULL

The configuration. A unique index enforces one row per configuration.

time_based_duration_sec

INT

The transfer duration in seconds, for a time-based test. The save refuses it on a file-based configuration instead of storing a value nothing applies.

time_based_interval_sec

INT

The step of the result table the device returns, in seconds. An empty value lets the device choose, and the ACS then omits the parameter. The value may not exceed the duration, because a step longer than the window yields a table without rows.

threshold_dl, threshold_ul

INT

The WAN cross-talk thresholds in Kbps. Above them the WAN counts as busy, and the iteration is recorded as cross talk instead of a speed. See Pass and fail rules.

tier_dl, tier_ul

INT

The provisioned tier of the subscriber in Kbps. The success percentage is measured against it.

url_dl, url_ul

VARCHAR(512)

Two columns, not one. The download URL and the upload URL are independent parameters of two different Technical Report 181 (TR-181) objects and routinely name different hosts. The ACS appends the device serial number to the upload URL.

connections_dl, connections_ul

INT

Two columns for the same reason. The two connection counts are separate parameters, and devices advertise different maximums per direction. One shared column would be clamped on half the fleet.

file_size_ul

BIGINT

The upload file length in bytes. The download direction has no counterpart, because the server decides the file size.

test_mode

VARCHAR(32)

FILE_BASED or TIME_BASED. This version accepts the first value only, and the validator refuses the second.

wan_sample_mode

VARCHAR(32)

TWO_SESSIONS or PREVIOUS_ITERATION. This version uses the first value only.

speed_tier_mode

VARCHAR(16)

Where the tier came from: Default or Manual. Provenance and not a rule, because the ACS gets the tier value either way and nothing checks a tier against the preset list. Nullable and never filled in later. See Where a speed tier comes from.

speed_success_percent

INT

The percentage of the tier that still counts as a pass. The default is 80.

hubb_id

VARCHAR(64)

A correlation id of the operator, carried through to the result rows.

fcc_test_setting_latency

The latency parameters of one configuration, the exact sibling of the speed table.

Two narrow tables and not one wide table. A latency configuration has no URL, no connection count and no upload size. A speed configuration has no ping host, no repetition count and no per-packet timeout. In one table every row would be half empty, and nothing in the schema would say which columns must be present.

Four columns map one to one onto the TR-181 object the ACS drives:

Device.IP.Diagnostics.IPPing.Host
Device.IP.Diagnostics.IPPing.NumberOfRepetitions
Device.IP.Diagnostics.IPPing.Timeout
Device.IP.Diagnostics.IPPing.DataBlockSize
Column Type Meaning

config_id

BIGINT NOT NULL

The configuration, with a unique index. There is no campaign pointer on the row on purpose. A settings row is only reached through its configuration, so a second pointer would be an unread column able to disagree with the one that is read.

threshold_dl

INT

The WAN cross-talk threshold in Kbps. Download only, because a ping has no direction of its own to sample.

tier_dl

INT

The provisioned downstream tier in Kbps, carried to the result rows so a report can state what the latency was measured against.

host

VARCHAR(255)

The ping target. One host, not a list. This is the one value with no default anywhere: the ACS cannot ping nothing and rejects a configuration without it, so the validator refuses such a campaign.

repetitions

INT

The configured number of echo requests. The two packet counters of a result add back up to it.

timeout_ms

INT

The timeout per packet in milliseconds.

data_block_size

INT

The payload of one echo request in bytes.

speed_tier_mode

VARCHAR(16)

The same provenance column as on the speed table.

latency_success_ms

INT

The average round trip that still counts as a pass. This is not a TR-181 parameter. It is the bound this service applies, because the ACS publishes raw measurements and never a verdict. The default is 100.

hubb_id

VARCHAR(64)

A correlation id of the operator.

The two columns keep the speed spelling on purpose. A latency run still samples the WAN and still reports against the provisioned tier, and the shared names keep the run snapshot a straight copy.

One type, one settings row. The save writes the row the type calls for and deletes the row of the other kind, in the same transaction.

The delete is not housekeeping. A configuration changed from speed to latency would otherwise keep its speed row. The service reads the settings row that matches the type. The leftover row still reaches a read, and a later type change would bring it back. The campaign would then carry two contradictory sets of parameters, and only one of them was ever measured.

fcc_test_device

The frozen device set of a configuration. This is a snapshot, not a live view.

The serial number, the model, the domain and the protocol are resolved once from the ACS when the campaign is saved, and never refreshed. The ACS schema is read-only and may live on another server, so a join at read time is not available. More importantly, a regulatory report has to show the fleet the campaign ran against.

How a selection becomes these rows is in The frozen fleet.

Column Type Meaning

test_id

BIGINT NOT NULL

The campaign the device was frozen for. It is kept beside the configuration id deliberately. See the index note below.

config_id

BIGINT NOT NULL

The configuration whose fleet this device is in, and the real owner of the row. One run on the ACS carries the devices of one configuration.

cpe_id

INT NOT NULL

The id the ACS addresses the device by.

serial

VARCHAR(64)

Required in practice, enforced by the validator and not by a column constraint. The serial number is mandatory on the wire, so a device without one is refused when you add it. The whole stored set is checked again at activation, because the set is a snapshot and can predate the rule. See A device without a serial number is refused.

model_id

INT

The product class of the device. This is what this product calls a model id, and it is the same value the capability table is keyed by.

domain_id

INT

Copied from the device row, not from the campaign. A device may sit in a sub-domain of the campaign domain.

protocol

VARCHAR(32)

The protocol name the device carried when the fleet was frozen. See Why the snapshot carries the protocol.

One unique index on the configuration and the device does two jobs. It rejects a duplicate device in one configuration at insert time. A fleet comes from groups that overlap, and up to twenty thousand rows go in one batch. It also serves the read that builds the device list of every command.

That index replaced one on the campaign and the device, and that is the visible consequence of overlapping fleets. The old index said a device appears once in a campaign, and that is no longer true. A device named by two configurations is measured by both, in two concurrent runs on the ACS. The ACS permits that, and it is the decision of the operator rather than of this schema. A campaign-level count therefore counts a shared device once per configuration. That is how many measurements the run performs.

A second, non-unique index on the campaign and the device exists for eight reads that ask about the campaign. Examples are the device count of an activation dialog, the campaigns holding a device of one model, and the serial numbers of a report scope. One statement inserts both columns from the configuration they belong to, so the pair cannot drift.

After the first run the set is immutable. A submitted fleet other than the stored one is refused with HTTP 409.

The comparison is per configuration, and the set of configurations is frozen with it. Each configuration is its own run measuring its own fleet. Move a device from the first configuration to the second. The device list of the campaign does not change, and a campaign-wide comparison would accept the edit. Both configurations would then measure something else. Adding or removing a configuration has the same effect. A run would dispatch a different number of commands than the finished runs did.

The comparison happens after the resolution, on the resulting set of device ids. A reworded selection with the same devices is therefore a legal edit. A report must describe the devices that were measured. The wording of a condition and the order of a list do not change those devices.

Use the export and the import to get a second campaign with another fleet. The export writes the campaign to a file. The import answers it as a new unsaved campaign, and you change the fleet before you save.

There is deliberately no table of campaign models. A model is a column of this table, so an immutable device set is already an immutable model set. A second table could only hold a copy of one DISTINCT query. Such a copy can disagree with its source, and that is worse than the join it saves.

Why the snapshot carries the protocol

The protocol is not a display field. The fleet is frozen so that a report describes the devices the campaign ran against, and the protocol is part of that description.

This ACS version answers skipped for a device it cannot drive. Somebody asks how many of these devices could never produce a measurement. They ask it of a finished run, weeks later, when a device count does not match a measurement count. By then the live table may say something else, because the device was re-provisioned, upgraded or removed. Without this column the only answer needs a resolve against a live table. That is what a snapshot exists to avoid.

Three properties of the column carry weight:

  • It holds the constant name, never a number. The ACS persists its own protocol enumeration by number. That is a recorded issue there: a constant inserted in the middle re-maps every stored device. A name cannot do that.

  • It is plain text and not a closed vocabulary. The other enumeration columns hold the vocabulary of this service, and this one holds a foreign vocabulary. A value a later ACS release no longer uses must still be readable in a report years from now. A closed vocabulary would instead fail the whole fleet read of that campaign.

  • One method maps the raw value. The raw id leaves the ACS schema untouched, and only that method knows that an empty value means TR-069.

The column is nullable and never filled in later. A fleet frozen before the column has no protocol. A value from a live table would rewrite the frozen fleet with the facts of today.

Two indexes for the report filters

Index Query it serves

fcc_test_device(model_id, test_id)

The model chain of a report scope: the distinct campaigns of a model set, and the redundancy check that counts the devices of a campaign in that model set. The model leads, because both statements start from it. The campaign follows, so the second statement is answered from the index alone.

fcc_test_device(cpe_id)

The device filter of the same scope. A report names a device id, and the result tables know serial numbers only, so this lookup runs once per filtered request.

The unique index above serves neither predicate. A composite index can only be used from its leading column, and both reads start elsewhere.

fcc_activation

One row is one configuration of one run. A campaign with two configurations and seven reactivations produces fourteen rows: seven runs with two rows each.

A run is the pair of the campaign and the sequence number, not a row. The command carries one configuration and one device list, so a campaign of several configurations is several commands. Each command has its own idempotency key and its own command sequence number. That is what stops the ACS from taking the second command for a retry of the first, and from discarding all but one as stale.

The rows of one run share the sequence number, because a run is one slot of the recurrence rule. Two configurations must not consume two daily runs.

That shape also decides who moves the campaign. Only the last row of a run to reach a terminal state feeds the campaign state machine. Letting the first finished configuration move the campaign would take it out of the running state. The reactivation effect would then create the next run while the rest of this one was still measuring. The predicate is a query over the sibling rows and deliberately not a counter.

Column Type Meaning

test_id

BIGINT NOT NULL

The campaign.

config_id

BIGINT

The configuration this run measures. Nullable and never filled in later. A run dispatched before configurations were addressable had exactly one, and attaching it to the row that exists now would claim the run measured a configuration edited or replaced since. An empty value says a single-configuration run from before configurations were addressable, and that is the truth.

seq

INT NOT NULL

1 for the first run, one more for every reactivation. Shared by every row of one run. See [a-run-is-not-a-row].

idempotency_key

VARCHAR(64) UNIQUE NOT NULL

Generated once with the row and reused on every republication. The ACS answers a duplicate for a key it has processed. The unique index is the single defence against a double start: a second row with the same key fails in the database, and the acknowledgement check would arrive too late.

command_seq

BIGINT NOT NULL

The command counter of the campaign at the moment of creation. A republication keeps it, a rejected command still consumes it, and a corrected command gets a new one.

state

VARCHAR(32) NOT NULL

PLANNED, DISPATCHING, RUNNING, STOPPING, STOPPED, FINISHED or FAILED. See Run states.

stop_reason

VARCHAR(32)

USER_STOP, USER_PAUSE, WATCHDOG, ACS_UNAVAILABLE or ERROR.

failure_reason

VARCHAR(255)

Free text from the ACS or from a local failure. Deliberately not an enumeration, because it is diagnostic text and nothing branches on it.

source

VARCHAR(32)

ACS_STREAM or LEGACY, the campaign dictionary. See Two different source dictionaries.

window_start_at, window_end_at

DATETIME(3)

The window the ACS may run this row in. The service recomputes the end from the real start instant, and the watchdog compares against that value.

started_at

DATETIME(3)

Set when the ACS reports the start, not when the command is sent.

stopped_at, finished_at

DATETIME(3)

The two closing instants.

in_flight_count

INT

The devices the ACS still had in flight when it acknowledged a stop.

device_count

INT

The size of the device set this run was dispatched with.

The settings snapshot, 32 columns

mixed

See The settings snapshot of a run.

Five indexes serve this table.

Index Query it serves

fcc_activation(idempotency_key) UNIQUE

The acknowledgement lookup, and the defence against a double start.

fcc_activation(state, window_end_at)

The window watchdog.

fcc_activation(test_id, seq), not unique

The run history of a campaign, behind the detail screen and the export. A unique index here would turn a recoverable dispatch retry into an insert error.

fcc_activation(state, window_start_at)

The poller for planned runs, every 30 seconds, and the stalled-run claim. A campaign with a recurrence plans its next run as soon as the previous one finishes, so the planned set is never small.

fcc_activation(state, stopped_at)

The stop-grace watchdog. The stopping set is normally small, and the poll runs on every tick. Without the index each tick reads the whole state.

fcc_activation(started_at)

The period filter of the run list. The other indexes all lead with the state, and a report never constrains the state. The column is the start instant and not the creation instant, because the filter is about when the measurements were taken. See The period filter is two predicates.

A range predicate only works on the first non-equality column of an index. A predicate on the window start or the stop instant behind an equality on the state therefore needs its own index.

Both watchdog predicates also test for a present value, and that test is part of the statement. Both columns are nullable, because a campaign without a total duration has no computed end. A comparison with an empty value is unknown rather than false, so without the test the meaning of the statement would depend on the optimiser.

fcc_acs_outbox

The outbox toward the command queue. A queue offer cannot take part in a database transaction. The service therefore writes the command here, in the same transaction as the run row and the sequence number. A separate dispatcher performs the offer. Nothing is sent that is not committed, and nothing committed is lost in silence.

Column Type Meaning

activation_id

BIGINT NOT NULL

The run.

idempotency_key

VARCHAR(64) NOT NULL

Copied from the run row, because the acknowledgement carries the key and not the row id.

command_seq

BIGINT NOT NULL

The sequence number of this command.

type

VARCHAR(32) NOT NULL

ACTIVATE or STOP. Two more types exist in the enumeration, and this service never writes them.

payload

CLOB NOT NULL

The command as JSON, and never in the wire form of the queue. The row must survive a deployment that changes the message shape, and only JSON degrades gracefully when a field is added. The add only rule of the message contract therefore governs this column too.

state

VARCHAR(32)

PENDING, SENT, ACKED or ABANDONED. See the mapping below.

attempts

INT

The number of publication attempts.

sent_at

DATETIME(3)

The instant of the successful offer.

next_attempt_at

DATETIME(3) NOT NULL

Mandatory, so the dispatcher predicate never handles an empty value. A row due at once carries the current instant.

last_error

VARCHAR(512)

The last failure text.

The state of the row maps onto the state of the run:

  • A written row moves the run from planned to dispatching.

  • A successful offer sets the row to sent, and the run stays dispatching.

  • An applied acknowledgement sets the row to acknowledged, and the run moves to running or to failed.

  • An exhausted row becomes abandoned and fails the run in the same transaction.

An acknowledgement with an older sequence number changes neither state. See How an acknowledgement is matched.

The outbox carries stop rows from three paths. Those paths are an operator stop or pause, a delete of a campaign with a live run, and a run the ACS never acknowledged. A stop is always a new command with its own key and the next sequence number. The dispatcher re-sends a stored payload as it is, so a reused key would make the two commands indistinguishable to the ACS.

Five indexes serve this table.

Index Query it serves

fcc_acs_outbox(state, next_attempt_at)

The dispatcher, every 5 seconds.

fcc_acs_outbox(state, sent_at)

The acknowledgement-timeout claim, every 30 seconds. The first index cannot answer it.

fcc_acs_outbox(idempotency_key) UNIQUE

The lookup for every acknowledgement. Being unique, it also rules out the duplicate that would make that lookup throw.

fcc_acs_outbox(activation_id)

The correlation of an acknowledgement with its run.

fcc_acs_outbox(state, created)

The outbox sample of the metrics. See [outbox-metrics-index].

The last index was added later, and the sampler had been claiming an access path that did not exist. Its query grouped three states and took the oldest creation instant, and no index on this table carried that column. Both optimisers abandoned the index for a full scan once the row lookups were priced in.

The abandoned state was also one of the three counted states, and it should never have been on a 15-second tick. An abandoned row is terminal and nothing purges it, so the count only grows and is not bounded by work in flight.

The sampler now runs one statement per state. Two states are index-only reads with the oldest instant answered as the head of the range. The abandoned state is counted on a five-minute cadence.

fcc_device_state

Where one device of one run currently is, as last reported by the ACS.

This is current state, not history. There is one row per run and device, overwritten in place. The history of a run is its measurements in ClickHouse.

Column Type Meaning

activation_id

BIGINT NOT NULL

The run. The key is the run and not the campaign, so a device in three daily runs has three rows.

cpe_id

INT NOT NULL

The id the ACS addresses the device by.

serial

VARCHAR(64)

The serial number as last reported.

state

VARCHAR(32) NOT NULL

One of the nine wire states, stored and rendered as it came. The ACS owns that vocabulary end to end, and a local copy would only add a mapping able to drift. See The nine device states.

state_reason

VARCHAR(32)

Why the device is in that state. The opposite case of the state column: the ACS sends free text, so the service normalises it into a closed list and an unknown value lands as UNKNOWN instead of being stored as it came. See Device state reasons.

iteration, wan_retries, failed_retries, skip_count

INT NOT NULL

Counters that only grow, merged with a maximum. See [device-state-counters-not-null].

observed_at

DATETIME(3) NOT NULL

The instant the ACS observed the state, not the instant of the write. The two differ by the queue latency, and the upsert compares the observed instant and never the local clock.

Six of these columns are written and never read back, and they stay that way.

The only readers of this table are two aggregate queries, and both look at the state alone. The device status endpoint answers six counters, and the per-device grid that would show the other columns is not in the contract.

The columns are not dropped, because the data is the only record of why a device ended where it did, and nothing can reconstruct it. The ACS sends each state once, and a run that finished with 4000 skipped devices has nothing else to say which were busy. It had no WAN interface and which the operator stopped. Writing them costs one existing statement. A device grid can come back with no migration and no back-fill, and that is the whole point of keeping them.

The counters are mandatory with a default of 0, because a maximum over an empty value is empty.

The row is written by one atomic upsert, and the point of it is that the four counters only move forward. Both vendors return an empty result from their maximum function as soon as one argument is empty. A nullable counter would therefore erase the stored value the first time a message arrived without it.

Three halves of the same rule are all required:

  1. the mandatory column with a default in the schema

  2. primitive number fields in the row object, bound as numbers and never as objects

  3. a substitution of 0 for an absent wire value, where the ACS did not say still means nothing new to raise it by

The maximum exists because Hazelcast guarantees delivery and not order. A message reporting iteration 4 can arrive after one reporting iteration 5, and both are true statements about the past. The stored value is therefore the furthest the device is known to have got, and no arrival order can walk it backwards.

The serial number, the state and the reason are not monotonic. A device legitimately goes from sent to error and then to a WAN check, and there is no greater state. The only correct merge for them is newest wins, decided on the observed instant with a greater or equal comparison. Two messages can carry one observation instant, and the later arrival is then at least as informed. The observed instant itself takes the maximum, so a reordered older message raises the counters it can and leaves the state alone.

Index Reason

fcc_device_state(activation_id, cpe_id) UNIQUE

The index the atomic upsert is built on. Without a unique key on exactly these columns, the MySQL statement has nothing to match and the Oracle statement degrades into a scan per row. The only remaining option would be a read and then a write. That loses a concurrent update from a second instance on the same queue.

fcc_device_state(activation_id, state)

The status screen, its grouped counters and the drain recount. The unique index leads with the run too, and it cannot answer a state predicate without visiting every device of the run, up to twenty thousand of them.

fcc_audit

Who did what to a campaign. The trail only grows: nothing updates a row and nothing deletes one.

The four audit columns of every table answer when was this row last touched, and by whom. They do not answer who stopped this campaign on the 14th, because an update overwrites its predecessor. A compliance campaign disturbs subscriber lines and its results reach a regulatory filing, so the lifecycle actions need a trail of their own.

The product also has no role model, so this row is the only accountability there is. See No authentication of its own.

Column Type Meaning

entity_type

VARCHAR(32) NOT NULL

TEST, MODEL_CAPABILITY or DOMAIN_SETTING. Deliberately generic, so the two administration tables got their trail with no second table and no migration. It is a set of text constants and not an enumeration, for exactly that reason.

entity_id

BIGINT

The business key of the row, never a surrogate id: the campaign id, the model id or the domain id. Those are what an auditor still holds after a delete. Nullable, because an action refused before the row existed still belongs in the trail. It is not a foreign key, and the row it names may already be gone.

action

VARCHAR(32) NOT NULL

CREATE, UPDATE, ACTIVATE, STOP, PAUSE or DELETE. Lifecycle actions only, because those are the operator decisions an audit asks about. A booked activation is recorded as an activation with the instant in the details, because the recorded decision is this operator committed the fleet to a run.

user_id

INT

The user from the identity header. An empty value means the service acted by itself, not unknown user. The poller and the reactivation create runs nobody asked for at that moment, and an auditor must tell the first activation of an operator from the six the service performed.

domain_id

INT

The domain of the campaign at the time, so the trail stays readable after a campaign is moved or removed.

details

VARCHAR(1024)

A free-text summary, for example reason=USER_PAUSE activationId=1001 stopCommandSent=true. Deliberately not structured JSON: a human reads it during an audit, the service never queries it, and a large object would make the trail far more expensive to scan. The text is truncated instead of refused, because an over-long detail is cosmetic and an exception here would roll back the action it describes.

The three entity types share one action vocabulary. Create, update and delete mean the same thing on all three. Per-entity constants would make the trail impossible to read across them, and what changed on the 14th would become three queries instead of one.

Entity type Entity id Domain Written by

TEST

The campaign id

The domain of the campaign

Every lifecycle action

MODEL_CAPABILITY

The model id

Empty

Create, update and delete on the capability endpoints

DOMAIN_SETTING

The domain id

The same domain id

Create, update and delete on the domain setting endpoints

The empty domain on a capability row is a statement, not a gap. The change belongs to no domain, because that table is global for the installation. The domain of the actor would suggest a scoped change, and that is the misreading the scope requirement exists to prevent.

Both administration paths write in the same transaction as the change they describe, exactly as the campaign paths do.

One index on the entity type, the entity id and the creation instant serves the history tab of a campaign. The creation instant is the third column, so the index answers the sort of that read. The alternative is a file sort over a trail that only grows.

fcc_result_dead_letter

The last resort for a measurement the service could not store.

A measurement is the product of a compliance campaign. The ACS disturbed a subscriber line to produce it, and it may reach a regulatory filing, so it must never be lost in silence.

Column Type Meaning

activation_id, test_id, serial, direction, iteration

mixed

All five are copied out of the payload, so an operator answering what did we lose for this run can use an index and a simple condition instead of parsing JSON. The payload stays the source of truth on a resend.

reason

VARCHAR(32) NOT NULL

CLICKHOUSE_UNAVAILABLE or LATE. Two different failures with different handling. That is why this is a dictionary and not free text: the service retries one and never the other.

state

VARCHAR(32)

PENDING, RESENT or DISCARDED. Pending means waiting for a resend. Resent means handed back to the ingest path, not already in ClickHouse, because that write is asynchronous. Discarded is a row nothing will resend. Terminal rows are kept forever, because the trail of what could not be stored is part of what an audit asks for.

attempts

INT NOT NULL

Bounds nothing in this version. There is no resend poller and no ladder, so the column is 0 on every pending row and no query reads it. It is reserved, and the service deliberately does not read it back into its row object. This table is not an outbox: there is no key and no backoff column, because the destination de-duplicates on the natural key.

last_error

VARCHAR(512)

The failure text.

received_at

DATETIME(3) NOT NULL

When the result reached this service, not when it was parked. A row written after a long outage still records the arrival it describes, and this instant is what the after-stop comparison uses.

payload

CLOB NOT NULL

The result as JSON, and never in the wire form of the queue, for the same reason as the outbox payload. It is the message and not a mapped row, so a resend runs the same ingest path a live message runs and cannot drift from it.

Reason What happens next

CLICKHOUSE_UNAVAILABLE

The result is valid and the store is not reachable, or the retry buffer was exhausted, or the service was shutting down with rows still buffered. The row is pending and meant to be resent through the administration endpoint.

LATE

The result arrived more than the stop grace after the stop of its run. The row is written straight as discarded and never resent. See [late-is-parked-discarded].

A late row is parked as discarded, never as pending.

Pending means waiting for a resend, and a late row is never resent. Inserting a measurement into a window a report already closed would change a number somebody filed.

The rule also keeps the recovery path working. Late rows arrive in bursts, when the grace of a stopped run expires. They are numerous, and they are the oldest rows in the table. As pending rows they would fill every oldest-first read with rows the resend can only skip, and no recoverable measurement would ever come back.

The read guards against this from the other side too. It excludes the late reason in both vendor statements, so rows written by an earlier build cannot block the head of the read either. A resend that still meets one counts it. There is deliberately no log line per row, because the loop runs over a whole batch. An operator acts on the aggregate line and the counter.

The reason column is kept either way. The state says what happened to the row, and the reason says why. An operator asks what did this run measure after it was stopped. That answer needs the reason.

One index on the state and the creation instant serves the only reader. The state leads, so the read stays proportional to the backlog and not to the whole table, because terminal rows are never removed.

The write commits on its own and never fails the caller. The ingest path that calls it is already failing, and a shared transaction could roll the row back with it. The one thing this table must never do is vanish together with the problem it documents.

If even that insert fails, the measurement is gone, and only then does the lost counter rise.

fcc_model_capability

What one device model can be asked to do, as far as this installation has been told. At most one row per model.

Column Type Meaning

id

BIGINT PK

A surrogate key. No caller keys on it, because the model id is the business key.

model_id

INT NOT NULL

The product class of the ACS, the same value the fleet table snapshots and the catalog reports. There is deliberately no foreign key: this schema has none, and the referenced table lives in a schema this service only reads, so a constraint could not be created from here. The rule is a write-time product rule instead, and the administration service refuses a model the ACS does not know.

connections_dl_max

INT

The ceiling for the download connection count. Nullable, and an empty value means unconstrained and not zero.

connections_ul_max

INT

The same for the upload direction. Two columns, because devices advertise the two maximums separately and routinely differ. A row may therefore record a known download ceiling and say nothing about upload.

supports_time_based

TINYINT(1) NOT NULL

Whether the model can run a time-based test. Recorded and consulted by nothing: the validator refuses that mode for every model, because this ACS version cannot parse a time-based result. The column exists so the later work is a code change and not a migration, and so an operator can populate it from datasheets. It is mandatory with a default, unlike the two ceilings, because this is a two-valued fact: unknown and not supported lead to the same behaviour.

A model without a row here is unconstrained, and that is why an empty ceiling is not zero.

The table is a list of known limits, not a registry of every model. Most models of an installation will never have a row, because nobody read their datasheet. Reading an absent row as zero connections would refuse every campaign on every one of them, with an error naming a ceiling nobody entered.

An empty value therefore means nothing is known about this model. Three places implement that one reading, and all three keep it.

  1. The provider leaves an absent model out of its map, and callers fall back to an unknown capability.

  2. The catalog renders those empty values, so the UI leaves the input unconstrained.

  3. The validator takes the lowest known ceiling across the models of the fleet, so an empty value neither lowers nor raises it.

One place answers HTTP 404 for a missing row, and that is the administration read. See 404 on a read, 403 on a write.

The table is global for the installation and has no domain column, because a connection ceiling is a property of the hardware. The same model behaves the same way in every domain. That is also why a write requires the scope ALL. A row here constrains every operator of the installation, and this product has no role model for an installation administrator.

One unique index on the model enforces one row per model in the database. The write is an upsert on that key, and two rows would make the applied ceiling depend on which row a read returned first. The index serves both reads: the administration screen by one model, and the provider by a whole model set in one statement.

fcc_domain_setting

The middle level of the settings chain. At most one row per domain. See The settings chain.

The per-domain level exists for installations with several providers. One deployment serves several providers, each one is a domain, and each has its own test servers. A single global URL is wrong for all but one of them. An operator who retypes two URLs into every campaign will mistype one.

Column Type Meaning

id

BIGINT PK

A surrogate key. The domain id is the business key.

domain_id

INT NOT NULL

The domain. No foreign key, for the same two reasons as the capability table.

url_dl, url_ul

VARCHAR(512)

The test servers of this provider. Two columns, and the same length as the campaign columns, so a value copied from here can never be truncated. These are two of the six fields with no global level below them.

threshold_dl, threshold_ul

INT

The WAN cross-talk thresholds in Kbps, per direction. Per-domain, because the figure depends on the access technology of the provider and not on the campaign. This pair feeds three fields of the chain with no global level: the two speed thresholds and the latency threshold. It reads the download column.

speed_success_percent

INT

The percentage of the tier that still counts as a pass. Unlike the URLs it does have a global level below it, because it is a policy figure an installation can state once.

latency_success_ms

INT

The pass bound for a measured average round trip. The ACS publishes raw measurements and never a verdict, so the bound belongs to this service.

latency_host

VARCHAR(255)

The default ping target of the provider. A default here does not make the field optional on a campaign: the validator still refuses a latency campaign without a host from either level. The default saves the operator from retyping the target, and it must not create a campaign that pings nothing.

Every field is nullable, and an empty field is indistinguishable from a missing row. Both mean this domain publishes no opinion on this value, and the chain treats them identically. A caller that had to tell them apart would encode a distinction without meaning.

One unique index on the domain enforces one row per domain. The write is an upsert on that key. With two rows the frozen URL of a campaign would depend on which row a read returned first. The index serves the read that runs on every save and the scoped administration list.

fcc_legacy_import

The cursor and the progress of the legacy import. See Legacy FCC import.

The table holds exactly two rows, one per result kind, and that is its whole cardinality. The two legacy sources have different shapes, so they need independent cursors. A shared cursor would need the columns of both kinds. Worse, a stall on one kind would hold the other kind hostage. Two rows let one kind fail while the other makes progress, and let an operator restart one of them alone.

Column Type Meaning

result_kind

VARCHAR(32) NOT NULL

SPEED or LATENCY. The identity of the row.

state

VARCHAR(32) NOT NULL

IDLE, RUNNING, STOPPING, COMPLETED or FAILED. The completed state is not terminal, because the old feature keeps writing. It only means everything before the watermark is in ClickHouse. Idle means interrupted on a committed cursor, and failed means broken.

run_id

VARCHAR(64)

One import attempt, and the fence of every mutating statement. A zero-row update means a takeover evicted this run. See the fence.

zone_id

VARCHAR(64)

The zone this run interpreted the legacy timestamps in. It is a run parameter and not a property of the data, so a resumed pass reads it back from here and not from the configuration.

The six cursor columns

mixed

One position, six columns, with every value taken from one source row. The direction column holds the raw legacy number as text and never a direction name. See Why the cursor is composite.

The three pending columns

mixed

The legacy id range of the batch handed to ClickHouse, and the campaign it was read for. Committed before the insert and cleared after it. A value at startup means a previous run died inside that window. See Why the pending range exists.

watermark_started_before

DATETIME(3)

The completeness mark. Every row of this kind with an earlier start date is imported. A local wall clock, because the legacy column stores no offset. Written only when a pass completes. See Why the watermark is a date.

watermark_result_id

BIGINT

The highest legacy id a completed pass covered. A diagnostic mark that bounds no read. Its one use is the recognition of a late arrival.

The five row counters

BIGINT NOT NULL

A 64-bit type for anything counting source rows, because a legacy installation can hold tens of millions of results and a 32-bit counter would wrap mid-import.

The four data-quality counters

BIGINT NOT NULL

Kept apart and never summed, because they need different answers. An overflowed byte count is a schema limit, an unreadable tier is a bad row, and a missing properties row is a missing configuration.

The four creation counters

INT NOT NULL

Rows created in this schema, bounded by the number of legacy groups and devices rather than by the number of results. A 32-bit type is therefore enough.

total_row_estimate

BIGINT

Counted once at the start, only so progress can be a fraction. Nothing decides completion from it, because the old feature keeps writing and the number is stale at once.

stop_requested

TINYINT(1) NOT NULL

The cooperative stop. The operator sets it, and the worker notices it between batches.

heartbeat_at

DATETIME(3)

What tells a slow import from a dead one, and what the staleness arm of the claim compares against. Refreshed between batches and over the slow parts of a pass that are not batches.

started_at, finished_at

DATETIME(3)

The start instant is a pass parameter and not decoration. The window cutoff is derived from it and never from the current time.

last_error

VARCHAR(1024)

The operator-facing reason the import stopped. Truncated text and not a large object, because the full stack trace belongs in the log.

One unique index on the result kind enforces the two-rows rule in the database. Every access asks for the row of one kind. A second row for one kind would hand a resuming import a stale cursor and re-import a range already written, and ClickHouse cannot undo that. The unique index is also what makes the get-or-create at startup safe under two racing processes.

One unique index on the legacy group and the kind lives on the campaign table. It is the key the import finds its own anchor by.

Why the cursor is composite

Rows are read in this order:

(ug_id, serial, direction, start_date truncated to the second, id)

That is the order the iteration rank is defined over. The truncation makes rows of one second rank in a defined order instead of by insertion accident.

A resume after id N cursor cannot express a position in that order, because the ids are not monotonic along it. A batch ending in the middle of a group could then not resume the ranking of that group. Hence the five position columns, plus the running rank of the current group. A group split across a batch boundary continues at the next number instead of restarting at 1 and producing two first measurements.

The cursor id alone therefore says nothing about progress. Only the tuple does.

Two rules the tuple must obey:

  • The direction column stores the raw legacy number as text, never a direction name. Several numbers map to one name, so a name cannot be inverted into the number the legacy table is compared on. A cursor restored from a name would re-admit imported rows or drop the direction term from the order in the middle of a campaign.

  • All five values come from one source row, and an empty value in any of them is refused instead of stored. A comparison with an empty value is unknown, so such a cursor matches no row, the next batch comes back empty, and the runner reads that as the end of a campaign. The pass halts instead.

Why the pending range exists

A ClickHouse table has no unique constraint and no upsert. A row inserted twice stays twice, forever, and in a regulatory report that inflates the sample.

The id range of a batch is therefore written here and committed before the insert, and cleared only after it. A value at startup means the previous run died inside that window and the fate of the batch is unknown. The recovery re-checks that bounded range against ClickHouse, and only that range, instead of reconciling the whole import.

The range is the lowest and the highest id of the batch. The traversal order is not the id order, so the ids of one batch are far apart.

The campaign in the range ties it to the campaign it was read for, and the recovery set is offered to that campaign only. A run that died in the first batch of a campaign committed no cursor for it, so the stored cursor still names the previous campaign. Without the column the recovery set would be handed to that previous campaign, cleared there, and the batch in doubt would be inserted twice.

A pending range also makes the row resumable on its own, with no cursor behind it. A fresh claim would otherwise erase the only record of the ids in doubt before the probe could read it.

Every statement on this table commits at once, and the contract rests on that. The pending marker is therefore durable when the call returns. One transaction around the import would defer every cursor commit to the end of a run of several hours. The counters are written as an increment for the same reason. A commit then adds what the batch did, instead of overwriting the row with a stale total.

Why the watermark is a date

A pass needs a completeness mark separately from the cursor, because the cursor columns cannot answer the question. They name a position in an order that is not the id order. The cursor resumes an interrupted pass, and the watermark makes a new pass cheap and free of duplicates.

A pass selects on the start date and sets the mark to its own cutoff. The mark and the inclusion predicate are the same column, so the intervals of successive passes tile the timeline with no gap and no overlap. Completeness is then true by construction.

A mark over ids would be unsound.

The legacy id is global across every campaign and device of the installation, and the start date is whenever the measurement was taken. The two order independently:

  • A device that buffers a result and flushes it late gets a high id with an old start date.

  • A device reporting in real time gets a lower id with a start date inside an open window.

A pass imports the first row and writes its high id as the mark. The second row is then below the mark forever, above its own cutoff, and never importable again. Nothing can back-fill it into a ranked window.

The id mark only moves up. A later pass covers a later interval whose highest id is not necessarily higher, and a falling mark would over-report the late arrivals.

The settings chain

the value in the request  ->  fcc_domain_setting of the campaign domain  ->  the global defaults
the first present value wins, from left to right

One method implements the chain, and three callers use it.

There are two freezes in this system, at two moments, for two reasons. They are routinely confused.

Freeze When What it protects against

The chain, into the campaign tables

Save time, once

An administrator changing a global or per-domain default between two runs of one campaign

The snapshot, into the 32 run columns

Every dispatch

An operator editing the campaign after a run happened

The single most important fact about the chain is that it does not run at activation time.

Which fields have which levels

Not every field has all three levels, and the gaps are deliberate.

Field Domain level Global level Note

The two speed URLs

Yes

No

There is no sensible installation-wide default for a URL. A domain without a row and a campaign without a URL stays unactivatable until somebody supplies one.

The latency host

Yes

No

The same reasoning. The requirement survives the domain default.

The three cross-talk thresholds

Yes

No

A threshold with no value anywhere is legitimately absent. The sampling then produces no cross-talk verdict of its own.

The speed success percentage

Yes

Yes, with a default of 80

A policy figure most providers share.

The latency bound

Yes

Yes, with a default of 100 ms

The same.

The four WAN timing settings

No

Yes

Timing of the sampling protocol, not a policy of an operator. That resolve walks two levels only.

The three ping parameters

No

Yes, with defaults of 4, 1000 ms and 64 bytes

Protocol defaults rather than policy. There is nothing provider-specific about how many times one pings.

The tiers, the connection counts, the upload size and the hub id

No

No

The subject matter of the campaign. A tier is the plan of the subscriber, and a default would default the thing being measured against.

The test mode is not a chain at all. It is the file-based mode when absent.

Blank text is absent, not a value

The text variant of the chain treats a blank string as absent, and that is not cosmetic.

A form that posts an empty string for a field the operator left empty is the normal shape of a UI request. A strict chain would let that empty string beat the domain default. The per-domain URL would then never apply for the caller it exists for. The campaign would fail its runnable check later, and nothing would say that a default was available.

Blank is also what that check already reads as missing, so the two halves agree on what absent means.

Absent is stored as an empty value, never as an empty string. An empty string would be a second spelling of nothing. Every report, every migration and every query by hand would then have to know both spellings.

The chain runs once, at save time

This is the point of the design and the easiest thing to get wrong.

A campaign with a recurrence runs for a week and is activated daily. The service could read the chain again on each activation. An administrator changes a URL on day three. Days 1 to 3 and days 4 to 7 would then measure different servers. Nothing in the report would show it. The campaign row, the run snapshots and the measurements would all look consistent, each describing the configuration in force when it was written.

A regulatory filing has to state one set of parameters for the whole campaign. The service therefore freezes the resolved values into the campaign tables at save time, and every run additionally snapshots them.

Five consequences are what an operator will ask about:

  • An edit of a domain setting affects campaigns saved afterwards and nothing already stored. A campaign that froze the old URL keeps measuring against it for the rest of its runs.

  • A deleted domain setting makes future campaigns of that domain fall through to the global defaults, and changes nothing already frozen.

  • The details read answers the resolved values, not what you sent. A body without a URL comes back with the URL of the domain, because that is the stored campaign.

  • An export writes the stored settings, and an import does not resolve the chain again. The file carries resolved values, so they win over the defaults of the target installation. See Inherit the defaults of the target installation.

  • The audit trail matters more here, not less. A campaign saved after a domain edit looks as though the operator typed those numbers. The domain setting row in fcc_audit is the only record that they did not.

There is no walk up the domain tree

The resolver matches the domain exactly. A domain without a row of its own does not inherit from its parent. It falls straight through to the global default.

That is a deliberate limitation, and this service cannot lift it. Two facts stand in the way:

  1. The ACS encodes its domain hierarchy inside a dotted name and has no parent column. There is no parent id, no closure table and no adjacency list. The shape of the tree lives in a naming convention, so the only inheritance available would be a guess by text prefix. That breaks the first time a domain name contains a dot for another reason.

  2. This service never receives the tree. The UI Backend sends a flat list of visible domain ids and nothing else. Even with a parent column, this service does not read the domain table, and adding that read would put the hierarchy of a whole product into a table this service does not own.

A guess is the wrong kind of wrong here. A wrongly inherited URL is a campaign that measures the wrong server while looking perfectly configured. It produces numbers, they reach a report, and nothing says which host they came from.

An installation that wants one URL for a subtree writes a row per domain of that subtree. That is more rows, and they are rows somebody can read.

The settings snapshot of a run

The 32-column block on the run row duplicates the campaign tables on purpose. The campaign is editable, and the run is not.

A regulatory report has to show the parameters the ACS applied when the run happened. Reading the settings off the campaign at report time would rewrite history on every edit.

The consequence: an edit of the settings takes effect from the next run.

Three snapshot columns select a formula. They therefore change a result, and the rest of the block does not. Everything else here is reported, and these three are computed with.

The calculator reads the test mode to choose between the two speed formulas, and the two time-based columns carry its window. See Pass and fail rules.

Taking the mode from the campaign would re-judge a finished run as soon as somebody switches the campaign. That is the exact failure this snapshot prevents, except that it would change a verdict and not a displayed figure.

An absent mode reads as the file-based one, because that is what every older run was.

The snapshot is type-driven

The mapper switches on the type of the configuration. A speed configuration gets the speed columns, and a latency configuration gets the latency ones. The half that does not belong to the type is written empty, explicitly, instead of being left as it was.

This row is what a report renders, and a leftover URL next to a ping result is a report stating parameters the run never used. Two paths re-snapshot an existing row: a configuration whose type changed between two runs, and the dispatch of a planned run.

For a latency run the upload columns stay empty as well, because a ping is symmetric. The two mode columns stay empty too, because they describe how a throughput measurement is taken.

A planned run re-takes its snapshot

The planner writes a provisional snapshot when it creates the run for the next day. A planned row is therefore a complete run, and not a stub the portal has to treat differently. The dispatch then re-takes the snapshot from the current campaign rows at the moment the command is sent.

That re-take implements the product rule. The run already on the ACS keeps the configuration its command carried, because a republication re-sends the stored payload and never runs the mapper again. The next run picks up whatever the operator changed meanwhile. One snapshot at planning time would freeze a configuration days before its run. An operator who fixed a wrong URL would still see the wrong URL in that run.

The command sequence number is the one column the planner leaves unset, with the placeholder 0 until the dispatch assigns the real number. The command consumes the sequence number, not the row. A run planned today and sent tomorrow would otherwise burn a number now and make every command written in between look stale.

The planner does not raise the run count of the campaign either. That count counts the runs an operator asked for, and it is what freezes the device set. A run the service planned by itself is not a new decision by anybody.

The iotw grant

A configuration with the source type Condition names a saved view of the portal device list. That data lives in the schema of the UI Backend. This service reads two tables there and nothing else.

GRANT SELECT ON iotw.iotw_view               TO ftfcc_iotw_ro;
GRANT SELECT ON iotw.iotw_view_column_condition TO ftfcc_iotw_ro;
Table What the service reads

iotw_view

The id, the name, the domain and the view type. The details read answers that name as the condition name, and the domain decides visibility. The presentation columns of the portal are deliberately not read, because this service renders no device list.

iotw_view_column_condition

The whole criteria tree, in one read. The service reads every node and drops none. It then refuses a node it cannot translate. A dropped node would resolve the condition to another fleet with nobody told.

Four properties of this grant are decisions:

  • No writes, ever. The pool is opened read-only in code as well as granted read-only. These are the views of the portal, and this is a borrowed read.

  • No transaction manager. Reading a condition is one or two statements with no invariant between them. A second manager would tempt somebody to join this read into another transaction. No pair of datasources can honour that here.

  • Lazy. An installation without the grant starts normally and refuses only that one device source. The startup check reports the missing columns and warns instead of failing.

  • On Oracle the two tables belong to their own user, so the datasource sets the current schema on each session. Without it every unqualified read would resolve against the empty schema of the connecting account.

The ClickHouse tables

fcc_result_speed

One row per speed iteration and direction, in the shared database ftacs_qoe_ui_data. Quality of Experience (QoE) monitoring already owns two tables there. The prefix and the separate migration history exist for that reason.

Column Type Meaning

fcc_test_id, activation_id

Int64

The campaign and the run.

iteration

Int32

The position of the measurement in its group.

domain_id

Int32

From the result, with the run snapshot as the fallback. A value of 0 is not a domain and is also the sentinel when neither source resolves one. See Where the domain and the hub id come from.

serial

LowCardinality(String)

Always present, because the serial number is mandatory on the command.

hubb_id

LowCardinality(String)

The same provenance as the domain, with a test for an empty value only, because an empty text is a campaign that legitimately has no hub id.

direction

LowCardinality(String)

DOWNLOAD or UPLOAD.

url

String

Not low cardinality. See [lowcardinality-rule].

tier_kbps

Int32

The tier the measurement is judged against. Not low cardinality, because it is a number.

started_at

DateTime64(3)

When the device measured.

finished_at

Nullable(DateTime64(3))

Nullable, because legacy latency rows carry no end date and both tables keep one ingest path.

status

LowCardinality(String)

SUCCESS, FAILED, CROSS_TALK or OTHER, computed by this service. The ACS never publishes a verdict. Since this release, a non-blank description gives OTHER, checked before CROSS_TALK. Rows stored earlier are not rewritten. See device error.

description

String

Free text from the measurement. A non-blank value is the DiagnosticsState text of a test that did not complete, for example Error_TransferFailed. The service stores it as the device reported it, together with the raw byte count and the begin and end instants, which can be stale.

wan_usage_dl_kbps, wan_usage_ul_kbps

Int32

The two sampled WAN rates.

after_stop

UInt8

The measurement arrived after the run was told to stop. The wire flag wins when it is set, and a local comparison is the backstop for an ACS without the flag. See Results after a stop.

source

LowCardinality(String)

ACS_STREAM or LEGACY_ETL. See Two different source dictionaries.

legacy_ug_id, legacy_result_id

Nullable(Int64)

Filled by the import only.

created

DateTime64(3)

When the row was written. This is the partition key.

bom, eom

Nullable(DateTime64(3))

The begin and the end of the measurement, as the device reported them.

total_bytes, test_bytes

Nullable(Int64)

Nullable, because the legacy path destroyed the byte count on a large transfer and the import stores an empty value instead of a lie. A stored 0 is not a slow transfer, it is no transfer, and the verdict says so.

connections

Int32

The number of connections the transfer used.

speed_kbps

Float64

Computed by this service. See Pass and fail rules for the expression and for the integer division it must never use.

The engine is a MergeTree, partitioned by the day of the creation instant. The order is campaign, serial number, direction and creation instant. A row lives for 400 days.

No other table in this product uses a lifetime clause. Verify on the deployed ClickHouse version that parts are dropped at 400 days, and that the background merge does not fight the daily partition boundaries.

The low-cardinality type applies only to text columns with few repeated values. Those are the serial number, the status, the source, the direction and the hub id. It deliberately does not apply to the tier, because that column is a number and a dictionary per part would gain nothing.

The column list is final. Every column the import needs is already there. Adding a column over tens of millions of rows during an import is the operation this design avoids.

The natural de-duplication key is the run, the serial number, the direction and the iteration. ClickHouse enforces no unique constraint, so the readers and the ingest path de-duplicate on it themselves. See De-duplication is one atomic call.

fcc_result_latency

One row per latency iteration, in the same shared database.

A second table rather than more nullable columns on the speed table. The two diagnostics share nothing below the common block. One part would carry a dictionary and a null map for every foreign column. The order serving a speed report is also not the order serving a latency report.

The common block is identical to the speed table in name, order and type, down to the nullability. That is a hard rule.

Every cross-diagnostic read is a union of the two tables, and ClickHouse matches a union by position. A reordered column would not fail. It would return a serial number in the URL column of half the report.

The first twenty columns are therefore exactly those of the speed table, with the same provenance and the same fallbacks. Two of them read oddly for a ping and are kept anyway.

Column Note

direction

Always PING here. Kept, and kept in the order, so the two tables stay union-compatible and no reader needs a special case.

url and tier_kbps

A ping has neither. The columns are mandatory and union-compatible, so the answer is the same absent value the speed side writes: an empty text and a 0.

The latency half adds five columns and two more.

Column Type Meaning

val_avg, val_min, val_max

Nullable(Int32)

The round trip in milliseconds, passed through unchanged. Nullable on purpose: a ping that lost every packet, and every imported row from a source that stored only an average, genuinely carry no value. A 0 would be a lie no reader could tell from a sub-millisecond round trip.

packets_received

Int32

The success count of the device.

packets_sent

Int32

The sum of the success count and the failure count, reconstructed from the two counters and never read from the configured repetition count. TR-181 guarantees that sum. The configured value is what was asked for, and the sum is what the device reports having done. An absent counter contributes 0, because these two columns are mandatory and a count of zero is a true statement.

repetitions

Nullable(Int32)

The repetition count the device ran with, as reported per iteration. It falls back to the run snapshot and stays empty when neither source has a value.

data_block_size

Nullable(Int32)

The block size the device used, with the same fallback.

The last two columns are nullable and have no default, for two reasons.

A 0 would be a statement a reader has to believe: zero repetitions, or a zero-byte packet. Every row written before the migration, and every row from an older ACS, genuinely has no value to report. The service also deliberately substitutes no runtime default: a defaulted figure would be indistinguishable from a reported one in a compliance export.

The migration that added them is also safe, although the header of the create migration declares the column list final. A ClickHouse column addition with a nullable type and no default expression is metadata only. No existing part is rewritten, the column materialises on the next merge, and it reads back empty until then. The operation the header feared is a column with a default or a computed expression, and this migration has neither.

Union compatibility is preserved. The two columns are appended at the end, past the latency-only block, and they are part of no order, partition or lifetime clause. The speed table gets no equivalent columns, because a speed iteration has no ping parameters to report.

Parked dead letter rows are unaffected. Their payload is JSON, so an older payload reads back with both fields empty and falls back to the snapshot on a resend.

The engine, the partitioning, the order and the lifetime are the same as on the speed table. The low-cardinality rule applies unchanged, and the natural key is again the four columns, again unenforced.

The status is computed by this service and stored in the same dictionary. See Pass and fail rules, and in particular why a success count of zero is a failure and not other.

The report read path

One read path serves the four report endpoints. It never runs ahead of the write side. Every column it selects exists in the tables. Every predicate comes from the one filter all four endpoints resolve. That is what stops the run list, the measurement list, the report header and the export from disagreeing about which rows a filter means.

The union is generated, never written twice

ClickHouse matches a union by position and not by name. The read side takes that further: the two branches render one column list, and every column is cast to the same type on both sides. A column a branch does not own becomes an empty value of the same type at the same position. The two renderings are therefore union-compatible by construction and not by review.

That is also why four columns are projected as nullable in a report row although the tables declare them mandatory. A speed row has nothing to offer the packet count. The honest way to say so in a positional union is an empty value. A fabricated 0 is one a reader could mistake for a real count.

The period filter is two predicates

Both tables are partitioned by the day of the creation instant, and a report filters on the start instant. The start instant is when the device measured, and the creation instant is when the row was written. The two differ by the batching of the ACS, or, for an imported row, by years.

A filter on the creation instant would therefore drop measurements. A filter on the start instant alone forces a read of every partition, because the engine cannot relate the two columns.

The read adds a second, wider predicate on the creation instant beside the one on the start instant, one day either side of the window. It can exclude no row the first predicate keeps, because nothing is written a day before it is measured. It lets ClickHouse skip whole partitions.

The run list applies the plain start-instant bound on the relational side, where there is no partition to skip.

Model and manufacturer come from the frozen fleet

Neither result table carries a model, a manufacturer or a device id, and none is being added.

The scope resolver works in three steps instead. It maps a manufacturer to model ids through the ACS catalog. It maps model ids to campaigns and serial numbers through the frozen fleet. It turns those into a campaign predicate on the result rows. It adds a serial number predicate only when the model does not cover every device of the selected campaigns.

The resolver uses the snapshot and never the live ACS table. The snapshot describes the fleet a run executed against, and a device re-provisioned into another model must not change what a finished run reports.

One limitation cannot be fixed on this read path.

A model or manufacturer filter reaches an imported row only where the import wrote a fleet snapshot for its anchor campaign. Without the snapshot, the second step finds no campaign and the imported half of the report is not there at all, not partially.

There is deliberately no fallback to the live device table. A live read would answer with the model the device carries today. For a measurement taken years ago that is not an approximation. It is a different fact.

The import does write a snapshot for every anchor, from the serial numbers of the measurements. That snapshot has one limitation. The model is the model at import time. A serial number without a live device row is not recorded at all. See The model is the model of today.

Two different source dictionaries

Two unrelated source columns exist in this system, and they must never be treated as one vocabulary.

Column Values

The source of a campaign or a run, in the relational schema

ACS_STREAM or LEGACY. It classifies a campaign: a live one, or an anchor for an imported one.

The source of a result row, in ClickHouse

ACS_STREAM or LEGACY_ETL. It classifies a measurement: streamed live, or produced by the import. This is the column the report filter means.

The two vocabularies mirror the split exactly and never mix.

What an imported row carries

An imported row fills the same columns a live one does. Several of them have no source in the legacy schema, and how each says so depends on the nullability.

Column Value Why

connections, the two WAN usage columns, after_stop

0

The columns are mandatory, and 0 is the only available value. A 0 for the stop flag is also true, because an imported run was never stopped.

test_bytes

Empty

The column is nullable, so the row can say unknown rather than zero bytes.

repetitions, data_block_size

Empty

The legacy latency table reports neither, and a source without a figure must stay distinguishable from one that reported zero.

total_bytes

The stored value, or empty

Empty when the legacy counter overflowed. See Lost byte counts.

url and tier_kbps on a latency row

Filled from the legacy columns

Unlike a live latency row. It writes the absent values, because the legacy latency table carries both.

started_at, finished_at

Whole seconds, always

The legacy fraction is a random draw and not a measurement, so the import drops it and puts nothing in its place. That makes two imports of one row comparable, and it is why an imported end instant can never precede its start instant.

domain_id

The domain of the legacy group

A 0 is the super domain, not unknown and not no domain. Such rows are readable only by a caller with the scope ALL. See A domain of 0 means the super domain.

created

The instant of the import

Not the instant of the measurement. It is the partition key. That is why The period filter is two predicates uses two predicates.

The migration history table

The automatic Flyway configuration of the framework is switched off, and the history table name is never set through it. The service builds its migration instance by hand, because the community ClickHouse dialect stops at an older core version than the framework manages.

That instance uses the history table flyway_schema_history_fcc, never the default name. The ACS, the UI Backend and the device network service keep their own histories in this shared database. A shared default name has already caused one incident. The table name comes from a property instead of a literal.

Entity diagram

fcc-database-entities