vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Forum and Server Management (https://vborg.vbsupport.ru/forumdisplay.php?f=232)
-   -   Fixing Haywire Post Table Auto-Increment Value (https://vborg.vbsupport.ru/showthread.php?t=189341)

Eikinskjaldi 08-28-2008 05:12 AM

Fixing Haywire Post Table Auto-Increment Value
 
For some odd reason, my auto-increment value for the post table is in the billions, instead of the millions where it belongs. While this isn't a problem right now, when it gets higher I can see it posing some real issues.

I'm trying to think of ways to get all the (16k) posts that are at or above that auto-increment value back down to where they belong, and hunting through the db for all the places postid might live sounds like a bad idea.

Is it possible to use impex to export the posts, so that I can reset the auto-increment value, and then import the posts again at their proper place?

Marco van Herwaarden 08-28-2008 05:35 AM

ImpEx will renumber id's, so yes you could use this.

But what is the reason that this happened? Can you give some real example values.

Eikinskjaldi 08-28-2008 06:20 AM

Awesome, thank you.

I'm actually ignorant as to why it happened, but the post auto-increment value was at over 1.2 million and is now far higher. I couldn't say if it has to do with vBulletin or not, but we have had some odd server issues recently that have been thrashing mysql that are likely to blame.

Code:

mysql> select postid from post where postid > 1254039 limit 4;
+------------+
| postid    |
+------------+
|    1254040 |
| 1059793148 |
| 1059793149 |
| 1059793150 |
+------------+


Marco van Herwaarden 08-28-2008 06:40 AM

If there are only 3 posts with such a high value, then i would consider deleting these 3 and reset the auto increment value to highest value +1.

Eikinskjaldi 08-28-2008 09:20 PM

Notice the 'limit 4' :)

As I said in the original post, there are no probably around 20k at that high value.

Marco van Herwaarden 08-29-2008 05:32 AM

Missed that limit.

I would just let it go then. The maximum value for this column is 4294967295, so this will still leave you a lot of values left.

Eikinskjaldi 09-01-2008 12:19 AM

Quote:

Originally Posted by Marco van Herwaarden (Post 1609651)
Missed that limit.

I would just let it go then. The maximum value for this column is 4294967295, so this will still leave you a lot of values left.

For those that care, I didn't go with the leave it alone option because if it happens 3 more times, all of a sudden I am at that limit.

What I did was
take a content-less dump (i.e. a db schema) of vbulletin
grep for postid (which included lastpostid and other similar fields)
determined the offset
ran update table set postfield=postfield-offset where postfield > jumpvalue
alter table post auto_increment = newvalue

It seems to have done the trick.

All steps were fast, except the alter table which needed 10 minutes of re-indexing.

Marco van Herwaarden 09-01-2008 04:37 AM

I hope you are aware that the postid is also referenced on other places.


All times are GMT. The time now is 05:00 PM.

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.01774 seconds
  • Memory Usage 1,725KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete