Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-18-2012, 11:12 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default BIGINT UNSIGNED value is out of range error

I just got the following error while deleting a thread:

Code:
Database error in vBulletin 4.1.12:

Invalid SQL:
UPDATE user SET
	totalwords = totalwords - 6
WHERE userid = 61;

MySQL Error   : BIGINT UNSIGNED value is out of range in '(`xxxxx_xxxxxxxxx`.`user`.`totalwords` - 6)'
Error Number  : 1690
Request Date  : Friday, May 18th 2012 @ 07:49:07 AM
Error Date    : Friday, May 18th 2012 @ 07:49:07 AM
Script        : http://www.iamgrumpy.com/forums/postings.php?do=dodeletethread&threadid=362
Referrer      : http://www.iamgrumpy.com/forums/postings.php
IP Address    : xxx.xx.xx.xxx
Username      : Boofo
Classname     : vB_Database
MySQL Version : 5.5.22-cll

It has to do with the following code but I'm not sure how to fix it. I have never run into this error before.

Hook: threaddata_delete
Code:
if ($physicaldel)
{
    $threadinfo = fetch_threadinfo($threadid);
    $postinfo = fetch_postinfo($threadinfo['firstpostid']);
    $userdm =& datamanager_init('User', $this->registry, ERRTYPE_SILENT);
    $userdm->set_existing($postinfo);
    $userdm->set('totalwords', 'totalwords - ' . str_word_count($postinfo['pagetext']), false);
    $userdm->save();
    unset($userdm);

    $posts = $this->dbobject->query_read("
        SELECT post.postid
        FROM " . TABLE_PREFIX . "post AS post
        WHERE post.threadid = $threadid
    ");

    while ($post = $this->dbobject->fetch_array($posts))
    {
        $postinfo = fetch_postinfo($post['postid']);
        $userdm =& datamanager_init('User', $this->registry, ERRTYPE_SILENT);
        $userdm->set_existing($postinfo);
        $userdm->set('totalwords', 'totalwords - ' . str_word_count($postinfo['pagetext']), false);
        $userdm->save();
        unset($userdm);
    }
}

Does anyone see what I am missing there?
Reply With Quote
  #2  
Old 05-18-2012, 12:55 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well the error means that its trying to subtract 6 from a value that is actually less than 6 to start with.

I'd be a lot more worried about what that code is actually doing, it looks like its running updates on user records for every post in a thread, so if your thread has 4000 posts, thats 4000 updates !

In fact, since its running one query to get all the postids, and then looping round them using fetch_postinfo(), its quite likely most of the posts dont exist in the postcache, so its also running individual queries to get each post, potentially another 4000. :erm:
Reply With Quote
  #3  
Old 05-18-2012, 01:11 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, Paul, for the quick response.

What it is doing is going through each post in the thread and subtracting the amount of words each user has posted in the thread and adjusting their total word count. I agree that a very large thread would be very resource intensive, but I only have a really small site so there is no real way of testing that issue. Is there a better way you run that and account for situation like this in the future? I *think* it is somehow subtracting the thread title word count too and that would account for the negative number.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:47 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03343 seconds
  • Memory Usage 2,181KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete