Apache can return a corrupt manifest file while ManifestGenerator::store is running
authordewei_zhu@apple.com <dewei_zhu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Sep 2018 05:12:13 +0000 (05:12 +0000)
committerdewei_zhu@apple.com <dewei_zhu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Sep 2018 05:12:13 +0000 (05:12 +0000)
commita239b33d55d6ff4f55a337e465563642e469c939
tree9fd4d437c723cfdde98e58d1f08635603aad10cf
parent8d5681699b141ec7d6ba051861d0b6f4f3fa4a53
Apache can return a corrupt manifest file while ManifestGenerator::store is running
https://bugs.webkit.org/show_bug.cgi?id=189822

Reviewed by Ryosuke Niwa.

Updating a file on performance dashboard should be transactional between php and apache.
Otherwise, partial content may be served.

* public/api/measurement-set.php: Adapted invocation of 'generate_json_date_with_elapsed_time_if_needed'.
* public/api/runs.php: Adapted invocation of 'generate_json_date_with_elapsed_time_if_needed'.
* public/include/db.php: Make creating file transactionaly by taking advantage of
'move/rename' operation is atomic in OS.
Added logic to avoid overwriting file if all content except specified filed are identical.
* public/include/json-header.php: Added a helper function that added 'status' but does not
convert content to json.
* public/include/manifest-generator.php: Adapted invocation of 'generate_json_date_with_elapsed_time_if_needed'.
* public/shared/statistics.js: Removed unnecessary logging.
(Statistics.new.sampleMeanAndVarianceFromMultipleSamples):
* server-tests/api-manifest-tests.js: Updated one unit test.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236454 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Websites/perf.webkit.org/ChangeLog
Websites/perf.webkit.org/public/api/measurement-set.php
Websites/perf.webkit.org/public/api/runs.php
Websites/perf.webkit.org/public/include/db.php
Websites/perf.webkit.org/public/include/json-header.php
Websites/perf.webkit.org/public/include/manifest-generator.php
Websites/perf.webkit.org/public/shared/statistics.js
Websites/perf.webkit.org/server-tests/api-manifest-tests.js