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

ASF GitHub Bot commented on ZOOKEEPER-2700:
-------------------------------------------

Github user edwardoliveira commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/180#discussion_r101841044
  
    --- Diff: 
src/java/main/org/apache/zookeeper/server/command/SnapCommand.java ---
    @@ -0,0 +1,53 @@
    +/**
    + * 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.command;
    +
    +import org.apache.zookeeper.server.ServerCnxn;
    +import org.apache.zookeeper.server.ZooKeeperThread;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import java.io.IOException;
    +import java.io.PrintWriter;
    +
    +public class SnapCommand extends AbstractFourLetterCommand {
    +    private static final Logger LOG = 
LoggerFactory.getLogger(SnapCommand.class);
    +
    +    SnapCommand(PrintWriter pw, ServerCnxn serverCnxn) {
    +        super(pw,serverCnxn);
    +    }
    +
    +    @Override
    +    public void commandRun() throws IOException {
    +        if (!isZKServerRunning()) {
    +            pw.println(ZK_NOT_SERVING);
    +        } else {
    +            Thread snapInProcess = new ZooKeeperThread("Snapshot Thread") {
    --- End diff --
    
    Yup, suggested that one too. Either would be good, or both.


> 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)

Reply via email to