Cause for Drupal node.Auto_increment field jump to the hundred millions (from half a million)?
The nid field on my Drupal node table jumped from from 254,107 to 500,220,117. What could have caused that? I haven't messed up with the Auto_increment field.
I see very little leeway in the drupal_write_record and node_save function calls for any kind human errors that could cause this nid jump, node_save what accepts as an argument is a node object.
Could a badly built node object cause a jump in the Auto_increment field? i.e. that for some sort of weird bug the code switches the nid field with something else before passing it to node_save? If this were true, the bug would be in the code preceding the node_save, but it could also be inside a rougue hook_invoke_nodeapi, since node_save() calls this snippet at the beginning of the function:
// Let modules modify the node before it is saved to the database.
node_invoke_nodeapi($node, 'presave');
How would you go about setting a test for detecting this?
I will probably set up an exotic conditional breakpoint (or a couple of them) within node_save(), and particularly on the last line of db_query(). In db_query() the breakpoint will most likely contain a regular expression. Then I could set some sort of automated test that sav开发者_如何学Goes all kinds of node types into the database (thinking about the devel module) and see if something appears. If I find anything I will answer myself the question, unless someone else had a similar experience in the past and answers first.
Yeah, we can't know without more information. What Drupal uses for it's sequencing depends on the version you are using. See this for more info.
精彩评论