lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Miller (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SOLR-5823) Add utility function for internal code to know if it is currently the overseer
Date Sat, 08 Mar 2014 02:37:42 GMT

    [ https://issues.apache.org/jira/browse/SOLR-5823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13924674#comment-13924674
] 

Mark Miller commented on SOLR-5823:
-----------------------------------

bq.  ... is that bug?

It does look jacked. Keep in mind that Overseer#close will close *and* interrupt though. I
think we want to make the following changes though:

{noformat}
Index: solr/core/src/java/org/apache/solr/cloud/Overseer.java
===================================================================
--- solr/core/src/java/org/apache/solr/cloud/Overseer.java	(revision 1575447)
+++ solr/core/src/java/org/apache/solr/cloud/Overseer.java	(working copy)
@@ -81,8 +81,8 @@
     //Internal queue where overseer stores events that have not yet been published into cloudstate
     //If Overseer dies while extracting the main queue a new overseer will start from this
queue 
     private final DistributedQueue workQueue;
-    private volatile boolean isClosed;
     private Map clusterProps;
+    private boolean isClosed = false;
 
     public ClusterStateUpdater(final ZkStateReader reader, final String myId) {
       this.zkClient = reader.getZkClient();
@@ -1030,20 +1030,22 @@
 
   class OverseerThread extends Thread implements ClosableThread {
 
-    private volatile boolean isClosed;
+    protected volatile boolean isClosed;
+    private ClosableThread thread;
 
-    public OverseerThread(ThreadGroup tg,
-        ClusterStateUpdater clusterStateUpdater) {
-      super(tg, clusterStateUpdater);
+    public OverseerThread(ThreadGroup tg, ClosableThread thread) {
+      super(tg, (Runnable) thread);
+      this.thread = thread;
     }
 
-    public OverseerThread(ThreadGroup ccTg,
-        OverseerCollectionProcessor overseerCollectionProcessor, String string) {
-      super(ccTg, overseerCollectionProcessor, string);
+    public OverseerThread(ThreadGroup ccTg, ClosableThread thread, String name) {
+      super(ccTg, (Runnable) thread, name);
+      this.thread = thread;
     }
 
     @Override
     public void close() {
+      thread.close();
       this.isClosed = true;
     }
 
@@ -1084,8 +1086,7 @@
     ThreadGroup ccTg = new ThreadGroup("Overseer collection creation process.");
 
     ocp = new OverseerCollectionProcessor(reader, id, shardHandler, adminPath);
-    ccThread = new OverseerThread(ccTg, ocp,
-        "Overseer-" + id);
+    ccThread = new OverseerThread(ccTg, ocp, "Overseer-" + id);
     ccThread.setDaemon(true);
     
     updaterThread.start();

{noformat}

> Add utility function for internal code to know if it is currently the overseer
> ------------------------------------------------------------------------------
>
>                 Key: SOLR-5823
>                 URL: https://issues.apache.org/jira/browse/SOLR-5823
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Hoss Man
>         Attachments: SOLR-5823.patch, SOLR-5823.patch, SOLR-5823.patch, SOLR-5823.patch
>
>
> It would be useful if there was some Overseer equivalent to CloudDescriptor.isLeader()
that plugins running in solr could use to know "At this moment, am i the leader?" 



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message