Giter Site home page Giter Site logo

reactivecouchbase-core's People

Contributors

gitter-badger avatar mathieuancelin avatar pcboy avatar waxzce avatar wsargent avatar zbintliff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reactivecouchbase-core's Issues

Exception when trying to get non existing document

When running with failfutures=true the following test fails. Also I'm running with version 0.2

..

"lookup without throwing" in {

  val none : Option[Cookie] = bucket.get[Cookie]("a dummy that doesn't exists")
  none must beNone

}

.

with the trace

[error] OperationFailedException: : Operation failed : Not found (CouchbaseFutures.scala:141)
[error] org.reactivecouchbase.client.CouchbaseFutures$.org$reactivecouchbase$client$CouchbeseFutures$$complete$3(CouchbaseFutures.scala:141)
[error] org.reactivecouchbase.client.CouchbaseFutures$$anon$2.onComplete(CouchbaseFutures.scala:157)
[error] org.reactivecouchbase.client.CouchbaseFutures$$anon$2.onComplete(CouchbaseFutures.scala:156)
[error] net.spy.memcached.internal.AbstractListenableFuture$1.run(AbstractListenableFuture.java:117)
[error] akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:42)
[error] akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:386)

Is that the intended behaviour?

incrAndGet and decrAndGet might not work as people expect

Not sure if this is intended or not but due to the changes in 5093d0f incrAndGet and decrAndGet are no longer atomic regarding the returned value.

For example issuing a whole lot of incrAndGet in one go will cause duplicate longs/ints to be returned as a separate get is used once the incr/decr has completed.

For now I switch to the simple incr/decr and convert the result to work around this.

If this is expected it needs to be made clear in the docs.

Thanks,
Richard.

New I/O Worker leaks

Hi there! I've started to have strange application crashes and found strange leaks of new i/o worker threads. Here is thread dump: http://pastebin.com/ue9jRWv3 and here is the way I'm using driver in my application:

trait ReactiveCouchbaseClient {
  implicit val ec = ExecutionContext.Implicits.global
  val timeout = Duration(10, TimeUnit.SECONDS)

  val driver = ReactiveCouchbaseDriver()
  val config = ConfigFactory.load()

  def bucketName: String

  val DesignDocName = "cutesy_mr"
  def bucket: CouchbaseBucket = driver.bucket(bucketName)

  def executeWithBucket[T](function: CouchbaseBucket => T) = {
    function(bucket)
  }
}

By extending it in each bucket's client I provide bucket name. I'm using reactivecouchbase-core 4-SNAPSHOT, Play 2.3.6, Scala 2.11.2.

Any workaround appreciated.

big response times in view calls

My future response time is around 800ms, and this has turned to a bottleneck in my Spray REST server... each request does a view call... around 40 calls/sec, couchbase claims 6 view calls on its console.

TraceRecorder.withNewTraceContext(s"AccViewCall") {
      val future = coreBucket.find[Account]("accounts", "byUsername")(
        new Query().setIncludeDocs(true).setReduce(false).setStale(Stale.FALSE).setKey( username )
      ).map { p =>
        TraceRecorder.finish()
      }
    }(context.system)

Am I doing something wrong?

Atomic.atomicallyUpdate throws ClassCastException when the key cannot be found

For cases where "myKey" cannot be found, the future returned from atomicallyUpdate returns a failed future with

ClassCastException: scala.concurrent.impl.Promise$KeptPromise cannot be cast to MyData

It would be useful if the failed future indicated the not found status instead. I'm thinking of cases where I'm providing a RESTful service and want to return a 404 Not Found status. Since a ClassCastException could be thrown for other reasons, it's difficult to discern when it's truly a casting issue or a not found issue.

bucket.atomicallyUpdate[MyData]("myKey") { currentValue =>
  foo(currentValue)
}

Thanks.

reconnection issues resolved in Java Couchbase Client 1.4.4

Dear @mathieuancelin,

There were some bug fixes in the Java couchbase client version 1.4.4 that resolved underlying reconnection logic. Are there any plans to incorporate the changes directly (e.g. @zbintliff's #40)?

A workaround to excluding the dependency on com.couchbase.client:couchbase-client:1.4.2 and forcing 1.4.4 in the code pulling in ReactiveCouchbase-core seems to work just as well; although, it's a little less convenient.

The library should not contain logger.xml or anything about logging whatsoever

Apparently it is just a blind copy and paste of play framework, and I don't see why it is necessary.

Play's logger.xml is used to mute some of its noisy dependencies, but reactivecouchbase's one is not doing anything meaningful other than adding up hazards of name collision.

In general, logging configuration should be left to application development/deployment and and a library should not alter it in any form, and that is the whole point of using slf4j.

backpressure feature

I will start implementing a kind of back pressure feature in the near future.

The reason for doing this is that in error scenarioes where a couchbase node is done or not responding it can cause my entire application to become unresponsive. My current debugging efforts shows that it is caused by excessive garbage collection which is happening because a lot of operations has queued up and requests just keeps coming from the load balancer.

Would you be interested in adding this feature to the driver as a kind of optional feature. I would off course maintain it for the future or do you think it is a kind of feature creep?

HA with couchbase

couchbase {
  actorctx {               # execution context configuration, optional
    timeout=1000                    # default timeout for futures (ms), optional
    execution-context {             # actual execution context configuration if needed, optional
      fork-join-executor {
        parallelism-factor = 4.0
        parallelism-max = 40
      }
    }
  }
  buckets = [{                      # available bucket. It's an array, so you can define multiple values
    host="127.0.0.1", "127.0.0.1"   # Couchbase hosts, can be multiple comma separated values
    port="8091"
    base="pools"
    bucket="$bucketname"
    pass="$password"
    timeout="0"
  }, {

I've got a question related the host value configuration. I'm using 4 couchbase server and define the host value as host=["127.0.0.1", "127.0.0.2", "127.0.0.3","127.0.0.4"].

When one of the nodes is failing, it should use fail-over configuration in Couchbase Server. Couchbase server should be still available via the others nodes, but it seems some requests are still being sent to the non-responsive node, hence I've got timeout responses from Couchbase requests. The service is not entirely down, because there's still traffic in.

Is this the right behavior to expect when a Couchbase node is failing ? Or is there some configuration to make Couchbase server highly available ?

Response of getAndLock fails with class cast exception

Response of getAndLock fails with class cast exception.
Here's the following cast:
f.get().asInstanceOf[CASValue[T]]
However, f is of type OperationFuture[CASValue[Object]], so the getValue of the CASValue returns String. In comparison, the regular bucket.get() uses the Reads[T] to parse the value, i.e.
case doc: String => Some(r.reads(Json.parse(doc)))

HttpFuture callback triggered twice

It seems that HttpFuture callbacks are triggered twice when doing a View query :

2014-01-10 21:58:02.841 WARN com.couchbase.client.internal.ViewFuture:  Exception thrown wile executing org.reactivecouchbase.client.CouchbaseFutures$$anon$5.operationComplete()
java.lang.IllegalStateException: Promise already completed.
    at scala.concurrent.Promise$class.complete(Promise.scala:55)
    at scala.concurrent.impl.Promise$DefaultPromise.complete(Promise.scala:58)
    at scala.concurrent.Promise$class.success(Promise.scala:89)
    at scala.concurrent.impl.Promise$DefaultPromise.success(Promise.scala:58)
    at org.reactivecouchbase.client.CouchbaseFutures$$anon$5.onComplete(CouchbaseFutures.scala:188)
    at org.reactivecouchbase.client.CouchbaseFutures$$anon$5.onComplete(CouchbaseFutures.scala:181)
    at net.spy.memcached.internal.AbstractListenableFuture$1.run(AbstractListenableFuture.java:119)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:42)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:386)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

I guess it's Java Driver related.

Any idea @daschl ?

fetchValues does never complete future

I'm not sure if it is a bug, but when I call

def fetchValues[T](keys: Seq[String]) ..

in trait Read, where keys is an empty list, the future never completes, it's probably a consequence of the fact that the seq is transformed to an enumerator without any values

ReactiveCouchbase - PLAY Framework does not work

Hi,

I'm new to reactivecouchbase. I'm trying to integrate reactivecouchbase with PLAY framework. I'm using the Hello-PlayFramework template as starting point.

These are my current config files:

build.sbt
name := """hello-play"""

version := "1.0-SNAPSHOT"

libraryDependencies ++= Seq(
javaCore, // The core Java API
// WebJars pull in client-side web libraries
"org.webjars" %% "webjars-play" % "2.2.0",
"org.webjars" % "bootstrap" % "2.3.1",
// Add your own project dependencies in the form:
// "group" % "artifact" % "version"
cache,
"org.reactivecouchbase" % "reactivecouchbase-play_2.10" % "0.2-SNAPSHOT"
)

Application.conf (The rest of the file was unaltered.)

Database configuration

~~~~~

couchbase {
actorctx {
timeout=1000
execution-context {
fork-join-executor {
parallelism-factor = 4.0
parallelism-max = 40
}
}
}
buckets = [{
host="127.0.0.1"
port="8091"
base="pools"
bucket="default"
user=""
pass=""
timeout="0"
}]
}

I added the file play.plugins with the following:
400:org.reactivecouchbase.play.plugins.CouchbasePlugin

My routes file:

Routes

This file defines all application routes (Higher priority routes first)

~~~~

GET / controllers.MainController.index()
GET /message controllers.MessageController.getMessage()
GET /couchbase/*string controllers.CouchbaseController.getUser(string)
GET /assets/javascripts/routes controllers.MessageController.javascriptRoutes()

Map static resources from the /public folder to the /assets URL path

GET /assets/_file controllers.Assets.at(path="/public", file)
GET /webjars/_file controllers.WebJarAssets.at(file)

and my controller is this one:
import play.api.mvc.{Action, Controller}
import play.api.libs.json._
import org.reactivecouchbase.play.Couchbase
import org.reactivecouchbase.play.CouchbaseBucket
import org.reactivecouchbase.play.CouchbaseController
import play.api.Play.current

case class User(name: String, surname: String, email: String)

object UserController extends Controller with CouchbaseController {

implicit val couchbaseExecutionContext = PlayCouchbase.couchbaseExecutor
implicit val userReader = Json.reads[User]

def getUser(key: String) = CouchbaseAction { bucket =>
bucket.getUser.map { maybeUser =>
maybeUser.map(user => Ok(views.html.user(user)).getOrElse(BadRequest("Unable to find user with key: $key")))
}
}
}

While compiling the project I get this error:
:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.reactivecouchbase#reactivecouchbase-play_2.10;0.2-SNAPSHOT: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: unresolved dependency: org.reactivecouchbase#reactivecouchbase-play_2.10;0.2-SNAPSHOT: not found
:
error sbt.ResolveException: unresolved dependency: org.reactivecouchbase#reactivecouchbase-play_2.10;0.2-SNAPSHOT: not found
Failed to control sbt: sbt.Incomplete: null
:
at xsbt.boot.Boot$.runImpl(Boot.scala:32)
at xsbt.boot.Boot$.main(Boot.scala:21)
at xsbt.boot.Boot.main(Boot.scala)
Failed to load project details: sbt process never got in touch, so unable to handle request GenericRequest(true,name,Map())

Any ideas?

Thank you in advance!

Regards!
//Javier

resolvers += "ReactiveCouchbase repository" at "https://raw.github.com/ReactiveCouchbase/repository/master/snapshots/org/reactivecouchbase"

play.Project.playScalaSettings

Atomically updating and setting the CouchbaseExpirationTiming

In issue #17 it was mentioned that an explicit replace is unnecessary within the bucket.atomicallyUpdate block, since the function will do that for me with the value returned. I have a case where I also need to update the expiration timing of the replaced document. I don't currently see a way to do that atomically however. Would it be possible to provide that functionality with something along the lines of:

val expirationDuration =
    Duration(10, scala.concurrent.duration.MINUTES)

val expirationTiming =
    CouchbaseExpirationTiming_byDuration(expirationDuration)

val fPerson: Future[Person] =
    bucket.atomicallyUpdate[Person](key, expirationTiming) { person =>
        Person(person.name, person.age + 1)
    }

Thanks!

Authorization Headers with Expiremental View Queries

We are working on experiemental view queries, and adding Authorization Headers to it. Something like this:

    if (bucket.user != null) {
      bucket.httpClient.prepareGet(url).addHeader("Authorization", HttpUtil.buildAuthHeader(bucket.user, bucket.pass)).execute(responseHandler)
      promise.future.map(body => (Json.parse(body) \ "rows").as[JsArray])
    } else {
      bucket.httpClient.prepareGet(url).execute(responseHandler)
      promise.future.map(body => (Json.parse(body) \ "rows").as[JsArray])
    }

That would be in __internalViewQuery() in the org.reactivecouchbase.experimental.ViewRow.scala.

We also are implementing a sort of round robin, so it will rotate which node queries like so:

var nodeToQuery = bucket.hosts.toArray.apply(counter % bucket.hosts.size)
counter += 1  //counter is a global variable

Let me know if you are interested in pulling down any of these. We are in the process of testing these out.

Snapshot no longer resolve

https://raw.githubusercontent.com/ReactiveCouchbase/repository/master/snapshots -> 404

Please publish a non-snapshot for Play 2.3.

Buckets host list not working in configuration

In the Couchbase configuration :

couchbase {
 buckets = [{
      host=["127.0.0.1", "192.168.0.42"]
...

It seems this doesn't work with the 0.1 Release. I have tested with 0.2-SNAPSHOT too, same issue. It was working before the ReactiveCouchbase restamping.

This is the error:

akka.actor.ActorInitializationException: exception during creation
    at akka.actor.ActorInitializationException$.apply(Actor.scala:218)
    at akka.actor.ActorCell.create(ActorCell.scala:578)
    at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:425)
    at akka.actor.ActorCell.systemInvoke(ActorCell.scala:447)
    at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:262)
    at akka.dispatch.Mailbox.run(Mailbox.scala:218)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:386)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at akka.util.Reflect$.instantiate(Reflect.scala:65)
    at akka.actor.Props.newActor(Props.scala:337)
    at akka.actor.ActorCell.newActor(ActorCell.scala:534)
    at akka.actor.ActorCell.create(ActorCell.scala:560)
    ... 9 more
Caused by: java.lang.RuntimeException: application.conf: 77: host has type LIST rather than STRING
    at org.reactivecouchbase.Configuration.reportError(utils.scala:124)
    at org.reactivecouchbase.Configuration.readValue(utils.scala:88)
    at org.reactivecouchbase.Configuration.getString(utils.scala:92)
    at org.reactivecouchbase.ReactiveCouchbaseDriver.bucket(Couchbase.scala:84)
    at actors.CouchbaseMasterActor.<init>(CouchbaseMasterActor.scala:86)
    ... 17 more
Caused by: com.typesafe.config.ConfigException$WrongType: application.conf: 77: host has type LIST rather than STRING
    at com.typesafe.config.impl.SimpleConfig.findKey(SimpleConfig.java:124)
    at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:136)
    at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:150)
    at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:155)
    at com.typesafe.config.impl.SimpleConfig.getString(SimpleConfig.java:197)
    at org.reactivecouchbase.Configuration$$anonfun$getString$1.apply(utils.scala:92)
    at org.reactivecouchbase.Configuration$$anonfun$getString$1.apply(utils.scala:92)
    at org.reactivecouchbase.Configuration.readValue(utils.scala:85)
    ... 20 more

ViewsSpec.Check view API test fails

ViewsSpec.Check view API test fails when I run the tests locally.
Cocuhbase Version: 3.0.2-1603 Enterprise Edition (build-1603)

Response DefaultHttpResponse(chunked: true)
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Mon, 12 Jan 2015 09:01:46 GMT
Content-Type: text/plain;charset=utf-8
Cache-Control: must-revalidate

11:01:46.463 [New I/O worker #19] DEBUG c.n.h.c.p.n.NettyAsyncHttpProvider - Unexpected I/O exception on channel [id: 0x1e87ef91, /127.0.0.1:52715 => /127.0.0.1:8092]
java.lang.NumberFormatException: For input string: "HTTP/1.1"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) ~[na:1.6.0_45]
    at java.lang.Integer.parseInt(Integer.java:449) ~[na:1.6.0_45]
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.getChunkSize(HttpMessageDecoder.java:621) ~[netty-3.9.2.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:318) ~[netty-3.9.2.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpClientCodec$Decoder.decode(HttpClientCodec.java:143) ~[netty-3.9.2.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpClientCodec$Decoder.decode(HttpClientCodec.java:127) ~[netty-3.9.2.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:500) ~[netty-3.9.2.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:435) ~[netty-3.9.2.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpClientCodec.handleUpstream(HttpClientCodec.java:92) ~[netty-3.9.2.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) ~[netty-3.9.2.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) ~[netty-3.9.2.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88) ~[netty-3.9.2.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108) ~[netty-3.9.2.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318) ~[netty-3.9.2.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89) ~[netty-3.9.2.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) ~[netty-3.9.2.Final.jar:na]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [na:1.6.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [na:1.6.0_45]
    at java.lang.Thread.run(Thread.java:662) [na:1.6.0_45]

OperationFutureStatus not completed

I see this warning message
OperationFutureStatus not completed yet, success anyway : false : false

a few millis after my method call, later my future completes. however I've played with my application.conf and tailored my implicit imports of ec with new dispatchers.

Haven't seen this before in reactivecouchbase, what does that mean?

Update dependenicies

I'm not able to pull both 0.2 and 0.3 versions in my scala 2.10.4, sbt 0.13 project:

[info] Resolving com.typesafe.play#play-iteratees_2.10;2.3.0 ...
[warn]  module not found: com.typesafe.play#play-iteratees_2.10;2.3.0
[warn] ==== local: tried
[warn]   /home/behrad/.ivy2/local/com.typesafe.play/play-iteratees_2.10/2.3.0/ivys/ivy.xml
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/com/typesafe/play/play-iteratees_2.10/2.3.0/play-iteratees_2.10-2.3.0.pom
[warn] ==== ConSol* Labs Repository: tried
[warn]   http://labs.consol.de/maven/repository/com/typesafe/play/play-iteratees_2.10/2.3.0/play-iteratees_2.10-2.3.0.pom
[warn] ==== ReactiveCouchbase Releases: tried
[warn]   https://raw.github.com/ReactiveCouchbase/repository/master/releases/com/typesafe/play/play-iteratees_2.10/2.3.0/play-iteratees_2.10-2.3.0.pom
[warn] ==== ReactiveCouchbase Snapshots: tried
[warn]   https://raw.github.com/ReactiveCouchbase/repository/master/snapshots/com/typesafe/play/play-iteratees_2.10/2.3.0/play-iteratees_2.10-2.3.0.pom
[info] Resolving com.typesafe.play#play-json_2.10;2.3.0 ...
[warn]  module not found: com.typesafe.play#play-json_2.10;2.3.0
[warn] ==== local: tried
[warn]   /home/behrad/.ivy2/local/com.typesafe.play/play-json_2.10/2.3.0/ivys/ivy.xml
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/com/typesafe/play/play-json_2.10/2.3.0/play-json_2.10-2.3.0.pom
[warn] ==== ConSol* Labs Repository: tried
[warn]   http://labs.consol.de/maven/repository/com/typesafe/play/play-json_2.10/2.3.0/play-json_2.10-2.3.0.pom
[warn] ==== ReactiveCouchbase Releases: tried
[warn]   https://raw.github.com/ReactiveCouchbase/repository/master/releases/com/typesafe/play/play-json_2.10/2.3.0/play-json_2.10-2.3.0.pom
[warn] ==== ReactiveCouchbase Snapshots: tried
[warn]   https://raw.github.com/ReactiveCouchbase/repository/master/snapshots/com/typesafe/play/play-json_2.10/2.3.0/play-json_2.10-2.3.0.pom
[info] Resolving org.aspectj#aspectjweaver;1.8.2 ...
[info] downloading https://raw.github.com/ReactiveCouchbase/repository/master/snapshots/org/reactivecouchbase/reactivecouchbase-core_2.10/0.3-SNAPSHOT/reactivecouchbase-core_2.10-0.3-SNAPSHOT.jar ...
[info]  [SUCCESSFUL ] org.reactivecouchbase#reactivecouchbase-core_2.10;0.3-SNAPSHOT!reactivecouchbase-core_2.10.jar (28409ms)
[info] downloading http://repo1.maven.org/maven2/com/couchbase/client/couchbase-client/1.4.4/couchbase-client-1.4.4.jar ...
[info]  [SUCCESSFUL ] com.couchbase.client#couchbase-client;1.4.4!couchbase-client.jar (13005ms)
[info] downloading http://repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.1.1/logback-classic-1.1.1.jar ...
[info]  [SUCCESSFUL ] ch.qos.logback#logback-classic;1.1.1!logback-classic.jar (10346ms)
[info] downloading http://repo1.maven.org/maven2/com/ning/async-http-client/1.8.14/async-http-client-1.8.14.jar ...
[info]  [SUCCESSFUL ] com.ning#async-http-client;1.8.14!async-http-client.jar (19088ms)
[info] downloading http://repo1.maven.org/maven2/net/spy/spymemcached/2.11.4/spymemcached-2.11.4.jar ...
[info]  [SUCCESSFUL ] net.spy#spymemcached;2.11.4!spymemcached.jar (18037ms)
[info] downloading http://repo1.maven.org/maven2/ch/qos/logback/logback-core/1.1.1/logback-core-1.1.1.jar ...
[info]  [SUCCESSFUL ] ch.qos.logback#logback-core;1.1.1!logback-core.jar (16712ms)
[info] downloading http://repo1.maven.org/maven2/io/netty/netty/3.9.2.Final/netty-3.9.2.Final.jar ...
[info]  [SUCCESSFUL ] io.netty#netty;3.9.2.Final!netty.jar(bundle) (48658ms)
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.typesafe.play#play-iteratees_2.10;2.3.0: not found
[warn]  :: com.typesafe.play#play-json_2.10;2.3.0: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: unresolved dependency: com.typesafe.play#play-iteratees_2.10;2.3.0: not found
unresolved dependency: com.typesafe.play#play-json_2.10;2.3.0: not found

java.lang.UnsupportedOperationException: Flush has no OperationStatus.

Before some of my integration tests I run the following:

def dropAll = {
    Await.ready(PlayCouchbase.bucket("default").flush(), timeout)
}

But it spews a warning:

2014-11-28 12:14:34.440 WARN com.couchbase.client.CouchbaseClient$19:  Exception thrown wile executing org.reactivecouchbase.client.CouchbaseFutures$$anon$6.operationComplete()
java.lang.UnsupportedOperationException: Flush has no OperationStatus.
    at com.couchbase.client.CouchbaseClient$19.getStatus(CouchbaseClient.java:1967)
    at org.reactivecouchbase.client.CouchbaseFutures$.org$reactivecouchbase$client$CouchbaseFutures$$complete$7(CouchbaseFutures.scala:315)
    at org.reactivecouchbase.client.CouchbaseFutures$$anon$6.onComplete(CouchbaseFutures.scala:327)
    at org.reactivecouchbase.client.CouchbaseFutures$$anon$6.onComplete(CouchbaseFutures.scala:326)
    at net.spy.memcached.internal.AbstractListenableFuture$1.run(AbstractListenableFuture.java:117)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

It looks like the client is trying to get a status for an operation that doesn't have one?

Reconnecting after Node/Cluster bounce

Hello,

We are switching over from the official java client to the scala reactive couchbase client. While doing some tests (bouncing nodes) we noticed that the client doesn't automatically reconnect. Given that couchbase is all about high availability I'm assuming something is wrong in our application.conf.

I can't find documentation anywhere though setting reconnect attempts and time between reconnects. Can you please provide some information?

Handling non-string numeric Keys

Hi

Is there a preferred way of querying a view that has a non-string value (for instance, timestamp) as part of the Key? right now it appears that all added objects from the ComplexKey.of( java.lang.Object...) get converted to strings, which causes no value to be returned (the quoted timestamp doesnt match on the numeric value)

If you leave the objects as their native type, say Long for timestamp (millis), you get an implicit error conversion. Anyone else see this?

omitting some case class properties

Is there anyway I can keep a few of my case class properties from being persisted? they are transient :)
Is the only way writing my down JSON formatter?

Create 0.2 (non snapshot) Version

ReactiveCouchbase-core looks stable enough to have a non snapshot version. Without that a usage in a production environment is rather risky

Couchbase as an Idempotent Repository

I want to implement an Idempotent Repository on Couchbase with three synchronous add, contains, remove operations, which will be called concurrently in a very high rate (5000 calls/sec each)

my very simple implementation is as below:

//Remove Op
val res = Await.result( bucket.delete( key ), 1 second )

// Contains check
val res = Await.result( bucket.get[String]( key ), 1 second )
res.exists( _ => true )

// Add operation
val res = Await.result( bucket.add( key, System.currentTimeMillis, CouchbaseExpirationTiming_byDuration( expiry ) ), 1 second )
res.isSuccess

however this is not scalable and my operations time out under load.
How can I achieve better implementation? can stream methods help me with sync operations needed above?

atomicUpdate return AtomicSucess(key)

I'm using atomicUpdate to update a document, but in some cases the method does not return a document of type T, but instead AtomicSucess(j-ivaawJH6g) where j-ivaawJH6g is the key of my document

Is that intended behvaiour. It does not match the signature of the method

/Niels

getBulk

hi,

Can you please provide an example of how to perform bulk get operation using reactivecouchbase?

thanks,
Chen.

View Response in write-intensive loads

I'm evaluating Couchbase in a scenario which I have about 500 writes/second (using set to store new requests). For each key, a few seconds later, I should call a view (so it can't be stale), and then do an update (get to fetch the document and then set with updated document) on that key.

The problem is I constantly see Couchbase indexing that view, and my view result futures are called back very late... a minute after or so.... in high load.
Am I miss using API? Any configuration/tune ups?

P.S. I'm a heavy CouchDB user, and had no problems in such a case with that.

Null Pointer Exception on Find queries when Couchbase returns a null document

There seem to be a bug here:
https://github.com/ReactiveCouchbase/ReactiveCouchbase-core/blob/master/driver/src/main/scala/org/reactivecouchbase/client/Queries.scala#L226

  def search[T](view: View)(query: Query)(implicit bucket: CouchbaseBucket, r: Reads[T], ec: ExecutionContext): QueryEnumerator[TypedRow[T]] = {
    QueryEnumerator(() => rawSearch(view)(query)(bucket, ec).toEnumerator.map { enumerator =>
      enumerator &>
        Enumeratee.map[RawRow] { row =>
          row.document.map { doc =>
            JsRow[T](r.reads(Json.parse(doc)), row.id, row.key, row.value)
          }.getOrElse(
            JsRow[T](JsError(), row.id, row.key, row.value)
          )
        } &>
        Enumeratee.collect[JsRow[T]] {
          case JsRow(JsSuccess(doc, _), id, key, value) => TypedRow[T](doc, id, key, value)
          case JsRow(JsError(errors), _, _, _) if bucket.jsonStrictValidation => throw new JsonValidationException("Invalid JSON content", JsError.toFlatJson(errors))
        }
    })
  }

Sometimes my Couchbase server returns me a RawRow with a Some(null) as document. It happens sometimes during stress testing (not sure why yet, but it seems it can happen).

So of course Json.parse(null) fails and throw a Null Pointer Exception. Checking if doc is null fixes the issue. Seems like this should be done.

reactivecouchbase not recovering from lost nodes

I am trying to use a multi node configuration in the bucket definition (in my case I use it in play but I assume it the same for the core library).

I tested failure by failing one of the nodes and noticed that reactivecouchbase throws exceptions (timeout etc)

Any help is appreciated. Here is the configuration I'm using (0.3-SNAPSHOT):

couchbase {
  actorctx {
    timeout=10000
    execution-context {
      fork-join-executor {
        parallelism-factor = 4.0
        parallelism-max = 40
      }
    }
  }
  driver {
    enableoperationtimeout=true # fail scala future and print a message on operations when the actorctx.timeout is reached
}  
  buckets = [{
    host=["IP1","IP2","IP3","IP4","IP5","IP6"]
    port="8091",
.......

problems incrementing and updating counters in 0.3

In 0.2 thew following test passed without any problems

  "CouchBase" should {
    "be able to increment a counter" in {
          val couchBaseTrait = new CouchBase{}
          val bucket = couchBaseTrait.bucket
          val status = Await.result( bucket.set("testkey", 0 ) , Duration(100000,"millis") )
          status.isSuccess must beTrue
          val counterResult =  Await.result( bucket.incrAndGet("testkey", 1) , Duration(100000,"millis") )
          counterResult must beEqualTo(1)
          Await.result( bucket.incrAndGet("testkey", 1) , Duration(100000,"millis") ) must beEqualTo(2)
          Await.result( bucket.incrAndGet("testkey", 100) , Duration(100000,"millis") ) must beEqualTo(102)
    }
    "be able to set a counter" in {
          val couchBaseTrait = new CouchBase{}
          val bucket = couchBaseTrait.bucket
          val increment : Int = 100

          Await.result( bucket.delete("testkey2"), Duration(100000,"millis") )
          Await.result( bucket.add("testkey2", 0), Duration(100000,"millis") )
          Await.result( bucket.incrAndGet("testkey2", increment) , Duration(100000,"millis") ) must beEqualTo(100)
    }

  }

but when upgrading to 0.3 It fails with

[info] CouchBaseSpec
[info]
[info] CouchBase should
[info] ! be able to increment a counter
[error]    IllegalStateException: : Value isn't an int  (Counters.scala:15)
[error] org.reactivecouchbase.client.Counters$$anonfun$getInt$1.apply(Counters.scala:15)
[error] org.reactivecouchbase.client.Counters$$anonfun$getInt$1.apply(Counters.scala:13)
[info]
[info] ! be able to set a counter
[error]    IllegalStateException: : Value isn't an int  (Counters.scala:15)
[error] org.reactivecouchbase.client.Counters$$anonfun$getInt$1.apply(Counters.scala:15)
[error] org.reactivecouchbase.client.Counters$$anonfun$getInt$1.apply(Counters.scala:13)
[info]
[info]

The problem seems to be that the couchbase client doesn't return a long, but instead a string. I checked in couchbase bucket and there the key is a number

Is this the intended behaviour

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.