Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

CBQE-498: Fix cluster_run issues on xdcr-rebalance

Change-Id: I0bfd1de92842f99b0d1f023cc191d429aff06be7
Reviewed-on: http://review.couchbase.org/19681
Reviewed-by: Ketaki Gangal <ketakigangal@gmail.com>
Tested-by: Ketaki Gangal <ketakigangal@gmail.com>
  • Loading branch information...
commit f328c068ee578bf6f00e5ec3251ae878a25ac3fe 1 parent fdbd178
@ketakigangal ketakigangal authored ketakigangal committed
View
49 b/resources/dev-6-nodes-rebal-xdcr.ini
@@ -0,0 +1,49 @@
+[global]
+username:Administrator
+password:asdasd
+
+[membase]
+rest_username:Administrator
+rest_password:asdasd
+
+[cluster1]
+1:127.0.0.1_1
+2:127.0.0.1_2
+
+[cluster2]
+1:127.0.0.1_3
+2:127.0.0.1_4
+
+[servers]
+1:127.0.0.1_1
+2:127.0.0.1_2
+3:127.0.0.1_3
+4:127.0.0.1_4
+5:127.0.0.1_5
+6:127.0.0.1_6
+
+
+[127.0.0.1_1]
+ip:127.0.0.1
+port:9000
+
+[127.0.0.1_2]
+ip:127.0.0.1
+port:9001
+
+[127.0.0.1_3]
+ip:127.0.0.1
+port:9002
+
+[127.0.0.1_4]
+ip:127.0.0.1
+port:9003
+
+[127.0.0.1_5]
+ip:127.0.0.1
+port:9004
+
+[127.0.0.1_6]
+ip:127.0.0.1
+port:9005
+
View
18 lib/tasks/task.py
@@ -199,11 +199,25 @@ def add_nodes(self, task_manager):
def start_rebalance(self, task_manager):
rest = RestConnection(self.servers[0])
nodes = rest.node_statuses()
+
+ #Determine whether its a cluster_run/not
+ self.nodes_on_same_ip = True
+
+ firstIp = self.servers[0].ip
+ for node in self.servers:
+ if node.ip != firstIp:
+ self.nodes_on_same_ip = False
+ break
ejectedNodes = []
+
for server in self.to_remove:
for node in nodes:
- if server.ip == node.ip and int(server.port) == int(node.port):
- ejectedNodes.append(node.id)
+ if self.nodes_on_same_ip:
+ if int(server.port) == int(node.port):
+ ejectedNodes.append(node.id)
+ else:
+ if server.ip == node.ip and int(server.port) == int(node.port):
+ ejectedNodes.append(node.id)
rest.rebalance(otpNodes=[node.id for node in nodes], ejectedNodes=ejectedNodes)
def check(self, task_manager):
View
20 pytests/xdcr/xdcrbasetests.py
@@ -219,16 +219,16 @@ def _log_finish(self):
def _get_floating_servers(self):
cluster_nodes = []
- for key, nodes in self._clusters_dic.items():
- cluster_nodes.extend(nodes)
- #return set(self._servers[:]).difference(cluster_nodes)
- temp_list_cluster = []
- for i in cluster_nodes:
- temp_list_cluster.append(i.ip)
- floating_servers = []
- for i in self._servers:
- if not i.ip in temp_list_cluster:
- floating_servers.append(i)
+ floating_servers = self._servers
+
+ for key, node in self._clusters_dic.items():
+ cluster_nodes.extend(node)
+
+ for c_node in cluster_nodes:
+ for node in floating_servers:
+ if node.ip in str(c_node) and node.port in str(c_node):
+ floating_servers.remove(node)
+
return floating_servers
Please sign in to comment.
Something went wrong with that request. Please try again.