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

Stig Rohde Døssing commented on ZOOKEEPER-3781:
-----------------------------------------------

We are also seeing this on versions from 3.5.7 to 3.6.2.

I took at look at when snapshots are written, and it seems to be in these cases:

* The node is starting off an empty database 
(https://github.com/apache/zookeeper/blob/release-3.6.2/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/FileTxnSnapLog.java#L291)
* If the node is becoming leader 
(https://github.com/apache/zookeeper/blob/release-3.6.2/zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperServer.java#L511)
* If the node is following, received UPTODATE and the protocol is pre ZAB 1.0, 
which is not happening in 3.5.x+ 
(https://github.com/apache/zookeeper/blob/release-3.6.2/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Learner.java#L669)
* If the node is following and did not receive DIFF from the leader, i.e. the 
follower is far behind the leader 
(https://github.com/apache/zookeeper/blob/release-3.6.2/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Learner.java#L689)
* If the node has received enough transactions (controlled by snapCount) that 
the periodic snapshot should be written 
(https://github.com/apache/zookeeper/blob/release-3.6.2/zookeeper-server/src/main/java/org/apache/zookeeper/server/SyncRequestProcessor.java#L193)

This leads me to believe that there are the following workarounds, unless you 
want to run with snapshot.trust.empty=true long-term:

* Leave the cluster running with snapshot.trust.empty=true until enough 
transactions has been written to trigger a snapshot write. The default 
snapCount is 100.000, but this could be temporarily lowered.
* While leaving a quorum running, shut down the nodes without snapshots and 
delete their data. When they restart, the leader will send them a snapshot 
instead of DIFF.

I think it would be nice if this could be fixed in a future Zookeeper version 
to make migration easier. Maybe followers could ask for a full snapshot from 
the leader if snapshot.trust.empty=true, or they could write a snapshot on boot?

> Zookeeper 3.5.7 not creating snapshot
> -------------------------------------
>
>                 Key: ZOOKEEPER-3781
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3781
>             Project: ZooKeeper
>          Issue Type: Bug
>            Reporter: Weichu Liu
>            Priority: Major
>         Attachments: zk_no_snapshot.zip
>
>
> Hi,
> In our deployment, we are using zookeepers as Kafka quorum.
> Recently we upgraded Zookeeper from 3.4.14 to 3.5.7.
> During the upgrade, we enabled snapshot.trust.empty and removed it after.
> However, about 25% of zookeepers (all on 3.5.7) are not creating snapshot 
> files, so they keep crashing on reboot with ERROR.
> {noformat}
> ERROR [main:QuorumPeer@937] - Unable to load database on disk
> <http://java.io|java.io>.IOException: No snapshot found, but there are log 
> entries. Something is broken!
> {noformat}
> Nothing suspecious did I find from the zookeeper log.
> I managed to reproduce the issue with the data from our servers, I put them 
> in the attachment.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to