Yelp/nrtsearch

NPE when client try to add docs to a replica node

frotsch opened this issue · 0 comments

[WARN ] 2021-11-11 14:12:34.761 [LuceneIndexingExecutor-1-thread-3] LuceneServer - error while trying to addDocuments
java.lang.NullPointerException: null
	at com.yelp.nrtsearch.server.luceneserver.AddDocumentHandler$DocumentIndexer.addDocuments(AddDocumentHandler.java:317) ~[nrtsearch-0.10.2.jar:?]
	at com.yelp.nrtsearch.server.luceneserver.AddDocumentHandler$DocumentIndexer.runIndexingJob(AddDocumentHandler.java:238) ~[nrtsearch-0.10.2.jar:?]
	at com.yelp.nrtsearch.server.grpc.LuceneServer$LuceneServerImpl$1.onCompletedForIndex(LuceneServer.java:651) ~[nrtsearch-0.10.2.jar:?]
	at com.yelp.nrtsearch.server.grpc.LuceneServer$LuceneServerImpl$1.lambda$onCompleted$0(LuceneServer.java:696) ~[nrtsearch-0.10.2.jar:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) [?:?]
	at java.lang.Thread.run(Thread.java:832) [?:?]

because shardState.writer is null on a replica node.

Instead of NPE the client should receive an error message like "Adding documents to an index on a replica mode is not supported".