Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit 1ad3c69

Browse files
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. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@260837 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 5097a99 commit 1ad3c69

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

Tools/ChangeLog

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
2020-04-28 Jonathan Bedard <[email protected]>
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+
120
2020-04-28 Claudio Saavedra <[email protected]>
221

322
[Linux] Replace --geometry with --fullscreen when using MiniBrowser for WebDriver tests

Tools/resultsdbpy/resultsdbpy/model/upload_context.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ class SuitesByConfiguration(ClusteredByConfiguration):
4747
suite = columns.Text(primary_key=True, required=True)
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)
5354
branch = columns.Text(partition_key=True, required=True)
@@ -67,6 +68,26 @@ def unpack(self):
6768
version=self.upload_version,
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
7293
self.configuration_context = configuration_context
@@ -75,6 +96,7 @@ def __init__(self, configuration_context, commit_context, ttl_seconds=None, asyn
7596
self._process_upload_callbacks = defaultdict(dict)
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

80102
self._async_processing = async_processing
@@ -252,6 +274,15 @@ def find_test_results(self, configurations, suite, branch=None, begin=None, end=
252274
with self:
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,
257288
suite=suite, sdk=configuration.sdk, branch=branch or self.commit_context.DEFAULT_BRANCH_KEY,

0 commit comments

Comments
 (0)