Error appears during "Rebuilding Views Natural Sort Indexing Entries" process.

An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=266&op=do StatusText: error ResponseText: PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'eid' in 'where clause': SELECT 1 AS expression FROM {views_natural_sort} views_natural_sort WHERE ( (eid = :db_condition_placeholder_0) AND (entity_type = :db_condition_placeholder_1) AND (field = :db_condition_placeholder_2) AND (delta = :db_condition_placeholder_3) ) FOR UPDATE; Array ( [:db_condition_placeholder_0] => 9 [:db_condition_placeholder_1] => node [:db_condition_placeholder_2] => field_customer [:db_condition_placeholder_3] => 0 ) in views_natural_sort_store() (line 81 of /drupal/sites/all/modules/contrib/views_natural_sort/views_natural_sort.module).

Comments

Chris Charlton’s picture

Issue tags: +database

This may be related to another error I'm getting:
Notice: Undefined index: views_natural_sort_enable_sort in views_natural_sort_text_field_get_configured_fields() (line 97 of /drupal/sites/all/modules/contrib/views_natural_sort/views_natural_sort_text_field.module).

generalredneck’s picture

It sounds like you may be running on the old database schema from the 1.4 module... Did you run updatedb after you installed the alpha module or did you install the alpha module right out?

Maybe you can give me some more information on the events leading up to you encountering the bug.

As for the issues in Comment #1, This means that the checkbox in the field settings has never been checked... I may have forgotten to handle the case of you creating the field before installing the module.

generalredneck’s picture

Another thing that might help me out is if you would give me a dump of the views_natural_sort table... Obviously it's not in the right state it should be for the Alpha

Chris Charlton’s picture

I think you're right about the schema from version 1.4 not being purged from the db upon uninstall. That seems to be a separate issue, but definitely related... which explains why I may be getting this error as well:
DatabaseSchemaObjectExistsException: Table <em class="placeholder">views_natural_sort</em> already exists. in DatabaseSchema->createTable() (line 657 of /drupal/includes/database/schema.inc).

Chris Charlton’s picture

So far dropping the 'views_natural_sort' table manually (again, I came from the 1.4 branch to 2.x) seems to resolve the primary error on this ticket.

generalredneck’s picture

That's odd that a full uninstall didn't purge the database because Drupal should take care of that automatically. If you just did a disable, then it wouldn't have did it though...

You have to first disable the module then either run drush pm-uninstall views_natural_sort or goto the Uninstall tab on the modules page to uninstall it.

Are you sure you completed those steps?

Chris Charlton’s picture

I totally disabled before uninstalling. I tried Drush and then after I got frustrated I tried the module UI, both did not trash the schema table defined in the .install file. I've seen this happen before, but I remember it during the D7 beta days, so I'm puzzled why this would still be happening today.

I generated a separate ticket for the db table issue: https://drupal.org/node/1995036

generalredneck’s picture

Status: Active » Closed (cannot reproduce)

I just tried to go back and recreate this issue. These are the steps I performed:

verified that the table was not there
installed & enabled the 1.4 version of the module
verified that the table was there.
indexed all my nodes
verified the table had data
installed the new 7.x-2.0-alpha1 version
drush updatedb -y
verfied that the table had been updated
rebuilt the indexes. (this failed because of #1906740: Fatal Error: function dvm() not found)

I don't know man... something is odd here... but I can't reproduce it.

We can reopen this if we reproduce the issue.

giuvax’s picture

Issue summary: View changes

I just enabled the module and went check the 'enable natural sort' for the field I needed to be indexed. And I got this error. It seems it can't go on the batch. I get an error 500 and it stops indexing. And, so, the natural sorting doesn't work because the indexing has not been finished. Any clue?

giuvax’s picture

My Drupal log says:

Notice: Undefined property: RulesReactionRule::$plugin in views_natural_sort_views_natural_sort_get_rebuild_data() (linea 103 di /home/qcfilmtv/public_html/redazione/sites/all/modules/views_natural_sort/views_natural_sort.module).

while the server error log is giving this kind of error

[21-Dec-2016 17:39:12 Europe/Rome] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 72 bytes) in /home/qcfilmtv/public_html/redazione/sites/all/modules/views_natural_sort/views_natural_sort_text_field.module on line 97
generalredneck’s picture

@guivax,

This issue has been closed for about 3 years. If you are having troubles with Version 2.0-alpha1 as designated by this ticket. I highly suggest you update to the latest version.

Otherwise, lets make a couple new issues.

In the mean time I'm going to start tracking some of this down. and if I can reproduce them before you get back to me, I'll create issues and post them here. It looks like we have 2 issues technically... One is that on low memory setups, batch processing isn't efficient. That's where you are getting the out of memory error.

The other is that Rules seems to throw notices when indexing (a much less high priority issue).

generalredneck’s picture

@guivax,

I added a comment to #1850224: As a user I would like to allow the use of a queue for field indexing so that installing the module doesn't take forever. as implementing this will take care of your fatal. In the mean time, since your site has such a big number of field entries for that field you are trying to work with, I suggest that you either
a) increase your memory limit for the site temporarily while you run the batch.
b) see if you can run the batch using commandline (say like in a custom update hook) by using

module_load_include('inc', 'views_natural_sort', 'views_natural_sort.admin');
views_natural_sort_rebuild_index_submit();

and having the memory limit higher there...