Comments (18)
👍
from solrs.
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.
Confirmed:
warmupQueries
is not setted
from solrs.
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.
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.
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.
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 at
appears twice this time, and the first query is succesful.
from solrs.
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.
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.
I agree that initialDelay=0 but for some reason it is not executed as soon as it is scheduled
from solrs.
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.
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.
here is the reference (yellow box:
http://doc.akka.io/docs/akka/2.3.4/scala/scheduler.html
)
from solrs.
In initZkStateReader
you 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.
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.
Yes, it works. Thanks.
from solrs.
Great!
from solrs.
tnx!
from solrs.
Related Issues (20)
- Add scala 3 support
- Add support for `shards.preference=replica.leader:false`
- Improve build: replace usage of setup-gpg with sbt-ci-release plugin
- RoundRobinLB not load balancing in update request with CloudSolrServers HOT 5
- Would this library support secured Solr with password? HOT 4
- Using query.process(client, collection) in Java HOT 5
- Load balancer is querying the wrong collection HOT 6
- Allow multiple instances of FastestServerLB globally HOT 2
- Paradox adds paradoxTheme to libraryDependencies
- Is there a best practice to use APIs HOT 1
- Publish for Scala 2.13.0-RC1 HOT 1
- java.lang.NoSuchMethodError: org.apache.solr.client.solrj.request.UpdateRequest.setCommitWithin HOT 9
- CloudSolrClient HOT 1
- Please add support for OpenTracing HOT 2
- RoundRobinLB idx is not thread safe HOT 2
- Serializable HOT 11
- Broken link in docs
- Support for solr8.8.2 HOT 5
- Migrate from travis-ci to github actions
- scala-xml version conflict HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from solrs.