Bug 230839 - PCM: different bundleID entries will override each other
Summary: PCM: different bundleID entries will override each other
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kate Cheney
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-09-27 08:49 PDT by Kate Cheney
Modified: 2021-09-28 16:49 PDT (History)
2 users (show)

See Also:


Attachments
Patch (26.42 KB, patch)
2021-09-27 09:02 PDT, Kate Cheney
no flags Details | Formatted Diff | Diff
Patch (38.45 KB, patch)
2021-09-27 13:24 PDT, Kate Cheney
no flags Details | Formatted Diff | Diff
Patch for landing (38.45 KB, patch)
2021-09-27 15:48 PDT, Kate Cheney
no flags Details | Formatted Diff | Diff
Patch (37.70 KB, patch)
2021-09-27 21:28 PDT, Kate Cheney
no flags Details | Formatted Diff | Diff
Patch (37.71 KB, patch)
2021-09-28 13:30 PDT, Kate Cheney
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kate Cheney 2021-09-27 08:49:57 PDT
We should make bundleID a part of the unique constraint of PCM tables.
Comment 1 Radar WebKit Bug Importer 2021-09-27 08:50:27 PDT
<rdar://problem/83575086>
Comment 2 Kate Cheney 2021-09-27 09:02:57 PDT
Created attachment 439357 [details]
Patch
Comment 3 Kate Cheney 2021-09-27 13:24:20 PDT
Created attachment 439387 [details]
Patch
Comment 4 Alex Christensen 2021-09-27 14:11:17 PDT
Comment on attachment 439387 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=439387&action=review

> Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:276
> +const Vector<String>& ResourceLoadStatisticsDatabaseStore::sortedTables()

This could be a std::array, which would not require any dynamic allocation.

> Source/WebKit/NetworkProcess/DatabaseUtilities.cpp:199
> +        RELEASE_LOG_ERROR(Network, "%p - ResourceLoadStatisticsDatabaseStore::currentTableAndIndexQueries Unable to prepare statement to fetch schema for the table, error message: %" PRIVATE_LOG_STRING, this, m_database.lastErrorMsg());

DatabaseUtilities::
Also, I've been using the PrivateClickMeasurement logging channel in this file even though it's shared with RLS.  Network isn't a great channel for this.
Ditto several times below.

> Source/WebKit/NetworkProcess/DatabaseUtilities.h:43
> +typedef std::pair<String, std::optional<String>> TableAndIndexPair;

using TableAndIndexPair = std::pair<String, std::optional<String>>;
Comment 5 Kate Cheney 2021-09-27 15:48:11 PDT
Created attachment 439404 [details]
Patch for landing
Comment 6 Kate Cheney 2021-09-27 15:49:10 PDT
(In reply to Alex Christensen from comment #4)
> Comment on attachment 439387 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=439387&action=review
> 
> > Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:276
> > +const Vector<String>& ResourceLoadStatisticsDatabaseStore::sortedTables()
> 
> This could be a std::array, which would not require any dynamic allocation.
> 

Did not do this because the function is virtual.

> > Source/WebKit/NetworkProcess/DatabaseUtilities.cpp:199
> > +        RELEASE_LOG_ERROR(Network, "%p - ResourceLoadStatisticsDatabaseStore::currentTableAndIndexQueries Unable to prepare statement to fetch schema for the table, error message: %" PRIVATE_LOG_STRING, this, m_database.lastErrorMsg());
> 
> DatabaseUtilities::
> Also, I've been using the PrivateClickMeasurement logging channel in this
> file even though it's shared with RLS.  Network isn't a great channel for
> this.
> Ditto several times below.
> 

Fixed.

> > Source/WebKit/NetworkProcess/DatabaseUtilities.h:43
> > +typedef std::pair<String, std::optional<String>> TableAndIndexPair;
> 
> using TableAndIndexPair = std::pair<String, std::optional<String>>;

Fixed.
Comment 7 Kate Cheney 2021-09-27 17:39:15 PDT
Comment on attachment 439404 [details]
Patch for landing

Cancelling commit queue to investigate failure.
Comment 8 EWS 2021-09-27 18:35:38 PDT
Found 1 new test failure: http/tests/privateClickMeasurement/expired-attribution-report-gets-sent-on-session-start.html
Comment 9 Kate Cheney 2021-09-27 21:28:28 PDT
Created attachment 439431 [details]
Patch
Comment 10 Kate Cheney 2021-09-28 13:30:21 PDT
Created attachment 439511 [details]
Patch
Comment 11 Kate Cheney 2021-09-28 13:33:13 PDT
Changed REFERENCES ObservedDomains(domainID) ON DELETE CASCADE -> REFERENCES PCMObservedDomains(domainID) ON DELETE CASCADE in the test case. This was causing a false positive pass. Now this test will fail without the accompanying changes.
Comment 12 EWS 2021-09-28 14:13:08 PDT
Committed r283194 (242241@main): <https://commits.webkit.org/242241@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 439511 [details].