Repository navigation
Switch use of md5 hashing to sha256 - #9165
Conversation
Signed-off-by: IvanChalukov <[email protected]>
Signed-off-by: IvanChalukov <[email protected]>
09563ff to
bf1d50b
Compare
Signed-off-by: IvanChalukov <[email protected]>
fedd998 to
d0a15e5
Compare
Kump3r
left a comment
There was a problem hiding this comment.
Tested with a local Concourse and a similar external Postgres database to what @IvanChalukov described. In my case the migration took around ~20min., but in the end I was able to confirm the previous regressions are no longer applicable.
- No new builds were rescheduled with the same versions ✅
- Disabled versions and pinned versions were not duplicated and re-executed. ✅
taylorsilva
left a comment
There was a problem hiding this comment.
Thanks for doing the timing tests guys. I'm going to do some local upgrade/downgrade testing just to see if I can find any other breaking scenarios before approving.
taylorsilva
left a comment
There was a problem hiding this comment.
This LGTM. I was trying to think of versions that might cause key ordering to differ between Go and Postgres again. I made the mock resource output a custom version with this value:
{
"version_one": "first",
"version_two": "second",
"version_three": "third",
"versionOne": "one",
"versionTwo": "two",
"versionThree": "three",
"version-one": "once",
"version-two": "twice",
"version-three": "thrice"
}Go ordered it like this:
version-one once
version-three thrice
version-two twice
versionOne one
versionThree three
versionTwo two
version_one first
version_three third
version_two second
And Postgresql ordered it like this:
{
"versionOne": "one",
"versionTwo": "two",
"version-one": "once",
"version-two": "twice",
"version_one": "first",
"version_two": "second",
"versionThree": "three",
"version-three": "thrice",
"version_three": "third"
}I made a simple pipeline that would trigger on any new versions found.
I docker compose'd what's currently on master, set the pipeline, let the job trigger once with the custom version.
I then switched over to this PR branch, docker compose'd to upgrade my dev instance. No new version was created and the job didn't trigger a second time.
(ignore the errors, they're happening because I'm forcing the mock resource to output a version it doesn't know how to read)
(second row is the relevant version to track. First row is the custom mock resource type I made).
I'm going to leave this PR open for one more week just in case someone can think of something else related to the resource versions that might cause issues. I think the one I thought of is unlike anything the majority of resources would ever output as a version. Hopefully it is edge-case-y enough to give us confidence that this does work now and won't cause a bunch of versions to be recreated.
Thanks for the hard work @IvanChalukov!
|
Following up on the previous conversation in this PR currently marked as resolved: I locally ran a copy of the select count("version") from resource_config_versions where "version" = '{}'::jsonb or "version" IS NULL;
select count("version") from resource_caches rc where "version" = '{}'::jsonb or "version" is NULL;I'm going to make a call out to the community to run the above query to see if this is also the case for others or if Pix4D's case is more common. Since I had a local copy of our prod db, I ran the migration just to get a sense of how long it might take to run in prod and got a 6min runtime. This is on an M1 macbook pro with 32GB ram, running Postgres 17 natively (not in docker). |
|
@IvanChalukov Based on the data so far from https://github.com/orgs/concourse/discussions/9265 it looks like empty versions I think these empty versions must come from custom resources. I modified the
resource_types:
- name: mock-empty
type: registry-image
source:
repository: concourseteam/mock-resource
tag: empty-version
resources:
- name: mock
type: mock-empty
jobs:
- name: job
plan:
- get: mock
This is probably something we shouldn't allow. I'll open a separate issue for that. Anyways, what happens when we upgrade a db running Concourse 7.14 to Then I upgraded it the latest code on Empty versions are not recalculated, as previously stated in prior comments. I've also just discovered another issue related to 7.14. The latest migration number comes after the one in this PR: Which currently causes upgrades to fail. Action ItemsBased on the above, the following work needs to be done:
|
@taylorsilva does this mean that people who deployed v7.14.X all have this issue with migration history and that you will have to release v7.14.2? or that happened only in your experiment because you first deployed the master? |
No it means that in master the md5_sha256 migration needs to come after the other, since it uses timestamp names to schedule the order of migrations, but due to the older migration still not being released it needs to be renamed. |
|
What Kalin said! There will be no issue for users, this was only an issue present on |
|
👋 Hi folks -- not following all of this, but I see that in this thread there was possibly some concern that these changes could cause builds to be incorrectly re-run, I thought I'd add some anecdotal data: we just upgraded to 8.0.0 and it looks like we had re-runs for jobs that triggered off of the gcs-resource. That is, it looks like after our deployment we had two jobs get triggered by inputs that we had already processed. I'm not really up-to-speed on how version-ing etc works with resources so my statement might appear nonsensical, apologies. I see two jobs where this has happened (both related to gcs-resource). Those two jobs do not have a "version" (maybe?? I'm not sure if the "version" returned as part of the resource There are another few jobs that use the gcs-resource that didn't re-trigger and they did have a regex set and thus had a After reading more of the gcs-resource README I think the "why didn't it change previously" makes more sense to me: "Objects will be found via the pattern configured by regexp or versioned_file. The versions will be used to order them (using semver). Each object's filename is the resulting version." The filename would never have changed in this case. Doesn't necessarily explain why it triggered now, but maybe that comes down to the hash approach changing? I dunno. It's not that big of a deal for us, but maybe I'll come back if we see future triggering fail for some reason. No request for action, just noting this in case someone else shows up having observed similar behavior looking for anecdotes. |
|
We did find issues related to jobs re-running or not running at all with versions they previously ran with. Thanks for trying to explain your situation. It sounds like there may have been a bug of some kind but there's not enough info for me to speculate. As you said, you don't fully get how the resource versioning stuff works, so maybe things are behaving as expected? @ragaskar And highlight the jobs that got re-run. Then on the build logs for that job, if you could show the If the |







Changes proposed by this PR
Related to #9021 and #9133
closes #9122
FIPS-compliant PostgreSQL instances restrict the use of
md5hashing, requiring a transition tosha256. To accommodate this, a migration has been implemented to convert all existingmd5hashes in the affected tables tosha256. For large databases, this process may take some time to complete.Notes to reviewer
Results from tests on highly loaded database:
Setup
db.t4g.xlargeData
Migration was done in ~19 mins.
Release Note