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 5B5A2200C21 for ; Mon, 20 Feb 2017 14:13:49 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 5A016160B62; Mon, 20 Feb 2017 13:13:49 +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 A4586160B73 for ; Mon, 20 Feb 2017 14:13:48 +0100 (CET) Received: (qmail 31990 invoked by uid 500); 20 Feb 2017 13:13:47 -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 31978 invoked by uid 99); 20 Feb 2017 13:13:47 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Feb 2017 13:13:47 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 391ACC0835 for ; Mon, 20 Feb 2017 13:13:47 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.999 X-Spam-Level: X-Spam-Status: No, score=0.999 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id FljiBkPf6qKQ for ; Mon, 20 Feb 2017 13:13:46 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 0D9B55F1B8 for ; Mon, 20 Feb 2017 13:13:46 +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 22BB5E03A1 for ; Mon, 20 Feb 2017 13:13:45 +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 55CC124123 for ; Mon, 20 Feb 2017 13:13:44 +0000 (UTC) Date: Mon, 20 Feb 2017 13:13:44 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: dev@zookeeper.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (ZOOKEEPER-2700) Force ZooKeeper to generate snapshot MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 20 Feb 2017 13:13:49 -0000 [ https://issues.apache.org/jira/browse/ZOOKEEPER-2700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15874512#comment-15874512 ] ASF GitHub Bot commented on ZOOKEEPER-2700: ------------------------------------------- Github user eribeiro commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/180#discussion_r101970085 --- Diff: src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java --- @@ -303,15 +305,38 @@ public void loadData() throws IOException, InterruptedException { public void takeSnapshot(){ try { + lastSnapshotZxid = zkDb.getDataTreeLastProcessedZxid(); + isGeneratingSnapshot.incrementAndGet(); + txnLogFactory.save(zkDb.getDataTree(), zkDb.getSessionWithTimeOuts()); } catch (IOException e) { LOG.error("Severe unrecoverable error, exiting", e); // This is a severe error that we cannot recover from, // so we need to exit System.exit(10); + } finally { + isGeneratingSnapshot.decrementAndGet(); } } + public boolean tryTakeSnapshot() { --- End diff -- In Java codebases we usually replace the "try" prefix by "maybe". ;) So it becomes `maybeTakeSnapshot()`. > Force ZooKeeper to generate snapshot > ------------------------------------ > > Key: ZOOKEEPER-2700 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2700 > Project: ZooKeeper > Issue Type: Improvement > Reporter: Flier Lu > Priority: Minor > > When cold backup or remote offline sync Zookeeper instances, we need the latest snapshot. > Add a four letter `snap` command to force Zookeeper to generate snapshot. -- This message was sent by Atlassian JIRA (v6.3.15#6346)