Implemented first version of logging

Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
Jim Martens 2017-05-19 12:53:47 +02:00
parent 14ebb872ac
commit 3ea966dcc9
1 changed files with 12 additions and 0 deletions

View File

@ -1,5 +1,7 @@
import org.jetbrains.annotations.Contract;
import java.io.FileWriter;
import java.io.IOException;
import java.util.*;
/**
@ -111,6 +113,16 @@ public class PersistenceManager {
* @return log sequence number
*/
private int log(int taid, int pageid, String data) {
try {
FileWriter fw = new FileWriter("../data/log.txt", true);
// TODO properly create redo data
fw.write("" + _nextLogSequenceNumber + "," + taid + "," + pageid + "," + data);
fw.write("\n");
fw.close();
} catch (IOException e) {
e.printStackTrace();
}
return _nextLogSequenceNumber++;
}