Getting Exception while inserting using bucket.async.insert

When i try to insert set of documents using the below code, i am getting an exception

Observable.from(documents.subList(i, end)).flatMap(new Func1<JsonDocument, Observable>() {

  				@Override
  				public Observable<JsonDocument> call(JsonDocument docToInsert) {
  					return bucket.async().insert(docToInsert);
  				}
  			}).last().toBlocking().single();

Exception Trace:

Exception in thread “main” java.util.NoSuchElementException: Sequence contains no elements
at rx.internal.operators.OperatorSingle$1.onCompleted(OperatorSingle.java:82)
at rx.internal.operators.NotificationLite.accept(NotificationLite.java:140)
at rx.internal.operators.TakeLastQueueProducer.emit(TakeLastQueueProducer.java:73)
at rx.internal.operators.TakeLastQueueProducer.startEmitting(TakeLastQueueProducer.java:45)
at rx.internal.operators.OperatorTakeLast$1.onCompleted(OperatorTakeLast.java:59)
at rx.internal.operators.OperatorMerge$MergeSubscriber.drainAndComplete(OperatorMerge.java:481)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onCompleted(OperatorMerge.java:444)
at rx.internal.operators.OperatorMap$1.onCompleted(OperatorMap.java:44)
at rx.internal.operators.OnSubscribeFromIterable$IterableProducer.request(OnSubscribeFromIterable.java:102)
at rx.Subscriber.setProducer(Subscriber.java:139)
at rx.Subscriber.setProducer(Subscriber.java:133)
at rx.internal.operators.OnSubscribeFromIterable.call(OnSubscribeFromIterable.java:47)
at rx.internal.operators.OnSubscribeFromIterable.call(OnSubscribeFromIterable.java:33)
at rx.Observable$1.call(Observable.java:145)
at rx.Observable$1.call(Observable.java:137)
at rx.Observable$1.call(Observable.java:145)
at rx.Observable$1.call(Observable.java:137)
at rx.Observable$1.call(Observable.java:145)
at rx.Observable$1.call(Observable.java:137)
at rx.Observable$1.call(Observable.java:145)
at rx.Observable$1.call(Observable.java:137)
at rx.Observable$1.call(Observable.java:145)
at rx.Observable$1.call(Observable.java:137)
at rx.Observable.subscribe(Observable.java:7393)
at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:441)
at rx.observables.BlockingObservable.single(BlockingObservable.java:340)

Hi,

I could see this exception being raised if the documents sublist is empty. Can you test if this is the case?

1 Like

yes. The list coming was empty. Thanks. When i try to write large volume of documents(3 to 4 lac documets) this operation gets hung after sometime. i see the below messages. Any idea what is going wrong here?

10:48:56.515 [cb-io-1-1] DEBUG c.c.c.c.endpoint.kv.KeyValueHandler - [localhost/127.0.0.1:11210][KeyValueEndpoint]: Identified Idle State, signalling config reload.
10:48:56.515 [cb-io-1-1] DEBUG c.c.c.c.e.AbstractGenericHandler - [localhost/127.0.0.1:11210][KeyValueEndpoint]: KeepAlive fired
10:48:56.515 [cb-core-3-1] DEBUG c.c.c.c.config.ConfigurationProvider - Received signal for outdated configuration.
10:48:56.527 [cb-computations-2] DEBUG c.c.c.c.config.ConfigurationProvider - New Bucket contact-service-data config proposed.
10:48:56.529 [cb-computations-2] DEBUG c.c.c.c.c.refresher.CarrierRefresher - Completed refreshing config for bucket “contact-service-data”

These logs seem to be unrelated to your hanging problems. Can you show us more logs?

Hi @ldoguin I could resolve this problem. The issue was with the long running Oracle database query from which i am trying to get the data. Thanks.