Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make statusFile globally-writable #37

Open
wants to merge 2 commits into
base: li-dev/release-3.6.2-1-backup
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@
import org.apache.jute.BinaryOutputArchive;
import org.apache.jute.InputArchive;
import org.apache.jute.OutputArchive;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Coordinate the backup status among processes local to a server;
* coordination across servers is better served via either an extension
* to the ZAB protocol or by some external mechanism.
*/
public class BackupStatus {
private static final Logger LOG = LoggerFactory.getLogger(BackupStatus.class);

/**
* The name for the backup status file.
*/
Expand Down Expand Up @@ -133,8 +137,12 @@ public synchronized void update(long logZxid, long snapZxid) throws IOException
}

if (!statusFile.exists()) {
System.out.println("Creating file " + statusFile.getAbsolutePath());
LOG.info("BackupStatus::update(): Creating statusFile " + statusFile.getAbsolutePath());
statusFile.createNewFile();
statusFile.setReadable(true, false);
// TODO: potentially insecure. making this writable might make this vulnerable to tampering
// TODO: but file lock file needs to be worldwide-writable
statusFile.setWritable(true, false);
}

FileOutputStream os = null;
Expand Down