Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: bultza on May 08, 2011, 03:40:30 PM

Title: Bug in smf_log_notify when upgrading from 1.1.13 to 2.0RC5
Post by: bultza on May 08, 2011, 03:40:30 PM
Hello all, we upgraded from 1.1.13 to 2.0.RC5 and we had lots of problems with the log_notify table.

The user that was replying to a thread that was already following with notification was being subscribed to be notified once more. So If I was replying 10 times in a thread, I was being notified with 10 emails. I could not find that anyone else experienced with this problem.

My solution was to drop the table smf_log_notify and put a new one from the 2.0 empty structure. You can see the differences in the code and the source of the error:

Old table with the bug:

CREATE TABLE IF NOT EXISTS `smf_log_notify` (
  `id_member` mediumint(8) unsigned NOT NULL default '0',
  `id_topic` mediumint(8) unsigned NOT NULL default '0',
  `id_board` smallint(5) unsigned NOT NULL default '0',
  `sent` tinyint(1) unsigned NOT NULL default '0',
  KEY `id_topic` (`id_topic`,`id_member`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


New fixed code

Regards
CREATE TABLE IF NOT EXISTS `smf_log_notify` (
  `id_member` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `id_topic` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `id_board` smallint(5) unsigned NOT NULL DEFAULT '0',
  `sent` tinyint(1) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id_member`,`id_topic`,`id_board`),
  KEY `id_topic` (`id_topic`,`id_member`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

Somehow during the upgrade, this was not included in the table: 
PRIMARY KEY (`id_member`,`id_topic`,`id_board`),

I saw that when directly upgraded, this table had thousands of duplications, so maybe that is the reason that the new feature "Primar key" did not work out during the upgrade.

I hope this is usefull for other people.
Title: Re: Bug in smf_log_notify when upgrading from 1.1.13 to 2.0RC5
Post by: bultza on May 10, 2011, 11:53:11 AM
The error might be in the "large upgrade" file.
File: upgrade_2-0_mysql.sql
After line 832 Add:

ALTER TABLE {$db_prefix}log_notify
ADD PRIMARY KEY (id_member, id_topic, id_board);


But I might be wrong as I did not test it, be carefull in testing that as you might corrupt the installation.

Anyway, not sure if anyone is really interested
Title: Re: Bug in smf_log_notify when upgrading from 1.1.13 to 2.0RC5
Post by: Storman™ on May 10, 2011, 12:45:04 PM
It's an interesting point.

However, if it's a bug then shouldn't the post be in the Bug Reports section for investigation :

http://www.simplemachines.org/community/index.php?board=137.0

;)
Title: Re: Bug in smf_log_notify when upgrading from 1.1.13 to 2.0RC5
Post by: bultza on May 11, 2011, 07:53:12 AM
Thanks Storman, I reposted it in the forum you indicated so if a moderator can delete this topic here would be nice and tidy ;)
Title: Re: Bug in smf_log_notify when upgrading from 1.1.13 to 2.0RC5
Post by: Aleksi "Lex" Kilpinen on May 11, 2011, 08:19:52 AM
Let's do the other way around. I'll move this and delete the other.
Title: Re: Bug in smf_log_notify when upgrading from 1.1.13 to 2.0RC5
Post by: Illori on November 18, 2011, 09:02:44 AM
is this still an issue?