Skip to content

Commit fbdd468

Browse files
committed
add check aof writtable (#67)
1 parent 3a5fe38 commit fbdd468

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

core/src/main/java/dev/keva/core/aof/AOFContainer.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,16 @@ public void init() {
3333
FileOutputStream fos = new FileOutputStream(getWorkingDir() + "keva.aof", true);
3434
output = isExists ? new AppendOnlyObjectOutputStream(fos) : new ObjectOutputStream(fos);
3535
} catch (IOException e) {
36-
log.error("Error creating AOF file", e);
36+
if (e instanceof FileNotFoundException) {
37+
log.info("AOF file not found, creating new file...");
38+
if (e.getMessage().contains("Permission denied")) {
39+
log.error("Permission denied to access AOF file, please check your file permissions");
40+
System.exit(1);
41+
}
42+
} else {
43+
log.error("Error writing to AOF file", e);
44+
System.exit(1);
45+
}
3746
}
3847

3948
if (kevaConfig.getAofInterval() != 0) {

0 commit comments

Comments
 (0)