Legacy FCC import
What the import does
An installation has FCC measurements from before this service existed. They live in two tables of the Auto Configuration Server (ACS) schema, written by the old Update Group feature. That feature keeps running and keeps writing into them.
A regulatory filing about an earlier period needs those rows. The report endpoints read ClickHouse only, so the rows must get there.
The import closes that gap.
One pass reads one legacy result table and rebuilds the campaign structure of its measurements.
It then writes the measurements into the two FCC result tables with the source LEGACY_ETL.
A report over them is then the same query as any other report.
It copies and never moves
The import does not touch the two legacy tables.
It never updates a row, never marks a row as imported and never deletes anything.
The account of this service holds SELECT only, the pool is read-only in code, and every statement is a read.
This is a product decision, not only a consequence of the grant. Customers run their own SQL reports against those tables. An import that marked or moved rows would change the answers of those reports.
The consequence shapes every rule below. The source can be read again, so the import must be safe to run again.
It is a product feature, not a migration script
There is no schedule and no poller. You start the import with one endpoint, watch it with a second and stop it with a third. See The legacy import endpoints.
You also run it more than once, on purpose. The old feature keeps writing while this service runs, so one pass is never the last one. A completed pass means one thing: every measurement before the watermark is in ClickHouse. The next start opens a new pass from that date.
The state COMPLETED is therefore not a final state.
An installation with a finished migration can switch the start endpoint off with ft.fcc.legacy-import.enabled, and the status endpoint keeps answering.
What the import does not transfer
Each legacy group becomes an anchor campaign
A legacy campaign cannot be continued by this service, and a migrated configuration would only serve a continuation. Such a campaign has no runs to continue from, often no domain, and a schedule this service cannot express. An imported campaign with an Activate button would send a command naming a group the upgraded ACS no longer has.
Every legacy group with results therefore becomes an anchor. An anchor is a campaign row with one job: the imported measurements and the rebuilt runs hang from it.
| Column | Value on an anchor |
|---|---|
|
|
|
|
|
The id of the legacy group. With the result kind it is the key the next pass finds the anchor by. |
|
0. An imported campaign never reactivates, because its runs are rebuilt and not planned. |
|
0. No command was ever sent, so a sequence number would put an imported campaign into the numbering of the live protocol. |
The configuration and settings rows |
Written, and mostly empty. The thresholds, the tiers and the hub id come from the legacy settings. The online flag and the push flag come from the group. The durations and the retry counts come from the legacy properties table, when it has a row. |
The anchor carries no URLs, no ping host, no connection counts, no upload size and no recurrence. Those values lived in a generic name and value table, and reading it needs a parameter-path interpretation per ACS version. Every one of those columns is nullable for exactly this reason.
An empty configuration is written as empty and never as a default. A plausible duration here would be a number nobody configured, sitting in a regulatory record, and nothing would mark it as invented.
Two further rules apply:
-
A new pass never rewrites an existing anchor. The legacy configuration is read on the create path only. An operator may have corrected the anchor, and a later pass would undo that correction on every run.
-
An anchor without a legacy properties row is counted, not guessed. The key of that table is ambiguous: some ACS builds store the parent group there and others the child. The import tries the parent first, leaves every timing column empty, and increments a counter.
One group can become two anchors
One legacy group can carry both an FCC speed task and an FCC latency task. Those are two separate task rows with their own settings rows.
The import makes two anchors out of such a group, one per result kind. The unique index is therefore on the group id together with the result kind. An index on the group id alone would make the second anchor impossible and the whole latency half unimportable.
Ordinary campaigns are unaffected. A native campaign has no legacy group id, and both database vendors allow unlimited empty values in a unique index.
|
One campaign with two configurations would now be expressible, because that is the shape of a native campaign. The import still makes two anchors. The import is keyed, counted, watermarked and resumed per result kind, and one pass reads one result table. A merge of the two halves is therefore a change to the whole import, and it is a follow-up. |
Two more legacy tables stay unread
| Table | Why the import never reads it |
|---|---|
|
Per-iteration state, overwritten on every iteration. It is the old equivalent of fcc_device_state: current state, not history. Whatever it held about an old run is long overwritten. |
The shared diagnostic tables |
Not owned by FCC. Every diagnostic of the ACS writes them, for every product. An FCC import cannot tell which rows belong to a compliance campaign. |
What the import reconstructs
Three columns of every FCC measurement have no counterpart in the legacy schema. The import computes them by a deterministic rule, so two passes over the same rows produce the same values.
That determinism is the whole contract. A ClickHouse table has no unique constraint and no delete. A value that changed between passes would leave two rows claiming to be the same measurement, forever.
The run of a measurement
The legacy schema has no run entity. A legacy campaign ran for months, and the only record of a single run is the measurements.
The import rebuilds one run per day window, because a day is what a legacy recurrence was. The start date of a measurement alone decides its window. The hour of the window boundary comes from the legacy schedule expression:
-
A daily expression gives its own hour and minute.
-
Everything else falls back to midnight. Examples are a weekly schedule, a list of hours and a malformed string.
The import never half-interprets an expression. A guessed boundary would split one legacy run across two runs, and the split would be invisible in the report. The fallback costs nothing. The boundary only decides where a day is cut. Every measurement still lands in one window, and the windows stay stable across passes.
Each window becomes one run with the source LEGACY and the state FINISHED.
Only closed windows are imported, so such a run is over by definition.
The idempotency key comes from the group, the kind and the window index.
idempotency_key = "legacy:<ugId>:<SPEED|LATENCY>:<windowIndex>"
|
The window index is an absolute day number, never a count from 1 over the windows that exist. A count depends on the data present at import time. A campaign with an archived first window would get every later window renumbered. Every idempotency key would change, and the next pass would create a second run for a day it already imported. The same value is stored as the sequence number of the run. A sequence number on an imported run is therefore a large number and is not comparable with the 1, 2, 3 of a live campaign. |
The import creates a run when it first sees a measurement of that window, never from the calendar. Which days produced measurements is not knowable without reading them. A campaign scheduled daily for a year may have run on forty days only. A row per calendar day would fill the report with runs that never happened.
The window boundaries are facts about the window and are written at creation. The start, the end and the device count are facts about the measurements. The import applies them in one direction only, so a campaign imported in two halves converges on the true envelope. A pass that halts part way does not finalise its windows at all, because it has seen a fragment.
The iteration number
The iteration is the position of a measurement inside one window. The service counts the measurements of the same device in the same direction.
ROW_NUMBER() OVER (
PARTITION BY activation, serial, direction
ORDER BY start_date truncated to the second, id
)
Two halves of that rule carry weight.
The truncation to the second makes rows of the same second rank in a defined order. The database computes it, so the arrival order of the rows is the order the rank is defined over.
The id tiebreaker is mandatory. The legacy start date carries a random fraction of a second, between 0.1 and 0.999. The old code set it to make rows unique, so it carries no order information. Without the tiebreaker the order inside one second is undefined, and a second import would produce other iteration numbers for the same measurements. In a store without a delete that is one measurement under two identities.
|
A plain cast to a date type is not a truncation on MySQL, and the import does not use one. MySQL rounds the fraction away, so a measurement at 23:59:59.700 moves to the next day. That is another window, another run and another iteration number than the same row produces on Oracle. The MySQL arm subtracts the microseconds instead. The Oracle arm casts to a type with one-second resolution. That truncates. The two spellings are not interchangeable: a date cast on MySQL would drop the time of day and collapse a whole day onto one rank. |
The speed tier
The two legacy tables spell the tier differently.
| Source | What the tier column holds |
|---|---|
The speed table |
One string for both directions, in Mbps, repeated on the download row and the upload row. The direction of the row selects the half. |
The latency table |
A plain number, already in Kbps. The import parses it as it stands, because a division would be a conversion that never happened. |
The old ACS produced the speed string by a division by 1024 with a truncation to three decimals. The true value therefore lies in an interval of 1.024 Kbps. A multiplication by 1024 and a ceiling lands on it, and a rounding does not:
1000000 Kbps -> written as "976.562"
976.562 x 1024 = 999999.488
round -> 999999 (wrong)
ceil -> 1000000 (correct)
The multiplier is 1024 and not 1000. It undoes the division the old code performed, whatever that division ought to have been. The import parses the string as a decimal number and never as a floating-point number. A rounding step would turn a tiny representation error into a whole unit.
|
The remaining precision loss is below 1.024 Kbps, and no arithmetic can recover it. The reconstruction recovers the interval, not the digit. On a tier of a realistic size that is immaterial. The lossless original stays in the legacy table forever, because the import never touches the source. ClickHouse therefore has no second tier column. The exact value is already stored in the legacy table. A new column over tens of millions of rows is the operation the result tables avoid. |
An unreadable tier does not drop the measurement. The import stores a tier of 0 and counts the row as a parse failure. The measurement itself is a fact that happened. A lost measurement to hide a metadata defect would take real data out of a regulatory report.
Three details follow from that:
-
A speed string without a separator is unreadable in both directions. This service has never seen such a string written, and a chosen half would be a guess.
-
A half that is present and unreadable fails only its own direction.
-
A value above the limit of the ClickHouse column is counted with the unreadable ones. Two petabits per second is a corrupt string that happens to parse.
The parse failure counter counts imported rows, not measurements. A speed measurement is two rows, and each one is counted on its own.
The verdict is not recalculated
|
The legacy pass and fail formula is known to be wrong. It truncates the tier with an integer division before the comparison, so a low tier collapses towards zero and the measurement passes. See Pass and fail rules for the formula this service uses. The import reproduces the old result anyway, because the import reproduces history. A recalculation would contradict every report already filed. Those reports came out of the ACS with that formula, and the customer has filed them. A service that silently disagrees with all of them is worse than one with a visible and explainable defect. Above 2 GiB a recalculation is not even possible. The formula needs the byte count, and the old code destroyed it on every larger transfer. See Lost byte counts. |
The two columns with a verdict are mapped and nothing more.
| Column | Mapping |
|---|---|
|
The legacy speed times 1000. This is a unit conversion only, because the legacy column is Mbps. An absent value becomes 0. |
|
The legacy number, constant for constant: 0 is failed, 1 is success, 2 is cross talk, 3 is other. Any other value becomes other and is counted. The import never drops the row, because the measurement happened and only its label is unclear. |
Cross talk therefore arrives in a report as its own status, not as a kind of failure.
Lost byte counts
The byte count column in ClickHouse is nullable for this reason. The import refuses a legacy value, stores an empty value and counts an overflow in two cases.
| Condition | What it means |
|---|---|
The byte count is negative |
A 32-bit counter wrapped. This is the Oracle signature, because the legacy column is signed there. |
The byte count is 0 and the speed is above 0 |
The same overflow on the boundary. This is the MySQL signature, because the column is unsigned there and a negative value becomes 0. A transfer without bytes cannot have a rate, so the pair is impossible. |
Both checks run on both vendors. An installation may have moved between them, and the import must catch the overflow in either form.
A stored wrapped number would put a byte count into a regulatory report that is wrong by four gigabytes and looks plausible. An empty value with a counter says the only true thing: the input was destroyed, and here is how often.
The time zone is a parameter of the pass
Every legacy timestamp is a local wall clock without an offset. The row carries no zone, so an instant needs a zone from outside.
That zone is ft.fcc.legacy-import.zone.
An empty value means the zone of the Java virtual machine (JVM), never UTC.
The import records the zone on its own row, and the status endpoint reports it together with the zone a new pass would use.
Without the correct zone every imported instant is displaced by the offset of the ACS server. The displacement is silent, uniform and invisible in the report.
|
A resumed pass keeps the zone it started with, even after a change of the property. The day window of a measurement is a function of the zone, and so is the key of its run. A finish under another zone would create a second run for a day that already has one and split the measurements between them. The service logs the mismatch as a warning and continues under the original zone. |
Which timestamps are real
| Column | Where it comes from |
|---|---|
|
The begin and the end of the measurement, as the device reported them. The import keeps their milliseconds, because these are the only real sub-second figures in the row. The legacy latency table has neither column, and the latency result table has no such columns either. |
|
The legacy start date, truncated to the second. The import stores the truncated value, so the instant agrees with the value the iteration rank was computed over. |
|
The legacy end date, truncated the same way. The legacy latency table has no end date, so a latency row stores an empty value. The import never stores the start instead, and never adds a guess. |
|
The import drops the sub-second part of the start and the end, and that makes two imports of one row comparable column by column. The legacy fraction was never a measurement. The old feature stamped both columns with random digits below the second. A reproduced fraction would need a fresh random draw, and that costs two guarantees:
The device timestamps are the exception and keep their milliseconds. |
The fleet snapshot is mandatory
|
A report filtered by model or by manufacturer resolves through the frozen fleet only. Neither result table carries a model, a manufacturer or a device id, and none is being added. See Model and manufacturer come from the frozen fleet. An anchor without a snapshot therefore returns nothing under such a filter, not less. An operator reads that as this campaign measured no devices of this model. A compliance report must never make that statement by accident. |
The serial numbers come from the measurements themselves, not from the current membership of the legacy group. A device deleted from the ACS since the run is absent from the membership and present in the measurements. The measurements describe what the campaign did.
The model is the model of today
A legacy result row carries a serial number and nothing else. The only source of a model is the live device row of that serial number today. A device re-provisioned into another product class is therefore snapshotted under its current model.
This is a limitation of the source data, and no approximation would be better. It is the one respect in which an imported fleet differs from a live one, because a live fleet is frozen at save time. The start endpoint states this in its own description.
A serial number without a device row
The device id of a fleet row is mandatory and stays mandatory. A serial number the ACS no longer knows has no id, and an invented id would make the unique index meaningless.
The import therefore leaves the device out of the snapshot and counts it, with a warning in the log. Two things stay true for it:
-
The measurements are imported normally and appear in every unfiltered report.
-
They are unreachable only through the model and manufacturer filter, because that model no longer exists in the installation.
Four more rules protect the snapshot.
| Rule | Reason |
|---|---|
Add, never replace |
The import reads the existing rows and inserts only new devices. A delete and insert would destroy the snapshot of a device that has since disappeared from the ACS, and that is exactly the device a historical report needs. |
Serial numbers are folded to one case |
The comparison ignores case on MySQL and respects it on Oracle. Two legacy spellings of one serial number would be one device on one vendor and two on the other. |
The insert is chunked, and a duplicate key is tolerated |
The MySQL connection collapses a batch into one multi-row statement, and a whole fleet in one statement is a packet nobody chose. The read of the known ids and the insert are two statements without a lock, so the unique index decides the race. A lost race means the device is already recorded, and that is no reason to stop a pass over millions of rows. |
With several serial numbers on one device, the newest measurement wins |
A fleet read by serial number can produce one device twice. The newest serial number is the one a device filter will ask about. |
The snapshot scan covers the interval of the pass only, under the same predicate as its batches. An installation importing for months therefore does not resolve a fleet it recorded long ago. One predicate decides all three: the rows a pass reads, the fleet it records and the id mark it reports. The watermark is sound only while the three describe the same set.
The resolve is not narrowed by domain.
The import runs with the scope ALL by contract, and an anchor takes the domain of the legacy group.
A narrowing here would drop the devices of every other domain from a campaign that measured them.
Late arrivals are counted and not imported
A measurement can reach the ACS schema after its day window was imported. The two marks of the import recognise it: its start date is below the watermark and its id is above the id mark.
The import counts such rows per campaign, logs a warning with the campaign, and reports the total on the status endpoint.
|
The import does not write them, and this is a known limitation with a reason. Their window is closed and every measurement in it is ranked. An insert now would give two measurements the same position in a store without a delete. In a regulatory sample a duplicate is indistinguishable from a real measurement. A missing measurement at least does not inflate the percentage. A non-zero count therefore needs no action during the run. It makes the loss visible instead of silent, and another pass will not change it. |
The count is answered only when both marks are known. Before the first completed pass nothing can be late.
How an imported measurement differs
| Column | Value on an imported row |
|---|---|
|
|
|
The legacy group id and the id of the source row. The crash recovery reads the second one back. |
|
0. The old feature has no source for them, and the columns are not nullable. An imported run was also never stopped. |
|
Empty. Same reason, with a nullable column to say so. |
|
Empty. The legacy latency table reports neither. A source without a figure must stay distinguishable from one that reported zero. |
|
Filled, unlike a live latency row. The legacy latency table carries both. |
|
The domain of the anchor. A 0 means the super domain. See A domain of 0 means the super domain. |
|
The instant of the import, not of the measurement. It is the partition key, and for an imported row the two instants differ by years. See the report period predicate. |
Operating the import
The endpoints and their status codes are in The legacy import endpoints. The properties, the grant, the required ACS version and the runbook are in The legacy import runbook. The cursor table is fcc_legacy_import.
A domain of 0 means the super domain
An anchor campaign takes its domain from the legacy group. That column is mandatory there, with a default of 0.
A 0 is the super domain, and not no domain. That is the convention of the platform and not a reading of this service. The import stores 0 for an empty value, for a 0 and for a -1. A stored -1 would be invisible to a predicate on 0.
The access consequence is correct.
A 0 is in nobody list of visible domains.
Such an anchor is therefore visible only to a caller with the scope ALL.
A caller with a domain list gets nothing.
See An empty intersection selects nothing.
This gives the import ran and I see nothing a second explanation besides a missing fleet snapshot.
Why a repeated import produces the same rows
|
A ClickHouse table has no unique constraint, no upsert and no delete. A measurement inserted twice stays twice, forever, and no statement removes it. In a regulatory report that is not cosmetic. It inflates the sample the compliance percentage is computed over. Every rule below makes the import was interrupted and started again produce the rows of one uninterrupted run. |
The cursor commits in two phases
One batch is one unit of work in three steps, and the order is the design.
-
The import writes the legacy id range of the batch and the campaign it belongs to. It commits before it touches ClickHouse.
-
The import inserts the batch into ClickHouse.
-
The import moves the cursor, adds the counters and clears the pending range.
A pending range at startup therefore means the previous run died inside that window. The fate of that batch is unknown. The recovery is one bounded read of the imported ids in that range. It runs at most once per resumed run and names the ids to skip. The range is one batch, so the import never reconciles itself against the whole table.
The counters are written as an increment. A commit then adds what the batch did, instead of overwriting the row with a stale total.
Only closed day windows are imported
A pass covers one interval of the start date and nothing else:
[ watermark_started_before , cutoff )
cutoff = passStartedAt - ft.fcc.legacy-import.window-settle - 24h
The import does not read rows at or after the cutoff. A window still receiving rows would be ranked over a partial set, and a later pass would renumber it. A renumbered rank is the same measurement twice in a store without a delete.
|
The newest measurements become importable about 25 hours after the measurement, and an operator must plan for that. The cutoff subtracts a full day on top of the settle time. With the default of one hour, a measurement taken now is eligible for a pass started about 25 hours from now. A higher settle time raises the lag by the same amount. The extra day makes the cutoff independent of the window boundary. A day window is at most 24 hours long. A row below the cutoff therefore belongs to a window that closed before the settle point. That holds for every start hour. The hours differ by up to 24 hours across an installation. The cutoff must be boundary-independent, because it is one value for the whole pass. A completed pass writes one date as its watermark, so the covered interval must be coherent. |
The cutoff comes from the start instant of the pass and never from the current time. A pass interrupted at campaign 50 and resumed an hour later imports the windows it set out to. A cutoff from the current time would import later windows for the campaigns after the cursor and never for the ones before it. The final watermark would still declare all of them done.
The one value from the current time is the row estimate, measured before the claim. A resumed pass therefore has a slightly wide denominator, and nothing decides completion from it.
The cursor and the watermark answer two questions
| Columns | Question |
|---|---|
The six cursor columns |
Where an interrupted pass resumes. A position in the traversal order, plus the running rank inside the group. The cursor id alone says nothing about progress, because the order is not the id order. The four values of a measurement come from one row, together with the rank of that row. |
|
Which measurements are complete. Every row of this kind with an earlier start date is imported. It is a local wall clock, because that is what the legacy column stores. The import writes it only when a full pass completes, and sets it to the cutoff of that pass. |
|
A diagnostic mark over legacy ids. It records the highest id any completed pass covered. It bounds no read, and its one use is the recognition of a late arrival. |
The completeness mark is a date, because the predicate that decides the content of a pass is a date. The mark and the predicate are the same column. The intervals of successive passes therefore tile the timeline without a gap and without an overlap.
|
A mark over ids would be unsound, because ids and dates do not order the same way. Legacy ids come from one sequence shared by the whole installation:
A pass imports the first row and writes its high id as the mark. The second row is then below the mark forever and can never be picked up. That is a permanent hole in a store without a back-fill. |
The id mark only ever moves up. A later pass covers a later interval, and the highest id of that interval is not necessarily higher. A falling mark would over-report the late arrivals.
An empty source column halts the pass
The read position is a tuple of four columns. A row with an empty serial number, an empty start date or, for a speed row, an empty type cannot become a cursor. A cursor with an empty component matches no row, and an empty batch is indistinguishable from the end of a campaign.
The pass therefore stops at such a row:
-
The whole batch is discarded. Nothing is written yet, so the cursor stays where the last committed batch left it.
-
The invalid counter is incremented, and the campaign and the row id go to the log and to the error column.
-
The state is
IDLE, and the watermark does not move.
The import deliberately does not skip the campaign and continue. That would move the cursor past the campaign. The next pass would resume above it, complete, and advance the watermark over rows nobody imported.
Those columns are mandatory in the ACS schema. Such a row means the source is not what this import was specified against. Fix the source row and start again.
One worker and one claim
One worker runs one result kind at a time. Two importers would contend for the same read capacity and the same ingest. The thing that must never happen is two passes over one kind.
A start claims the cursor row of each requested kind.
A run may take the row when nobody holds it.
It may also take the row when the holder has written no heartbeat within ft.fcc.legacy-import.stale-after, 5 minutes by default.
A stale holder is what a killed process leaves behind.
A claim on a held row answers HTTP 409.
The claim is a database statement, so it holds across every service instance.
Two properties are easy to miss:
-
A row with the state
RUNNINGand no heartbeat at all counts as stale. That is what a crash between the claim and the first batch leaves behind. -
The claim is all or nothing across the requested kinds. A failed second claim releases the first one. A start answering 409 must not leave half an import running.
The two kinds are otherwise independent, and the cursor table holds exactly two rows. An unreadable row on one table is no reason to abandon a pass over the other.
Every mutating statement of a run carries the kind and the run id. Zero updated rows therefore means another run took this kind over. The evicted pass then ends with an error and never touches the row again.
A claim taken is not a claim kept, because a run with a stale heartbeat can be taken over while it is still alive. An evicted run without that fence would keep writing. It would commit its cursor over the position of the live worker, and its state write would flip a running row to idle. Two workers ranking one campaign write duplicate positions into a store without a delete.
Two consequences follow:
-
The heartbeat covers the slow parts of a pass and not only the batch loop. The import writes it at the top of every campaign, and again after each half of the first phase, the anchor resolve and the fleet top-up.
-
The heartbeat refreshes every kind the run holds, including the ones waiting for the worker. A claimed kind cannot go stale before it starts. A lost kind the run has not reached yet is only logged, and only the running kind aborts the pass.
A stop is the one request without a run id. A stop is a request about the kind, from a caller with no knowledge of the run id. Stopping is cooperative, so the flag is set unconditionally and the current holder closes cleanly on its own cursor. A stop that arrives during a takeover asks the new holder to stop too. That is the correct outcome.
What ends a pass
The import checks the stop flag, the health of the result store and the shutdown signal between batches, never inside one. Whatever ends a run therefore leaves a committed cursor.
| What ends the run | What it leaves behind |
|---|---|
The stop endpoint |
The state |
A degraded result store |
The state |
A shutdown of the service |
The service asks every claimed kind to stop and waits up to 10 seconds. A lost wait costs nothing, because the next start re-checks the pending range. |
A source row with an empty key column |
The state |
An unexpected failure inside the pass |
The state |
A takeover after a stale heartbeat |
Nothing. The evicted run ends with its own error and never touches the row again, because the row belongs to the new worker. A written failure state would stop a healthy import. See One worker and one claim. |
The two end states differ in one thing.
IDLE means interrupted, and FAILED means broken.
The cursor is committed in both cases, so a clean stop is IDLE even with an error text.