Page MenuHomePhabricator

Aggregate directory coverage after coverage updates
AcceptedPublic

Authored by epriestley on Feb 17 2016, 1:52 AM.

Details

Summary

Ref T9524. This updates data but doesn't do anything interesting yet. The next change will add a UI for it. See discussion in D14803.

After coverage data is written, aggregate coverage for all affected ancestors. This diff does it in an easy way that's probably not too horrible:

  • Load all coverage data.
  • Figure out how much of it is relevant.
  • Update that.

I think that'll probably be OK even for large repositories (i.e., require tens of megabytes, not tens of gigabytes).

The aggregate data is stored in a special way, since I had to be able to exclude it from the query anyway and this is more efficient. It looks like this:

+J{"U":5,"C":7,"N":0,"X":0}

The + is a signal that it's aggregate, the "J" is identifying the rest of the string as JSON, and then the counts follow in JSON format.

Test Plan

Pushed some coverage in in "overwrite" mode, saw this in the database:

mysql> select * from repository_coverage;
+----+----------+----------+--------+-----------------------------+
| id | branchID | commitID | pathID | coverage                    |
+----+----------+----------+--------+-----------------------------+
|  4 |        1 |    82639 |      0 | D                           |
|  7 |        2 |   116868 |    173 | CCCUUU                      |
|  8 |        2 |   116868 |  12384 | CUCUCU                      |
|  9 |        2 |   116868 |    172 | +J{"U":6,"C":6,"N":0,"X":0} |
| 10 |        2 |   116868 |    145 | +J{"U":6,"C":6,"N":0,"X":0} |
+----+----------+----------+--------+-----------------------------+
5 rows in set (0.01 sec)

Then pushed some coverage in in "update" mode, saw this in the database:

mysql> select * from repository_coverage;
+----+----------+----------+--------+-----------------------------+
| id | branchID | commitID | pathID | coverage                    |
+----+----------+----------+--------+-----------------------------+
|  4 |        1 |    82639 |      0 | D                           |
|  7 |        2 |   116868 |    173 | CCCCUU                      |
|  8 |        2 |   116868 |  12384 | CUCUCU                      |
|  9 |        2 |   116868 |    172 | +J{"U":5,"C":7,"N":0,"X":0} |
| 10 |        2 |   116868 |    145 | +J{"U":5,"C":7,"N":0,"X":0} |
+----+----------+----------+--------+-----------------------------+
5 rows in set (0.00 sec)

Note that the update (changing one "U" to a "C") properly updated the aggregate rows.

Diff Detail

Repository
rP Phabricator
Branch
coverage1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 10725
Build 13188: Run Core Tests
Build 13187: arc lint + arc unit

Event Timeline

epriestley retitled this revision from to Aggregate directory coverage after coverage updates.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added reviewers: chad, yelirekim.
chad edited edge metadata.
This revision is now accepted and ready to land.Feb 17 2016, 2:22 AM