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

Support Ubuntu 20.04 and MySQL 8 #2856

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Support Ubuntu 20.04 and MySQL 8 #2856

wants to merge 2 commits into from

Conversation

zorkian
Copy link
Member

@zorkian zorkian commented Jan 23, 2021

This modernizes a few things to support more recent versions of MySQL
and Ubuntu. DO NOT RUN IN PRODUCTION YET.

@@ -144,7 +144,9 @@ sub db_quote {
print "Dumping proplists.dat\n";
open( my $plg, ">$ENV{LJHOME}/bin/upgrading/proplists.dat" ) or die;
open( my $pll, ">$ENV{LJHOME}/bin/upgrading/proplists-local.dat" ) or die;
foreach my $table ( 'userproplist', 'talkproplist', 'logproplist', 'usermsgproplist' ) {
foreach my $table ( 'userproplist', 'talkproplist', 'logproplist', 'usermsgproplist',
'media_prop_list' )
Copy link
Member Author

Choose a reason for hiding this comment

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

oops forgot this a long time ago ...

@@ -181,7 +183,7 @@ sub db_quote {
# and dump mood info
print "Dumping moods.dat\n";
open( F, ">$ENV{'LJHOME'}/bin/upgrading/moods.dat" ) or die;
$sth = $dbh->prepare("SELECT moodid, mood, parentmood FROM moods ORDER BY moodid");
$sth = $dbh->prepare("SELECT moodid, mood, parentmood, weight FROM moods ORDER BY moodid");
Copy link
Member Author

Choose a reason for hiding this comment

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

don't know when this became a thing, but moods.dat contains it so we should dump it.

@@ -0,0 +1,19 @@
#!/usr/bin/perl

use strict;
Copy link
Member Author

Choose a reason for hiding this comment

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

dumb script for regenerating update-db-general.pl

@@ -130,760 +130,6 @@ MOOD 131 thankful 15 80
MOOD 132 grateful 15 85
Copy link
Member Author

Choose a reason for hiding this comment

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

This file was re-dumped, which put things in order...

@@ -62,14 +62,6 @@ userproplist.city:
multihomed: 0
Copy link
Member Author

Choose a reason for hiding this comment

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

Should be no actual changes to this file, but I re-dumped it so everything is ordered now instead of just manually updated lol.

@@ -18,4190 +18,2655 @@

mark_clustered(@LJ::USER_TABLES);

register_tablecreate( "vgift_ids", <<'EOC');
Copy link
Member Author

Choose a reason for hiding this comment

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

This file has been cleanly dumped from an updated database, using MySQL 8. This basically compacts all of the alters so they're gone, which means that it should be much easier to reason about what's in the db.

@@ -67,7 +67,7 @@ sub check {
}
else {
my $dbh = LJ::get_db_writer();
my $rv = $dbh->do( q{SELECT GET_LOCK(?,5)}, undef, $chal );
Copy link
Member Author

Choose a reason for hiding this comment

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

64 character limit on lock names now. Hacky easy way to do that.

@@ -71,7 +71,7 @@ sub save {

my $u = LJ::want_user( $opts{user} ) or return;
my $id = LJ::alloc_user_counter( $u, 'V' ) or return;
my $secs = $opts{time} || localtime;
Copy link
Member Author

Choose a reason for hiding this comment

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

Was trying to insert 'Sat Jan 23...' string into the int field expecting an epoch time.

@@ -260,14 +260,7 @@ no strict "vars";
# 'type' is used as 'type' attribute value in 'codes' table
# 'save_region_code' specifies what to save in 'state' userprop -
# '1' mean save short region code and '0' - save full region name
%LJ::COUNTRIES_WITH_REGIONS = (
Copy link
Member Author

Choose a reason for hiding this comment

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

I killed RU here because... we don't do it for Canada, so whatever. (And inserting the plain RU states was causing the strict mode SQL to be angry since it's not latin1.)

@@ -75,9 +75,9 @@ sub create {
my $dbh = LJ::get_db_writer();

$dbh->do(
'INSERT INTO user (user, clusterid, dversion, caps, journaltype) '
Copy link
Member Author

Choose a reason for hiding this comment

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

Strict mode fix, name field is required.


if ( ref $ban_u eq 'ARRAY' ) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Make this function take user objects or ids, because there are callers that do both.

libio-aio-perl
libssl-dev
apache2
compass-blueprint-plugin
Copy link
Member Author

Choose a reason for hiding this comment

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

This was ruby-compass, it got renamed. Only change from 18.04 list.

@@ -36,7 +36,7 @@ my $run = sub {

# FIXME: make this neater.
ok( $run->("moodtheme_list") =~ "Kanji Moods", "Got public theme" );
ok( $run->("moodtheme_list 1") =~ "18x18 /img/mood/kanji/crazy.gif", "Got a theme" );
Copy link
Member Author

Choose a reason for hiding this comment

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

With the re-dumping of moods.dat, the Kanji Moods is #11 now in a fresh db. Won't matter for old dbs.

@@ -48,9 +48,6 @@ note("Not logged in - init");
# user
ok( !$vars->{remote} );

# icon
Copy link
Member Author

Choose a reason for hiding this comment

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

Icons were removed by @momijizukamori but the test still expected them, so just removed that.

@@ -31,14 +31,6 @@ my $ICON1 = do { local $/; <$fh> };
open( my $fh2, 'good.jpg' ) or die $!;
my $ICON2 = do { local $/; <$fh2> };

note("called with falsy or undefined user object");
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know why this test, and it fails in Perl 5.30, so I removed it. But LMK if I'm missing something @nfagerlund !

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, that broke when Ruth changed that from a standalone function that takes a user as an argument to a method on a user object -- can't call methods on undef. I think this is a merge conflict now because I noticed that in one of those post-code-push PRs and removed it there.

This modernizes a few things to support more recent versions of MySQL
and Ubuntu. DO NOT RUN IN PRODUCTION YET.

The has_subs table is unused
Remove unused tables subsprop, subsproplist
Using $u->prepare and $sth->execute doesn't set the _dberr on the user,
so calling $u->err would never work. Needs to use $u->do.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants