Giter Club home page Giter Club logo

Comments (18)

andreaTP avatar andreaTP commented on September 4, 2024

👍

from solrs.

magro avatar magro commented on September 4, 2024

Strange: I'd say that this is caused by the warmup queries (see also commit f97c402) - but as it seems you don't set warmupQueries on the CloudSolrServers. Can you please double check that you're not setting warmupQueries?

from solrs.

andreaTP avatar andreaTP commented on September 4, 2024

Confirmed:
warmupQueries is not setted

from solrs.

magro avatar magro commented on September 4, 2024

Just looking into this, and I cannot reproduce this (in our application) with the setup code you posted.
What I find really weird is that you write that serversSolr.setAsyncSolrClient(solr) fixes the problem for you - which is already done by AsyncSolrClient.Builder.build: https://github.com/inoio/solrs/blob/master/src/main/scala/io/ino/solrs/AsyncSolrClient.scala#L96

Looking further into this...

from solrs.

magro avatar magro commented on September 4, 2024

Btw, does it matter how much time is spent after the creation of the AsyncSolrClient instance before you call solr.query(myquery) the first time?

from solrs.

magro avatar magro commented on September 4, 2024

Assuming you have set the log level for "io.ino.solrs" to INFO, (when) do you see the log message "Connected to zookeeper at ", and how does it change if you additionally call serversSolr.setAsyncSolrClient(solr)?

from solrs.

fralken avatar fralken commented on September 4, 2024

It doesn't metter how long I wait after creation of AsyncSolrClient and the first call to solr.query(myquery).

Without yhe additional call I have the following log:

[info] play - Application started (Dev)
[info] i.i.s.CloudSolrServers - Connected to zookeeper at ...
[info] i.i.s.CloudSolrServers - Successfully created ZK cluster state watchers at ...
[error] play - Cannot invoke the action, eventually got an error: org.apache.solr.client.solrj.SolrServerException: No solr server available.
...
...
[info] i.i.s.CloudSolrServers - Updated server map: ...

When adding the additional call serversSolr.setAsyncSolrClient(solr)I have:

[info] play - Application started (Dev)
[info] i.i.s.CloudSolrServers - Connected to zookeeper at ... 
[info] i.i.s.CloudSolrServers - Successfully created ZK cluster state watchers at ...
[info] i.i.s.CloudSolrServers - Connected to zookeeper at ...
[info] i.i.s.CloudSolrServers - Updated server map: ...

As you can see, the Connected to zookeeper atappears twice this time, and the first query is succesful.

from solrs.

fralken avatar fralken commented on September 4, 2024

Ok, it appears in my code that the AsyncSolrClient is actually initialized just before the first solr.query(). Since I see the "update server map" is scheduled to run after 1 second, that is why I get "no solr servers available". If I force in some ways the initialization of AsyncSolrClient and then wait before the first solr.query(), it works fine.

Maybe it could be convenient in initZkStateReader to invoke updateFromClusterState once before scheduling for execution, so that we are sure the state of the client is consistent as soon as it is created.

from solrs.

magro avatar magro commented on September 4, 2024

Thanx for the log extracts! Can you also set the log level for org.apache.solr.common.cloud to INFO, please? It would also be helpful to have timestamps there as well.

Re updateFromClusterState: this is scheduled with initialDelay=0 (https://github.com/inoio/solrs/blob/master/src/main/scala/io/ino/solrs/SolrServers.scala#L139), so it should be invoked right away - only the thread creation time is added. We could also add debug log statements to updateFromClusterState to debug this.

from solrs.

fralken avatar fralken commented on September 4, 2024

I agree that initialDelay=0 but for some reason it is not executed as soon as it is scheduled

from solrs.

fralken avatar fralken commented on September 4, 2024

I added log level INFO for org.apache.solr.common.cloud...

[info] play - Application started (Dev)
[info] o.a.s.c.c.SolrZkClient - Using default ZkCredentialsProvider
[info] o.a.s.c.c.ConnectionManager - Waiting for client to connect to ZooKeeper
[info] o.a.s.c.c.ConnectionManager - Watcher org.apache.solr.common.cloud.ConnectionManager@2526db49 name:ZooKeeperConnection Watcher:... got event WatchedEvent state:SyncConnected type:None path:null path:null type:None
[info] o.a.s.c.c.ConnectionManager - Client is connected to ZooKeeper
[info] o.a.s.c.c.SolrZkClient - Using default ZkACLProvider
[info] i.i.s.CloudSolrServers - Connected to zookeeper at ...
[info] o.a.s.c.c.ZkStateReader - Updating cluster state from ZooKeeper... 
[info] i.i.s.CloudSolrServers - Successfully created ZK cluster state watchers at ...
[error] play - Cannot invoke the action, eventually got an error: org.apache.solr.client.solrj.SolrServerException: No solr server available.

from solrs.

andreaTP avatar andreaTP commented on September 4, 2024

with akka scheduled jobs are executed asynchronously and execution time is not strongly guaranteed.
Moreover:
https://github.com/akka/akka/blob/67ca6e5dc70509d279a005763a30fb0bd7c871df/akka-actor/src/main/scala/akka/actor/Scheduler.scala#L299

so 0 delay means an interval 0 > T < (1/maxFrequency)

from solrs.

andreaTP avatar andreaTP commented on September 4, 2024

here is the reference (yellow box:
http://doc.akka.io/docs/akka/2.3.4/scala/scheduler.html
)

from solrs.

fralken avatar fralken commented on September 4, 2024

In initZkStateReaderyou could initialize the update like this:

  // Now regularly update the server list from ZkStateReader clusterState
  updateFromClusterState(zkStateReader)
  scheduledExecutor.scheduleAtFixedRate(new Runnable {
    override def run(): Unit = updateFromClusterState(zkStateReader)
  }, clusterStateUpdateInterval.toMillis, clusterStateUpdateInterval.toMillis, TimeUnit.MILLISECONDS)

so that the first execution is guaranteed to be synchronus, and then the other are scheduled to be executed starting after the desired interval

from solrs.

magro avatar magro commented on September 4, 2024

I just changed it like this, its as version 1.3.2 on its way to maven central. Does this work for you?

from solrs.

fralken avatar fralken commented on September 4, 2024

Yes, it works. Thanks.

from solrs.

magro avatar magro commented on September 4, 2024

Great!

from solrs.

andreaTP avatar andreaTP commented on September 4, 2024

tnx!

from solrs.

Related Issues (20)

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.