My suggestion:
* completley avoid using UUIDField * use StrField instead * use the UUIDUpdateProcessorFactory if you want solr to generate the UUIDs for you when adding a new doc. The fact that UUIDField internally passes values around as java.util.UUID objects (and other classes like it that don't stick to java "primative" ovalues) is the source of a large amount of pain in various places of the code base, with almost not value add to end users. : Date: Wed, 29 Aug 2018 11:11:58 -0700 : From: Stephen Lewis Bianamara <stephen.bianam...@gmail.com> : Reply-To: solr-user@lucene.apache.org : To: solr-user@lucene.apache.org : Subject: Re: Atomic Update Failure With solr.UUID Field : : Hi All, : : Just checking back in. Did anyone have a chance to take a look? Would love : to get some help here. My design requires docs with many UUIDs which should : not need to be updated each time and should be optimally performant for : filters. So I think this bug is currently a hard blocker for me to be able : to use SOLR :( Is anyone from the SOLR community able to assist? I've : gathered some additional data in the mean time, and I would really : appreciate someone familiar with the area taking a look. : : Here are my additional discoveries : : 1. Turning on doc values and turning off stored, atomic updates work as : they're supposed to with UUID : 2. Turning on doc values and turning on stored, atomic updates break as : before with UUID. Thus it is 100% an effect of turning on stored. : 3. The error is being thrown here : <https://github.com/apache/lucene-solr/blob/1d85cd783863f75cea133fb9c452302214165a4d/solr/core/src/java/org/apache/solr/update/TransactionLog.java.> : . : : From the point that the error is thrown, I see a couple of possible options : as to what the fix may be. However, I'm relatively new to the innards of : the SOLR stack and only an occasional Java dev, so I'd love some guidance : on the matter. : : Perhaps the fix is to make java.Util.UUID implement BytesRef? Perhaps the : fix is to add another bit of logic after the " if (o instanceof BytesRef) " : conditional block. Something like, cast the object to a UUID and then : serialize to a byte array? : : Cheers, : Stephen : : On Wed, Aug 22, 2018 at 8:53 AM Stephen Lewis Bianamara < : stephen.bianam...@gmail.com> wrote: : : > Hello again! I found a thread which seems relevant. It looks like someone : > else found this occurred as well, but did not follow up with repro steps. : > But I did! :) : > : > : > http://lucene.472066.n3.nabble.com/TransactionLog-doesn-t-know-how-to-serialize-class-java-util-UUID-try-implementing-ObjectResolver-td4332277.html : > : > Would love to work together to get this fixed. : > : > On Tue, Aug 21, 2018 at 6:50 PM Stephen Lewis Bianamara < : > stephen.bianam...@gmail.com> wrote: : > : >> Hello SOLR Community, : >> : >> I'm prototyping a collection on SOLR 6.6.3 with UUID fields, and I'm : >> hitting some trouble with atomic updates. At a high level, here's the : >> problem: suppose you have a schema with an optional field of type solr.UUID : >> field, and a document with a value for that field. Any atomic update on : >> that document which does not contain the UUID field will fail. Below I : >> provide an example and then an exact set of repro steps. : >> : >> So for example, suppose I have the following doc: {"Id":1, : >> "SomeString":"woof", "MyUUID":"617c7768-7cc3-42d0-9ae1-74398bc5a3e7"}. If I : >> run an atomic update on it like {"Id":1,"SomeString":{"set":"meow"}}, it : >> will fail with message "TransactionLog doesn't know how to serialize class : >> java.util.UUID; try implementing ObjectResolver?" : >> : >> Is this a known issue? Precise repro below. Thanks! : >> : >> Exact repro : >> ------------- : >> 1. Define collection MyCollection with the following schema: : >> : >> <schema name="MySchema" version="1.5"> : >> <fields> : >> <field name="_version_" type="long" indexed="true" stored="true"/> : >> <field name="Id" type="string" indexed="true" stored="true" required="true" multiValued="false" /> : >> <field name="SomeString" type="string" indexed="true" stored="true" multiValued="false" /> : >> <field name="MyUUID" type="Guid" indexed="true" stored="true" multiValued="false" /> : >> </fields> : >> <uniqueKey>Id</uniqueKey> : >> <types> : >> <fieldType name="string" class="solr.StrField" sortMissingLast="true" /> : >> <fieldType name="Guid" class="solr.UUIDField" /> : >> </types></schema> : >> : >> 2. Create a document {"Id":1, "SomeString":"woof"} in the admin UI : >> (MyCollection > Documents > /update). The update succeeds and the doc is : >> searchable. : >> 3. Apply the following atomic update. It succeeds. {"Id":1, : >> "SomeString":{"set":"bark"}} : >> 4. Add a value for MyUUID (either with atomic update or regular). It : >> succeeds. {"Id":1, "MyUUID":{"set":"617c7768-7cc3-42d0-9ae1-74398bc5a3e7"}} : >> 5. Try to atomically update just the SomeString field. It fails. : >> {"Id":1, "SomeString":{"set":"meow"}} : >> : >> The error that happens on failure is the following. : >> : >> Status: {"data":{"responseHeader":{"status":500,"QTime":2},"error":{"metadata":["error-class","org.apache.solr.common.SolrException","root-error-class","org.apache.solr.common.SolrException"],"msg":"TransactionLog : >> doesn't know how to serialize class java.util.UUID; try implementing : >> ObjectResolver?","trace":"org.apache.solr.common.SolrException: : >> TransactionLog doesn't know how to serialize class java.util.UUID; try : >> implementing ObjectResolver?\r\n\tat : >> org.apache.solr.update.TransactionLog$1.resolve(TransactionLog.java:100)\r\n\tat : >> org.apache.solr.common.util.JavaBinCodec.writeVal(JavaBinCodec.java:234)\r\n\tat : >> org.apache.solr.common.util.JavaBinCodec.writeSolrInputDocument(JavaBinCodec.java:589)\r\n\tat : >> org.apache.solr.update.TransactionLog.write(TransactionLog.java:395)\r\n\tat : >> org.apache.solr.update.UpdateLog.add(UpdateLog.java:532)\r\n\tat : >> org.apache.solr.update.UpdateLog.add(UpdateLog.java:516)\r\n\tat : >> org.apache.solr.update.DirectUpdateHandler2.doNormalUpdate(DirectUpdateHandler2.java:320)\r\n\tat : >> org.apache.solr.update.DirectUpdateHandler2.addDoc0(DirectUpdateHandler2.java:239)\r\n\tat : >> org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:194)\r\n\tat : >> org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:67)\r\n\tat : >> org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:55)\r\n\tat : >> org.apache.solr.update.processor.DistributedUpdateProcessor.doLocalAdd(DistributedUpdateProcessor.java:979)\r\n\tat : >> org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:1192)\r\n\tat : >> org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:748)\r\n\tat : >> org.apache.solr.update.processor.LogUpdateProcessorFactory$LogUpdateProcessor.processAdd(LogUpdateProcessorFactory.java:103)\r\n\tat : >> org.apache.solr.handler.loader.JsonLoader$SingleThreadedJsonLoader.handleAdds(JsonLoader.java:506)\r\n\tat : >> org.apache.solr.handler.loader.JsonLoader$SingleThreadedJsonLoader.processUpdate(JsonLoader.java:145)\r\n\tat : >> org.apache.solr.handler.loader.JsonLoader$SingleThreadedJsonLoader.load(JsonLoader.java:121)\r\n\tat : >> org.apache.solr.handler.loader.JsonLoader.load(JsonLoader.java:84)\r\n\tat : >> org.apache.solr.handler.UpdateRequestHandler$1.load(UpdateRequestHandler.java:97)\r\n\tat : >> org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:68)\r\n\tat : >> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:173)\r\n\tat : >> org.apache.solr.core.SolrCore.execute(SolrCore.java:2477)\r\n\tat : >> org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:723)\r\n\tat : >> org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:529)\r\n\tat : >> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:361)\r\n\tat : >> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:305)\r\n\tat : >> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1691)\r\n\tat : >> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)\r\n\tat : >> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)\r\n\tat : >> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)\r\n\tat : >> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)\r\n\tat : >> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)\r\n\tat : >> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)\r\n\tat : >> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)\r\n\tat : >> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)\r\n\tat : >> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\r\n\tat : >> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)\r\n\tat : >> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)\r\n\tat : >> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)\r\n\tat : >> org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335)\r\n\tat : >> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)\r\n\tat : >> org.eclipse.jetty.server.Server.handle(Server.java:534)\r\n\tat : >> org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)\r\n\tat : >> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)\r\n\tat : >> org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)\r\n\tat : >> org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)\r\n\tat : >> org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)\r\n\tat : >> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)\r\n\tat : >> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)\r\n\tat : >> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)\r\n\tat : >> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)\r\n\tat : >> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)\r\n\tat : >> java.lang.Thread.run(Thread.java:748)\r\n","code":500}},"status":500,"config":{"method":"POST","transformRequest":[null],"transformResponse":[null],"headers":{"Content-type":"application/json","Accept":"application/json, : >> text/plain, */*"},"data":"[{\n \"Id\": 1,\n : >> \"SomeString\":{\"set\":\"meow\"}\n}]","url":"MyCollection/update","params":{"wt":"json","_":1534900693297,"commitWithin":1000,"boost":"1.0","overwrite":true},"timeout":10000},"statusText":"Server : >> Error"} : >> : > : -Hoss http://www.lucidworks.com/