Skip to content

Commit

Permalink
bug 1604845: switch to v1 for raw crash key prefix
Browse files Browse the repository at this point in the history
This changes the raw crash key prefix to v1. This is the key structure
we were using back in 2016. It also simplifies keys--they're all v1 now.
  • Loading branch information
willkg committed Sep 7, 2022
1 parent e299273 commit d773188
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 15 deletions.
3 changes: 1 addition & 2 deletions antenna/ext/s3/crashstorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class S3CrashStorage(CrashStorageBase):
<CRASHID>
<DUMPNAME>/
<CRASHID>
v2/
raw_crash/
<YYYYMMDD>/
<CRASHID>
Expand Down Expand Up @@ -65,7 +64,7 @@ def check_health(self, state):
self.connection.check_health(state)

def _get_raw_crash_path(self, crash_id):
return "v2/raw_crash/{date}/{crash_id}".format(
return "v1/raw_crash/{date}/{crash_id}".format(
date=get_date_from_crash_id(crash_id),
crash_id=crash_id,
)
Expand Down
4 changes: 2 additions & 2 deletions docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ AWS S3 file hierarchy
If you use the Amazon Web Services S3 crashstorage component, then crashes get
saved in this hierarchy in the bucket:

* ``/v2/raw_crash/<DATE>/<CRASHID>``
* ``/v1/raw_crash/<DATE>/<CRASHID>``
* ``/v1/dump_names/<CRASHID>``

And then one or more dumps in directories by dump name:
Expand All @@ -237,7 +237,7 @@ For example, a crash with id ``00007bd0-2d1c-4865-af09-80bc00170413`` and
two dumps "upload_file_minidump" and "upload_file_minidump_flash1" gets
these files saved::

v2/raw_crash/20170413/00007bd0-2d1c-4865-af09-80bc00170413
v1/raw_crash/20170413/00007bd0-2d1c-4865-af09-80bc00170413

Raw crash in serialized in JSON.

Expand Down
9 changes: 8 additions & 1 deletion docs/spec_v1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ Which gets converted to a ``raw_crash`` like this::

Which ends up in S3 like this::

v2/raw_crash/20160513/00007bd0-2d1c-4865-af09-80bc02160513
v2/raw_crash/000/20160513/00007bd0-2d1c-4865-af09-80bc02160513

Raw crash in serialized in JSON.

Expand All @@ -221,6 +221,13 @@ Which ends up in S3 like this::
Raw dump.


.. Note::

As of September 2022, the raw_crash is now at::

v1/raw_crash/20160513/00007bd0-2d1c-4865-af09-80bc02160513


HTTP POST request body has previously had problems with null bytes and
non-utf-8 characters. They've taken great pains to make sure it contains
correct utf-8 characters. We still need to do a pass on removing null bytes.
Expand Down
2 changes: 1 addition & 1 deletion systemtest/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def crash_generator():

class CrashVerifier:
def raw_crash_key(self, crash_id):
return "v2/raw_crash/{date}/{crashid}".format(
return "v1/raw_crash/{date}/{crashid}".format(
date="20" + crash_id[-6:], crashid=crash_id
)

Expand Down
12 changes: 6 additions & 6 deletions testlib/mini_poster.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,16 +277,16 @@ def cmdline(args):
logger.info("Adding dump %s -> %s..." % (dump_name, dump_path))
dumps[dump_name] = open(dump_path, "rb").read()

elif "v2" in parsed.raw_crash:
# If there's a 'v2' in the raw_crash filename, then it's probably the
# case that willkg wants all the pieces for a crash he pulled from S3.
# We like willkg, so we'll help him out by doing the legwork.
elif "v1" in parsed.raw_crash:
# If there's a 'v1' in the raw_crash filename, then it's probably the case that
# willkg wants all the pieces for a crash he pulled from S3. We like willkg, so
# we'll help him out by doing the legwork.
raw_crash_path = Path(parsed.raw_crash)
if str(raw_crash_path.parents[3]).endswith("v2"):
if str(raw_crash_path.parents[3]).endswith("v1"):
logger.info("Trying to find dump_names and dumps...")
crashid = str(Path(parsed.raw_crash).name)

# First, raw_crash is ROOT/v2/raw_crash/DATE/CRASHID, so find the root.
# First, raw_crash is ROOT/v1/raw_crash/DATE/CRASHID, so find the root.
root_path = Path(parsed.raw_crash).parents[3]

# First find dump_names which tells us about all the dumps.
Expand Down
6 changes: 3 additions & 3 deletions tests/unittest/test_s3_crashstorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_crash_storage(self, client, s3mock, mock_generate_test_filepath):
s3mock.add_step(
method="PUT",
url=(
"http://fakes3:4569/fakebucket/v2/raw_crash/20160918/"
"http://fakes3:4569/fakebucket/v1/raw_crash/20160918/"
+ "de1bb258-cbbf-4589-a673-34f800160918"
),
# Not going to compare the body here because it's just the raw crash
Expand Down Expand Up @@ -122,7 +122,7 @@ def test_region_and_bucket_with_periods(
s3mock.add_step(
method="PUT",
url=(
"http://fakes3:4569/fakebucket.with.periods/v2/raw_crash/20160918/"
"http://fakes3:4569/fakebucket.with.periods/v1/raw_crash/20160918/"
+ "de1bb258-cbbf-4589-a673-34f800160918"
),
# Not going to compare the body here because it's just the raw crash
Expand Down Expand Up @@ -236,7 +236,7 @@ def test_retrying(self, client, s3mock, caplog, mock_generate_test_filepath):
s3mock.add_step(
method="PUT",
url=(
"http://fakes3:4569/fakebucket/v2/raw_crash/"
"http://fakes3:4569/fakebucket/v1/raw_crash/"
+ "20160918/de1bb258-cbbf-4589-a673-34f800160918"
),
# Not going to compare the body here because it's just the raw crash
Expand Down

0 comments on commit d773188

Please sign in to comment.