Developer forum

Forum » CMS - Standard features » Users index with nolock renders errors

Users index with nolock renders errors

Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi,

 

We are getting an issue on some live sites that need to index users. The problem is that between the time the index starts and it ends a new user is created and that causes it to fail. Here's the log

2021-03-14 12:50:11.559: Running.
2021-03-14 12:50:11.575: Fetching build definition.
2021-03-14 12:50:11.575: Fetched build definition. 'Dynamicweb.UserManagement.Indexing.UserIndexBuilder'.
2021-03-14 12:50:11.575: Preparing schema.
2021-03-14 12:50:11.590: Prepared schema.
2021-03-14 12:50:11.590: Creating index writer.
2021-03-14 12:50:11.590: Created index writer: 'Dynamicweb.Indexing.Lucene.LuceneIndexWriter'.
2021-03-14 12:50:11.606: Instance availability (Users): False.
2021-03-14 12:50:11.606: Starting build process.
2021-03-14 12:50:11.606: Dynamicweb.UserManagement.Indexing.UserIndexBuilder building using Dynamicweb.Indexing.Lucene.LuceneIndexWriter... Action: 'Full', Resume: 'False'
2021-03-14 12:50:11.606: Opening index writer.
2021-03-14 12:50:11.653: Opened index writer to overwrite index
2021-03-14 12:50:11.653: Opening database connection.
2021-03-14 12:50:11.715: Starting processing users.
2021-03-14 12:50:11.715: Handling users
2021-03-14 12:50:31.559: Running (3778 / 31460).
2021-03-14 12:50:51.559: Running (7050 / 31460).
2021-03-14 12:51:11.559: Running (10254 / 31460).
2021-03-14 12:51:31.559: Running (12537 / 31460).
2021-03-14 12:51:51.559: Running (14606 / 31460).
2021-03-14 12:52:11.559: Running (16208 / 31460).
2021-03-14 12:52:31.559: Running (17659 / 31460).
2021-03-14 12:52:51.560: Running (18999 / 31460).
2021-03-14 12:53:11.560: Running (20274 / 31460).
2021-03-14 12:53:31.560: Running (21471 / 31460).
2021-03-14 12:53:51.560: Running (22625 / 31460).
2021-03-14 12:54:11.560: Running (23788 / 31460).
2021-03-14 12:54:31.560: Running (24856 / 31460).
2021-03-14 12:54:51.575: Running (25972 / 31460).
2021-03-14 12:55:11.575: Running (26933 / 31460).
2021-03-14 12:55:31.591: Running (27835 / 31460).
2021-03-14 12:55:51.607: Running (28736 / 31460).
2021-03-14 12:56:11.607: Running (29666 / 31460).
2021-03-14 12:56:31.607: Running (30512 / 31460).
2021-03-14 12:56:51.607: Running (31386 / 31460).
2021-03-14 12:56:53.435: Closing index writer, just trying...
2021-03-14 12:56:53.623: Closed index writer successfully.
2021-03-14 12:56:53.623: Ended build process.
2021-03-14 12:56:53.623: Failed (31461 / 31460).

 

The problem eventually is because this may happen over the weekend, eventually both instances fail and the feauters the website is using users for become broken.

Is there a recommended way I could work around this?

 

Looking into the source code I can see the query on the database is made with nolock (and I understand why), but now we run into these situations. Not sure if this could be enhanced somehow by either:

  • Keeping track of the last UserId
    So it would avoid getting into this issue
     
  • Adding settings to the builder
    Which could have allowed us to only get users that belong to GroupId 123 or specific user types...

 

Best Regards,

Nuno Aguiar


Replies

 
Steffen Kruse Hansen Dynamicweb Employee
Steffen Kruse Hansen
Reply
This post has been marked as an answer

Hi Nuno,


Nicolai has made a fix for this similar to the functionality we have on the ProductIndexBuilder, where you can enable a setting on the IndexBuilder, so it will not fail the index, if something new is added to the database while the index build is running. 

So if you go to your user index, and press the build(s), you should see a setting called 'DoNotFailOnMismatchingCount', which actually seems like it's set to 'true' as default. This change has been included in the 9.10.7 hotfix, which has already been released.

Best regards,

Steffen

Votes for this answer: 1
 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Steffen,

 

Perfect thanks. Through a different channel we got early access to that dll and got it to work on the customer's website and it's working perfectly. 

 

Thanks for reaching out.

 

Nuno Aguiar

 

You must be logged in to post in the forum