Partial update error for missing _root_ after updating to Solr 8.8.2

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Partial update error for missing _root_ after updating to Solr 8.8.2

Andreas Hubold
Hi,

with Solr 8.6.3 we developed a new feature that uses partial update to
add some nested documents to existing index documents.

Because we didn't have nested documents so far, we've added the _root_
and _nest_path_ fields to the schema, but of course these were unset for
existing documents.

<field name="_root_" type="string" indexed="true" stored="false"
docValues="true" />
<field name="_nest_path_" type="_nest_path_" /><fieldType
name="_nest_path_" class="solr.NestPathField" />

With 8.6.3 it worked fine to use partial updates to set some nested
documents to existing docs. Nested documents itself were never changed
here, we're just setting the nested documents for existing top-level
documents.

I could also see that the _root_ field was correctly updated for both
root and child documents.

Now we've updated to Solr 8.8.2 and still want to use old indices where
the _root_ field isn't set for all documents. But now adding nested
documents doesn't work anymore:

Caused by: org.apache.solr.common.SolrException: Attempted an
atomic/partial update to a child doc without indicating the _root_ somehow.
         at
org.apache.solr.handler.component.RealTimeGetComponent.getInputDocument(RealTimeGetComponent.java:746)
         at
org.apache.solr.update.processor.DistributedUpdateProcessor.getUpdatedDocument(DistributedUpdateProcessor.java:689)
         at
org.apache.solr.update.processor.DistributedUpdateProcessor.doVersionAdd(DistributedUpdateProcessor.java:373)
         at
org.apache.solr.update.processor.DistributedUpdateProcessor.lambda$versionAdd$0(DistributedUpdateProcessor.java:336)
         at
org.apache.solr.update.VersionBucket.runWithLock(VersionBucket.java:50)
         at
org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:336)
         at
org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:222)
         at
org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:55)

This check was introduced with
https://issues.apache.org/jira/browse/SOLR-14923

I know, I could reindex everything, but I'd really really like to avoid
this.
Is there some other kind of workaround that I could use with Solr 8.8.2?

Or would it be possible to change the check, so that it only throws an
exception if there's an existing(!) _root_ value in the indexed document
that doesn't match?

Thanks,
Andreas

Reply | Threaded
Open this post in threaded view
|

Re: Partial update error for missing _root_ after updating to Solr 8.8.2

Andreas Hubold
The error seems to happens for every kind of partial update / atomic update
when the _root_ field was added to the schema of an existing index.

This means, Solr 8.8.2 now requires a full reindex when one adds the _root_
field to the schema of an existing index. Previously (Solr 8.6.3) this
wasn't required, and I also don't understand why this would be needed?

Would you agree, that this is a bug?



--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Reply | Threaded
Open this post in threaded view
|

Re: Partial update error for missing _root_ after updating to Solr 8.8.2

Andreas Hubold
I have opened a JIRA ticket for this now
https://issues.apache.org/jira/browse/SOLR-15468

Would be great if someone could have a look and help.

Thank you,
Andreas



--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Reply | Threaded
Open this post in threaded view
|

Re: Partial update error for missing _root_ after updating to Solr 8.8.2

david.w.smiley@gmail.com
In reply to this post by Andreas Hubold
The follow-up here from JIRA is that, as of Solr 8.0, you must not add "_root_" to a schema for an existing collection.  Solr uses this field instead of the uniqueKey for certain identity checks.  Chaos will ensue if you add it later.  I shall update the ref guide to add a warning.

~ David

On 2021/06/08 15:14:18, Andreas Hubold <[hidden email]> wrote:

> Hi,
>
> with Solr 8.6.3 we developed a new feature that uses partial update to
> add some nested documents to existing index documents.
>
> Because we didn't have nested documents so far, we've added the _root_
> and _nest_path_ fields to the schema, but of course these were unset for
> existing documents.
>
> <field name="_root_" type="string" indexed="true" stored="false"
> docValues="true" />
> <field name="_nest_path_" type="_nest_path_" /><fieldType
> name="_nest_path_" class="solr.NestPathField" />
>
> With 8.6.3 it worked fine to use partial updates to set some nested
> documents to existing docs. Nested documents itself were never changed
> here, we're just setting the nested documents for existing top-level
> documents.
>
> I could also see that the _root_ field was correctly updated for both
> root and child documents.
>
> Now we've updated to Solr 8.8.2 and still want to use old indices where
> the _root_ field isn't set for all documents. But now adding nested
> documents doesn't work anymore:
>
> Caused by: org.apache.solr.common.SolrException: Attempted an
> atomic/partial update to a child doc without indicating the _root_ somehow.
>          at
> org.apache.solr.handler.component.RealTimeGetComponent.getInputDocument(RealTimeGetComponent.java:746)
>          at
> org.apache.solr.update.processor.DistributedUpdateProcessor.getUpdatedDocument(DistributedUpdateProcessor.java:689)
>          at
> org.apache.solr.update.processor.DistributedUpdateProcessor.doVersionAdd(DistributedUpdateProcessor.java:373)
>          at
> org.apache.solr.update.processor.DistributedUpdateProcessor.lambda$versionAdd$0(DistributedUpdateProcessor.java:336)
>          at
> org.apache.solr.update.VersionBucket.runWithLock(VersionBucket.java:50)
>          at
> org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:336)
>          at
> org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:222)
>          at
> org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:55)
>
> This check was introduced with
> https://issues.apache.org/jira/browse/SOLR-14923
>
> I know, I could reindex everything, but I'd really really like to avoid
> this.
> Is there some other kind of workaround that I could use with Solr 8.8.2?
>
> Or would it be possible to change the check, so that it only throws an
> exception if there's an existing(!) _root_ value in the indexed document
> that doesn't match?
>
> Thanks,
> Andreas
>
>