dsmiley commented on a change in pull request #455: SOLR-12638 URL: https://github.com/apache/lucene-solr/pull/455#discussion_r270067277
########## File path: solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java ########## @@ -645,32 +660,126 @@ boolean getUpdatedDocument(AddUpdateCommand cmd, long versionOnUpdate) throws IO } // full (non-inplace) atomic update + final boolean isDeeplyNestedSchema = req.getSchema().isUsableForChildDocs() && req.getSchema().hasExplicitField(IndexSchema.NEST_PATH_FIELD_NAME); SolrInputDocument sdoc = cmd.getSolrInputDocument(); BytesRef id = cmd.getIndexedId(); - SolrInputDocument oldDoc = RealTimeGetComponent.getInputDocument(cmd.getReq().getCore(), id); + SolrInputDocument completeHierarchy = RealTimeGetComponent.getInputDocument(cmd.getReq().getCore(), id, RealTimeGetComponent.Resolution.ROOT_WITH_CHILDREN); - if (oldDoc == null) { - // create a new doc by default if an old one wasn't found - if (versionOnUpdate <= 0) { - oldDoc = new SolrInputDocument(); - } else { + if (completeHierarchy == null) { + if (versionOnUpdate > 0) { // could just let the optimistic locking throw the error throw new SolrException(ErrorCode.CONFLICT, "Document not found for update. id=" + cmd.getPrintableId()); } } else { - oldDoc.remove(CommonParams.VERSION_FIELD); + completeHierarchy.remove(CommonParams.VERSION_FIELD); } - cmd.solrDoc = docMerger.merge(sdoc, oldDoc); + SolrInputDocument mergedDoc; Review comment: I think much of the changes you did here in DistributedUpdateProcessor.getUpdatedDocument (and new supporting methods added), should move to AtomicUpdateDocumentMerger since it has to do with the intricacies of merging documents. This code is distracting in DistributedUpdateProcessor which has plenty of complicated responsibilities otherwise. WDYT? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org