Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 03A9F200CC5 for ; Tue, 27 Jun 2017 08:13:05 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 02517160BF8; Tue, 27 Jun 2017 06:13:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 24CAC160BDA for ; Tue, 27 Jun 2017 08:13:03 +0200 (CEST) Received: (qmail 87485 invoked by uid 500); 27 Jun 2017 06:13:03 -0000 Mailing-List: contact dev-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zookeeper.apache.org Delivered-To: mailing list dev@zookeeper.apache.org Received: (qmail 87472 invoked by uid 99); 27 Jun 2017 06:13:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Jun 2017 06:13:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id B8784C061B for ; Tue, 27 Jun 2017 06:13:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -97.888 X-Spam-Level: X-Spam-Status: No, score=-97.888 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, URI_HEX=1.313, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id shTuaBpHuLlJ for ; Tue, 27 Jun 2017 06:13:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id E56945FE1F for ; Tue, 27 Jun 2017 06:13:00 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 6BC37E0D76 for ; Tue, 27 Jun 2017 06:13:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 238A524128 for ; Tue, 27 Jun 2017 06:13:00 +0000 (UTC) Date: Tue, 27 Jun 2017 06:13:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: dev@zookeeper.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (ZOOKEEPER-2819) Changing membership configuration via rolling restart does not work on 3.5.x. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 27 Jun 2017 06:13:05 -0000 [ https://issues.apache.org/jira/browse/ZOOKEEPER-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16064338#comment-16064338 ] ASF GitHub Bot commented on ZOOKEEPER-2819: ------------------------------------------- Github user asdf2014 commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/292#discussion_r124185161 --- Diff: src/java/test/org/apache/zookeeper/server/quorum/ReconfigRollingRestartCompatibilityTest.java --- @@ -0,0 +1,94 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.zookeeper.server.quorum; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; + +import org.apache.zookeeper.PortAssignment; +import org.apache.zookeeper.test.ClientBase; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import static org.apache.zookeeper.test.ClientBase.CONNECTION_TIMEOUT; + +/** + * ReconfigRollingRestartCompatibilityTest - we want to make sure that users + * can continue using the rolling restart approach when reconfig feature is disabled. + * It is important to stay compatible with rolling restart because dynamic reconfig + * has its limitation: it requires a quorum of server to work. When no quorum can be formed, + * rolling restart is the only approach to reconfigure the ensemble (e.g. removing bad nodes + * such that a new quorum with smaller number of nodes can be formed.). + * + * See ZOOKEEPER-2819 for more details. + */ +public class ReconfigRollingRestartCompatibilityTest extends QuorumPeerTestBase { + private static final String backupFileName = "zoo.cfg.bak"; + + final int SERVER_COUNT = 3; + final int clientPorts[] = new int[SERVER_COUNT]; + final String serverList[] = new String[SERVER_COUNT]; + StringBuilder sb = new StringBuilder(); + + @Before + public void setup() throws InterruptedException { + String server; + for (int i = 0; i < SERVER_COUNT; i++) { + clientPorts[i] = PortAssignment.unique(); + server = "server." + i + "=localhost:" + PortAssignment.unique() + + ":" + PortAssignment.unique() + ":participant;localhost:" + + clientPorts[i]; + serverList[i] = server; + sb.append(server + "\n"); + } + } + + @Test(timeout = 60000) + public void testNoLocalDynamicConfigAndBackupFiles() + throws InterruptedException, IOException { + String currentQuorumCfgSection = sb.toString(); + QuorumPeerTestBase.MainThread mt[] = new QuorumPeerTestBase.MainThread[SERVER_COUNT]; + String[] staticFileContent = new String[SERVER_COUNT]; + + for (int i = 0; i < SERVER_COUNT; i++) { + mt[i] = new QuorumPeerTestBase.MainThread(i, clientPorts[i], + currentQuorumCfgSection, false); + mt[i].start(); + } + + for (int i = 0; i < SERVER_COUNT; i++) { + Assert.assertTrue("waiting for server " + i + " being up", + ClientBase.waitForServerUp("127.0.0.1:" + clientPorts[i], + CONNECTION_TIMEOUT)); + Assert.assertNull("static file backup (zoo.cfg.bak) shouldn't exist!", + mt[i].getFileByName(backupFileName)); + Assert.assertNull("dynamic configuration file (zoo.cfg.dynamic.*) shouldn't exist!", + mt[i].getFileByName(mt[i].getQuorumPeer().getNextDynamicConfigFilename())); + staticFileContent[i] = Files.readAllLines(mt[i].confFile.toPath(), StandardCharsets.UTF_8).toString(); + Assert.assertTrue("static config file should contain server entry " + serverList[i], + staticFileContent[i].contains(serverList[i])); + } + + for (int i = 0; i < SERVER_COUNT; i++) { + mt[i].shutdown(); + } + } +} --- End diff -- Should add a new line for the end of file. > Changing membership configuration via rolling restart does not work on 3.5.x. > ----------------------------------------------------------------------------- > > Key: ZOOKEEPER-2819 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2819 > Project: ZooKeeper > Issue Type: Bug > Components: quorum, server > Affects Versions: 3.5.0, 3.5.1, 3.5.2, 3.5.3 > Reporter: Michael Han > Assignee: Michael Han > Priority: Critical > > In 3.5.x there is no easy way of changing the membership config using rolling restarts because of the introduction of dynamic reconfig feature in ZOOKEEPER-107, which automatically manages membership configuration parameters. > ZOOKEEPER-2014 introduced a reconfigEnabled flag to turn on / off the reconfig feature. We can use same flag and when it sets to false, it should disable both in memory and on disk updates of membership configuration information, besides disabling the reconfig commands on CLI which ZOOKEEPER-2014 already did, so users can continue using rolling restarts if needed. > We should also document explicitly the support of membership changes via rolling restarts will be deprecated at what release time frame and promote reconfig as the replacement. > The problem was raised at user mailing list by Guillermo Vega-Toro, reference thread: > http://zookeeper-user.578899.n2.nabble.com/How-to-add-nodes-to-a-Zookeeper-3-5-3-beta-ensemble-with-reconfigEnabled-false-td7583138.html -- This message was sent by Atlassian JIRA (v6.4.14#64029)