DIRECTORY AlpineEnvironment, AlpineInternal, Basics; AlpineLog: DEFINITIONS = BEGIN TransID: TYPE = AlpineEnvironment.TransID; Comparison: TYPE = Basics.Comparison; RecordType: TYPE = AlpineInternal.LogRecordType; RecordID: TYPE = AlpineInternal.LogRecordID; nullRecordID: RecordID = AlpineInternal.nullLogRecordID; Compare: PROC [a, b: RecordID] RETURNS [Comparison]; firstRecordID: RecordID = AlpineInternal.firstRecordID; lastRecordID: RecordID = AlpineInternal.lastRecordID; Block: TYPE = RECORD [ base: LONG POINTER, length: CARDINAL, rest: BlockPtr _ NIL ]; BlockPtr: TYPE = LONG POINTER TO Block; nullBlock: Block = [base: NIL, length: 0, rest: NIL]; minBlockLen: INT = 1; maxBlockLen: INT = LAST[CARDINAL] - 512; RecoveryProc: TYPE = PROC [ record: RecordID, type: RecordType, trans: AlpineInternal.TransHandle, outcome: TransState]; TransState: TYPE = AlpineInternal.TransState; RegisterRecoveryProc: PROC [recordType: RecordType, recoveryProc: RecoveryProc]; ReadForRecovery: ReadProc; Write: PROC [ trans: AlpineInternal.TransHandle, recordType: RecordType, recordData: Block, force: BOOL _ FALSE] RETURNS [thisRecord, followingRecord: RecordID]; CoordinatorWrite: PROC [ trans: AlpineInternal.CoordinatorHandle, recordType: RecordType, recordData: Block, force: BOOL _ FALSE] RETURNS [thisRecord, followingRecord: RecordID]; WriteFailed: ERROR; Force: PROC [followingRecord: RecordID]; ReadProc: TYPE = PROC [thisRecord: RecordID, wordsToSkip: CARDINAL _ 0, to: Block] RETURNS [status: ReadProcStatus, wordsRead: CARDINAL]; ReadProcStatus: TYPE = {normal, destinationFull, sourceExhausted}; Read: ReadProc; END. CHANGE LOG Created by MBrown on 2-Dec-81 Changed by MBrown on 16-Dec-81 15:06:20 Changed by MBrown on 1-Feb-82 15:10:32 Changed by MBrown on 2-Feb-82 11:09:06 Changed by MBrown on June 23, 1982 4:16 pm Changed by MBrown on September 14, 1982 12:34 pm Changed by MBrown on September 15, 1982 8:39 pm Changed by MBrown on October 2, 1982 8:25 pm Changed by MBrown on October 3, 1982 10:42 pm Changed by MBrown on October 7, 1982 5:09 pm Changed by MBrown on October 11, 1982 3:21 pm Changed by MBrown on November 3, 1982 11:59 am Changed by MBrown on January 30, 1984 10:10:13 am PST JAlpineLog.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Last edited by MBrown on January 30, 1984 10:10:04 am PST Taft on 16-Feb-82 18:29:44 Hauser, March 8, 1985 10:41:36 am PST Carl Hauser, October 4, 1985 2:13:27 pm PDT A tag of type RecordType is associated with each log record as it is written. This is used to identify the recovery procedure responsible for the record. Uniquely identifies a record within a log. The 48 bit address space allows for several hundred years of log writing. No log record is identified by this value. The record with the smaller RecordID was written earlier in time. An inline version of Log.Compare is LogInline.Compare. for all r, Compare[firstRecordID, r] # greater for all r, Compare[lastRecordID, r] # less Essentially a list of descriptor for array of word. Used both for gather writing (e.g. system puts a header onto each log record) and for scatter reading (e.g. pages that are written contiguously in the log may be buffered in discontiguous virtual memory.) an underestimate of the true upper bound; no reasonable application should approach this. A recovery proc should call ReadForRecovery, not Read, to access the log record whose ID is passed to it. Attempting to read any other log record with ReadForRecovery will result in an error. {committed, aborted, ready} Any program that writes log records of a particular type is responsible for recovery of those records. As part of its PROGRAM proc (called by STARTing the module), the program should call RegisterRecoveryProc once for each type of record it writes. It is an error to call RegisterRecoveryProc after the update pass of recovery begins. Should be called only from a RecoveryProc, as explained above. See below for definition of type ReadProc. Note: Perform recovery before calling any of the procedures below. Log writing ! WriteFailed (online log is full - server should restart). ! WriteFailed (online log is full - server should restart). Force all records prior to (not including) followingRecord to be recorded stably in the online log. Log reading normal means destinationFull and sourceExhausted (normal termination for reading a fixed-length log record). Extracts all or part of the contents of a log record whose type and transaction are known, placing it in "to". Should be called during normal operation of the server to carry out intentions. Initialize takes a File.Capability, not the name of a server. Define interface that is decoupled from handles defined in other parts of Alpine. Change from stream to stateless style reading. Use 48 bit log record ids throughout. Add workerComplete to RecordType enumeration. Use AlpineEnvironment.FileID, not File.Capability; introduce Error and LogFailure. Move "Initialization and recovery" section to LogBasic. Added RegisterRecoveryProc, merged various forms of invalidRecordID, eliminated Release (still in LogBasic). Moved Format and Recover to LogControl. next _ NIL in Log.Block. Error -> LogFull (all other errors are really caller programming errors). recordExhausted: BOOL -> status: ReadProcStatus. ReadForRecovery introduced, and the readProc parm to RecoveryProc dropped. Added largestRecordID. Changed trans arg to Write from TransID to TransHandle; added CoordinatorWrite. Changed Environment -> Basics for Cedar 5.0. Hauser, March 8, 1985 10:41:10 am PST Nodified, added copyright. Κ=˜šœ™Icodešœ Οmœ1™<—šœ™Jšœ*™*Jšœ™K™%K™+—J˜˜šΟk ˜ J˜J˜J˜J˜——šœ ž œ˜Jšž˜Jšœ žœ˜*Jšœ žœ˜%J˜J˜šœ žœ ˜0JšœV™VJšœC™CJ˜—šœ žœ˜,JšœO™OJšœ%™%—˜8Jšœ*™*J˜—šΟnœžœžœ˜4JšœA™AJšœ6™6—˜7Jšœ.™.—˜5Jšœ*™*J˜—šœžœžœ˜Jšœžœžœ˜Jšœžœ˜Jšœžœ˜—Jš œ žœžœžœžœ˜'šœžœžœ˜5Jšœ3™3JšœM™MJšœP™PJšœ-™-—Jšœ žœ˜šœ žœžœžœ˜(JšœY™YJ˜—šŸ œžœžœ˜J˜FJ˜JšœH™HJšœI™IJšœ-™-J˜—šœ žœ˜-Jšœ™J˜—šŸœžœ6˜PJšœT™TJšœO™OJšœL™LJšœV™VJšœ™J˜—˜Jšœ>™>Jšœ*™*——˜JšœB™BJ˜Jšœ ™ J˜šŸœžœ˜ J˜:Jšœžœžœ˜'Jšžœ)˜0Jšœ;™;J˜—šŸœžœ˜J˜@Jšœžœžœ˜'Jšžœ)˜0Jšœ;™;J˜—Jšœ žœ˜J˜šŸœžœ˜(JšœI™IJšœ™J˜J˜—Jšœ ™ J˜šŸœžœžœ%žœ˜RJšžœ%žœ˜6J˜—šœžœ.˜BJšœP™PJšœ™J˜—˜JšœS™SJšœR™RJšœ™J˜—Jšžœ˜J˜J˜—Jšžœž˜ J˜J˜J˜J˜'Jšœ=™=J˜J˜'JšœQ™QJšœU™UJ˜J˜'Jšœ-™-J˜J˜*JšœR™RJ˜J˜0Jšœ7™7J˜J˜/JšœW™WJšœ™J˜J˜,JšœA™AJ˜J˜-JšœI™IJšœ0™0J˜J˜,JšœJ™JJ˜J˜-Jšœ™J˜J˜.JšœO™OJ˜Jšœ2ž˜5Jšœ,™,™%K™—K™—…—ΚQ