Changeset 260837 in webkit


Ignore:
Timestamp:
Apr 28, 2020 12:02:53 PM (4 years ago)
Author:
Jonathan Bedard
Message:

results.webkit.org: A suite running multiple times in a commit for a single configuration may overwrite upload metadata
https://bugs.webkit.org/show_bug.cgi?id=211097
<rdar://problem/62474538>

Rubber-stamped by Aakash Jain.

Create a new table for uploads which is indexed by both uuid and timestamp so that uploads which share
a configuration and uuid but not a timestamp do not collide.

  • resultsdbpy/resultsdbpy/model/upload_context.py:

(UploadContext):
(UploadContext.UploadsByConfigurationLegacy): Renamed from UploadContext.UploadsByConfiguration.
(UploadContext.UploadsByConfiguration): New database table indexed by both timestamp and uuid.
(UploadContext.UploadsByConfiguration.unpack):
(UploadContext.init):
(UploadContext.find_test_results): Search both versions of the UploadsByConfiguration table.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r260825 r260837  
     12020-04-28  Jonathan Bedard  <jbedard@apple.com>
     2
     3        results.webkit.org: A suite running multiple times in a commit for a single configuration may overwrite upload metadata
     4        https://bugs.webkit.org/show_bug.cgi?id=211097
     5        <rdar://problem/62474538>
     6
     7        Rubber-stamped by Aakash Jain.
     8
     9        Create a new table for uploads which is indexed by both uuid and timestamp so that uploads which share
     10        a configuration and uuid but not a timestamp do not collide.
     11
     12        * resultsdbpy/resultsdbpy/model/upload_context.py:
     13        (UploadContext):
     14        (UploadContext.UploadsByConfigurationLegacy): Renamed from UploadContext.UploadsByConfiguration.
     15        (UploadContext.UploadsByConfiguration): New database table indexed by both timestamp and uuid.
     16        (UploadContext.UploadsByConfiguration.unpack):
     17        (UploadContext.__init__):
     18        (UploadContext.find_test_results): Search both versions of the UploadsByConfiguration table.
     19
    1202020-04-28  Claudio Saavedra  <csaavedra@igalia.com>
    221
  • trunk/Tools/resultsdbpy/resultsdbpy/model/upload_context.py

    r260796 r260837  
    4848        branch = columns.Text(primary_key=True, required=True)
    4949
    50     class UploadsByConfiguration(ClusteredByConfiguration):
     50    # FIXME: Remove the UploadsByConfigurationLegacy once results in it are sufficently old in Spring 2021
     51    class UploadsByConfigurationLegacy(ClusteredByConfiguration):
    5152        __table_name__ = 'uploads_by_configuration_01'
    5253        suite = columns.Text(partition_key=True, required=True)
     
    6869            )
    6970
     71    class UploadsByConfiguration(ClusteredByConfiguration):
     72        __table_name__ = 'uploads_by_configuration_02'
     73        suite = columns.Text(partition_key=True, required=True)
     74        branch = columns.Text(partition_key=True, required=True)
     75        uuid = columns.BigInt(primary_key=True, required=True, clustering_order='DESC')
     76        time_uploaded = columns.DateTime(primary_key=True, required=True)
     77        sdk = columns.Text(primary_key=True, required=True)
     78        commits = columns.Blob(required=True)
     79        test_results = columns.Blob(required=True)
     80        upload_version = columns.Integer(required=True)
     81
     82        def unpack(self):
     83            return dict(
     84                commits=[Commit.from_json(element) for element in json.loads(UploadContext.from_zip(bytearray(self.commits)))],
     85                sdk=None if self.sdk == '?' else self.sdk,
     86                test_results=json.loads(UploadContext.from_zip(bytearray(self.test_results))),
     87                timestamp=calendar.timegm(self.time_uploaded.timetuple()),
     88                version=self.upload_version,
     89            )
     90
    7091    def __init__(self, configuration_context, commit_context, ttl_seconds=None, async_processing=False):
    7192        self.ttl_seconds = ttl_seconds
     
    7697        with self:
    7798            self.cassandra.create_table(self.SuitesByConfiguration)
     99            self.cassandra.create_table(self.UploadsByConfigurationLegacy)
    78100            self.cassandra.create_table(self.UploadsByConfiguration)
    79101
     
    253275            result = {}
    254276            for configuration in configurations:
     277                # FIXME: Remove the UploadsByConfigurationLegacy once results in it are sufficently old in Spring 2021
     278                # We don't need to ignore duplicates because we never reported to both databases
     279                result.update({config: [value.unpack() for value in values] for config, values in self.configuration_context.select_from_table_with_configurations(
     280                    self.UploadsByConfigurationLegacy.__table_name__, configurations=[configuration], recent=recent,
     281                    suite=suite, sdk=configuration.sdk, branch=branch or self.commit_context.DEFAULT_BRANCH_KEY,
     282                    uuid__gte=CommitContext.convert_to_uuid(begin),
     283                    uuid__lte=CommitContext.convert_to_uuid(end, CommitContext.timestamp_to_uuid()), limit=limit,
     284                ).items()})
     285
    255286                result.update({config: [value.unpack() for value in values] for config, values in self.configuration_context.select_from_table_with_configurations(
    256287                    self.UploadsByConfiguration.__table_name__, configurations=[configuration], recent=recent,
Note: See TracChangeset for help on using the changeset viewer.