|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--arlut.csd.ganymede.DBJournal
The DBJournal class is used to provide journalling of changes to the
DBStore
during operations. The Journal file will contain a complete list of all
changes made since the last dump of the complete DBStore. The Journal file
is composed of a header block followed by a number of transactions.
Each transaction consists of a number of object modification records, each record specifying the creation, deletion, or modification of a particular object. At the end of the transaction, a marker indicates the completion of the transaction. At DBStore startup time, the journal is read in and all complete transactions recorded are performed on the main DBStore.
Generally, if the DBStore was shut down correctly, the entire memory structure of the DBStore will be cleanly dumped out and the Journal will be removed. The Journal is intended to insure that the DBStore remains transaction consistent if the server running Ganymede crashes during runtime.
See the DBEditSet class for
more information on Ganymede transactions.
| Field Summary | |
(package private) static java.lang.String |
CLOSETRANS
|
(package private) static byte |
CREATE
|
(package private) static boolean |
debug
|
(package private) static byte |
DELETE
|
(package private) boolean |
dirty
|
(package private) static byte |
EDIT
|
(package private) java.lang.String |
filename
|
(package private) static java.lang.String |
id_string
|
(package private) java.io.RandomAccessFile |
jFile
|
(package private) static byte |
major_version
|
(package private) static byte |
minor_version
|
(package private) static java.lang.String |
OPENTRANS
|
(package private) arlut.csd.ganymede.DBStore |
store
|
(package private) int |
transactionsInJournal
|
| Fields inherited from interface arlut.csd.ganymede.ObjectStatus |
CREATING, DELETING, DROPPING, EDITING |
| Constructor Summary | |
DBJournal(arlut.csd.ganymede.DBStore store,
java.lang.String filename)
The DBJournal constructor takes a filename and creates a DBJournal object. |
|
| Method Summary | |
(package private) static void |
initialize(java.io.DataOutput out)
|
boolean |
isClean()
returns true if the journal does not contain any transactions |
boolean |
load()
The load() method reads in all transactions in the current DBStore Journal and makes the appropriate changes to the DBStore Object Bases. |
private void |
printObject(arlut.csd.ganymede.DBObject obj)
|
(package private) void |
readHeaders()
This method is used to read and check the first few fields of the journal as a sanity check on journal open/load. |
void |
reset()
The reset() method is used to copy the journal file to a safe location and truncate it. |
static void |
setDebug(boolean val)
|
boolean |
writeTransaction(arlut.csd.ganymede.DBEditObject[] objects)
The writeTransaction() method actually performs the full work of writing out a transaction to the DBStore Journal. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
static boolean debug
static final java.lang.String id_string
static final byte major_version
static final byte minor_version
static final java.lang.String OPENTRANS
static final java.lang.String CLOSETRANS
static final byte CREATE
static final byte EDIT
static final byte DELETE
java.lang.String filename
java.io.RandomAccessFile jFile
arlut.csd.ganymede.DBStore store
boolean dirty
int transactionsInJournal
| Constructor Detail |
public DBJournal(arlut.csd.ganymede.DBStore store,
java.lang.String filename)
throws java.io.IOException
The DBJournal constructor takes a filename and creates a DBJournal object. If the file named does not exist, the DBJournal constructor will create the file and write the DBJournal header, leaving the file pointer pointing to the end of the file. If the Journal file does exist, the constructor will advance the file pointer to the end of the file.
In either case, the file will be made ready for new transactions to be written.
| Method Detail |
public static void setDebug(boolean val)
static void initialize(java.io.DataOutput out)
throws java.io.IOException
java.io.IOException
public void reset()
throws java.io.IOException
java.io.IOException
public boolean load()
throws java.io.IOException
The load() method reads in all transactions in the current DBStore Journal and makes the appropriate changes to the DBStore Object Bases. This method should be called after the main body of the DBStore is loaded and before the DBStore is put into production mode.
load() will return true if the on-disk journal was in a consistent state, with no incomplete transactions. If load() encounters EOF in the middle of attempting to read in a transaction record, load() will return false. In either case, any valid and complete transaction records will be processed and integrated into the DBStore.
java.io.IOException
public boolean writeTransaction(arlut.csd.ganymede.DBEditObject[] objects)
throws java.io.IOException
java.io.IOExceptionpublic boolean isClean()
void readHeaders()
throws java.io.IOException
This method is used to read and check the first few fields of the journal as a sanity check on journal open/load.
This method MUST NOT be called after the journal is open and active, or else the journal will become corrupted.
java.io.IOExceptionprivate void printObject(arlut.csd.ganymede.DBObject obj)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||