Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup duplicate pods #8403

Conversation

SuperTux88
Copy link
Member

There were already attempts to remove duplicates in the past ... but the unique index doesn't work with NULL ports, which is used for when a default port is used (80 or 443) ... which is almost every pod. PostgreSQL >= 15 would now have an index that also handles NULL values correctly (with NULLS NOT DISTINCT), but not all podmins have PostgreSQL 15 yet and there is also still MySQL which has the same problem.

So I now use -1 as value for when a default port is used, as this also works with unique indexes everywhere, and I didn't find a better solution that works with MySQL. We maybe can revert that back to nil once we drop MySQL (or even drop PostgreSQL < 15). I thought about using the actual port (80/443), but then we have the problem that it a pod could exist with both of them, that's why I rejected this idea again.

There were also duplicates because the hostname wasn't normalized to lowercase, so the same hostname with mixed case could exist multiple times, so I also fixed that as a drive-by.

If pods use a non-default port I also added the port in the overview, so two pods with different pods don't look like duplicates.

The unique index doesn't work when the port is `NULL`. So use `-1`
instead for when using the default ports (80/443), as if we would use
the real ports, we could still have both 80 and 443 in the database at
the same time.
otherwise pods can exist multiple times with mixed case
otherwise pods with different ports (or without port) all look the same,
like if they are duplicates
@SuperTux88 SuperTux88 added this to the 1.0.0 milestone Oct 31, 2022
Copy link
Member

@denschub denschub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a reasonable workaround to me.

@SuperTux88 SuperTux88 merged commit 80c0888 into diaspora:develop Nov 1, 2022
@SuperTux88 SuperTux88 deleted the cleanup-duplicate-pods-for-real-this-time branch November 1, 2022 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants