DIRECTORY IO, DBCommon, DBSegment, DBStats, DBStorageExtTuple, DBStorageGroup, DBStorageGroupScan, DBStoragePagetags, DBStoragePrint, DBStorageString, DBStorageTID, DBStorageTSDict, DBStorageTuple, DBStorageVec, DBStorageVectags; DBStoragePrintImpl: CEDAR PROGRAM IMPORTS DBCommon, DBSegment, DBStats, DBStorageGroup, DBStorageGroupScan, DBStorageTSDict, DBStorageVec, IO EXPORTS DBStoragePrint = BEGIN OPEN IO, DBStorageTID; Assert: PROC[condition: BOOLEAN] = {IF ~condition THEN ERROR}; Print: PROC [] = { DBSegment.CheckState[doPrinting: TRUE, printOnlyLockedPages: FALSE]; DBStorageGroupScan.CheckState[doPrinting: TRUE]; DBStats.Print[heading: "DBStorageDebugImpl.Print", out: DBCommon.GetDebugStream[]]; }; PrintPage: PUBLIC PROC[ dbPage: DBCommon.DBPage, p: LONG POINTER, fullPrint: BOOLEAN] = { SELECT DBStorageVec.TagOfPage[LOOPHOLE[p]] FROM DBStoragePagetags.Unused, DBStoragePagetags.Free, DBStoragePagetags.AMap, DBStoragePagetags.BTree => PrintPageType[dbPage, p, fullPrint]; DBStoragePagetags.Tuple, DBStoragePagetags.SystemTuple => PrintVecPage[dbPage, LOOPHOLE[p], fullPrint]; DBStoragePagetags.OverflowTuple => PrintOverflowPage[dbPage, LOOPHOLE[p], fullPrint]; ENDCASE => PrintPageUnknown[dbPage, p, fullPrint]; DBCommon.GetDebugStream[].PutF["*n"]; };--PrintPage PrintPageType: PROC[dbPage: DBCommon.DBPage, p: LONG POINTER, fullPrint: BOOLEAN] = { DBCommon.GetDebugStream[].PutF["%bB: a %g", card[dbPage], IO.rope[PagetagToRope[DBStorageVec.TagOfPage[LOOPHOLE[p]]]]]; };--PrintPageType PrintPageUnknown: PROC[dbPage: DBCommon.DBPage, p: LONG POINTER, fullPrint: BOOLEAN] = { DBCommon.GetDebugStream[].PutF["%bB: a page of type %g, an unrecognized type", card[dbPage], card[DBStorageVec.TagOfPage[LOOPHOLE[p]]]]; };--PrintPageUnknown PrintVecPage: PROC[ dbPage: DBCommon.DBPage, p: LONG POINTER, fullPrint: BOOLEAN] = TRUSTED { debugS: IO.STREAM_ DBCommon.GetDebugStream[]; debugS.PutF["%bB: a %g with %g words in free vec space", card[dbPage], IO.rope[PagetagToRope[DBStorageVec.TagOfPage[p]]], card[DBStorageVec.WordsLeftOnPage[p]]]; IF ~fullPrint THEN RETURN; debugS.PutF["*n"]; FOR slotIndex: CARDINAL IN [1 .. DBStorageVec.HighSlotIndexOfPage[p]] DO debugS.PutF["%g: ", card[slotIndex]]; SELECT DBStorageVec.TypeOfSlot[p, slotIndex] FROM DBStorageVec.FreeType => PrintFreeSlot[]; DBStorageVec.UnFreeType => PrintUnFreeSlot[]; DBStorageVectags.TSDictType => PrintTSDict[p, slotIndex]; DBStorageVectags.LString => PrintLString[p, slotIndex]; IN [1..DBStorageVectags.MaxTuplesetPerPage] => PrintTupleVec[p, slotIndex]; ENDCASE => PrintUnimplemented[DBStorageVec.TypeOfSlot[p, slotIndex]]; ENDLOOP; };--PrintVecPage PrintOverflowPage: PROC[ dbPage: DBCommon.DBPage, p: LONG POINTER, fullPrint: BOOLEAN] = TRUSTED { debugStream: IO.STREAM_ DBCommon.GetDebugStream[]; debugStream.PutF["%bB: a string overflow page with %g words in free vec space", card[dbPage], card[DBStorageVec.WordsLeftOnPage[p]]]; IF ~fullPrint THEN RETURN; debugStream.PutF["*n"]; FOR slotIndex: CARDINAL IN [1 .. DBStorageVec.HighSlotIndexOfPage[p]] DO debugStream.PutF["%g: ", card[slotIndex]]; SELECT DBStorageVec.TypeOfSlot[p, slotIndex] FROM DBStorageVectags.EString => PrintEString[p, slotIndex]; ENDCASE => PrintUnimplemented[DBStorageVec.TypeOfSlot[p, slotIndex]]; ENDLOOP; };--PrintOverflowPage PrintEString: PROC[ p: LONG POINTER TO DBStorageVec.VecPage, slotIndex: CARDINAL] = TRUSTED { eString: LONG POINTER TO DBStorageString.EString _ LOOPHOLE[DBStorageVec.VecOfSlot[p, slotIndex]]; eStringID: TID _ eString.eStringID; nWordsForText: CARDINAL _ eString.header.length - DBStorageString.SizeOfNullEString; debugStream: IO.STREAM_ DBCommon.GetDebugStream[]; debugStream.PutF["External string descriptor, eStringID: %bB, nBytes: %g*n", card[eStringID], card[2*nWordsForText]]; debugStream.PutF[" text: """]; FOR i: CARDINAL IN [0..nWordsForText*2) DO debugStream.PutF["%g", char[eString.text[i]]]; ENDLOOP; debugStream.PutF["""*n"]; };--PrintEString PrintLString: PROC[ p: LONG POINTER TO DBStorageVec.VecPage, slotIndex: CARDINAL] = TRUSTED { lString: LONG POINTER TO DBStorageString.LString _ LOOPHOLE[DBStorageVec.VecOfSlot[p, slotIndex]]; eStringID: TID _ lString.eStringID; DBCommon.GetDebugStream[].PutF["Local string descriptor, bytesInRemString: %g, eStringID: %bB*n", card[lString.bytesInRemString], card[eStringID]]; };--PrintLString PrintTSDict: PROC[ p: LONG POINTER TO DBStorageVec.VecPage, slotIndex: CARDINAL] = TRUSTED { pDict: LONG POINTER TO DBStorageTSDict.TSDict _ LOOPHOLE[DBStorageVec.VecOfSlot[p, slotIndex]]; nEntries: CARDINAL _ DBStorageTSDict.NEntries[pDict]; entry: CARDINAL; debugStream: IO.STREAM_ DBCommon.GetDebugStream[]; Assert[slotIndex = DBStorageTSDict.TSDictSlotIndex]; debugStream.PutF["Tupleset dictionary containing %g entry(s):*n", card[nEntries]]; FOR entry IN [1..nEntries] DO debugStream.PutF[" %g:", card[entry]]; debugStream.PutF[" TuplesetID: %bB,", card[pDict.seq[entry].tuplesetID]]; debugStream.PutF[" NextPage: %bB,", card[pDict.seq[entry].next]]; debugStream.PutF[" PrevPage: %bB*n", card[pDict.seq[entry].prev]]; ENDLOOP; };--PrintTSDict PrintTupleVec: PROC[ p: LONG POINTER TO DBStorageVec.VecPage, slotIndex: CARDINAL] = TRUSTED { pTuple: LONG POINTER TO DBStorageExtTuple.TupleBody _ LOOPHOLE[DBStorageVec.VecOfSlot[p, slotIndex]]; nDataWords: CARDINAL _ pTuple.groupOffset - DBStorageExtTuple.SizeOfNullTuple; groupList: LONG DESCRIPTOR FOR DBStorageGroup.GroupList _ DBStorageGroup.GroupListFromTupleBase[pTuple]; dataword, entry: CARDINAL; debugStream: IO.STREAM_ DBCommon.GetDebugStream[]; debugStream.PutF["Tuplevec of local type %g containing %g words fixed data, %g group list entry(s)*n", card[DBStorageVec.TypeOfSlot[p, slotIndex]], card[nDataWords], card[LENGTH[groupList]]]; debugStream.PutF[" data:"]; FOR dataword IN [0..nDataWords) DO debugStream.PutF["%b,", card[pTuple.fields[dataword]]]; ENDLOOP; debugStream.PutF["*n"]; FOR entry IN [0..LENGTH[groupList]) DO debugStream.PutF[" %g:", card[entry]]; debugStream.PutF[" GroupID: %bB,", card[groupList[entry].groupID]]; debugStream.PutF[" FirstTuple: %bB,", card[groupList[entry].firstTID]]; debugStream.PutF[" LastTuple: %bB*n", card[groupList[entry].lastTID]]; ENDLOOP; };--PrintTupleVec PrintFreeSlot: PROC = { DBCommon.GetDebugStream[].PutF["Free slot*n"]; };--PrintFreeSlot PrintUnFreeSlot: PROC = { DBCommon.GetDebugStream[].PutF["UnFree slot (this is an debugStream)*n"]; };--PrintUnFreeSlot PrintUnimplemented: PROC[slotType: CARDINAL] = { DBCommon.GetDebugStream[].PutF["Slot type is %g, what does THAT mean?*n", card[slotType]]; };--PrintUnimplemented PagetagToRope: PROC [tag: CARDINAL] RETURNS [ROPE] = { RETURN [SELECT tag FROM DBStoragePagetags.Unused => "unused page", DBStoragePagetags.Free => "free page", DBStoragePagetags.AMap => "AMap page", DBStoragePagetags.Tuple => "user tuple page", DBStoragePagetags.SystemTuple => "system tuple page", DBStoragePagetags.BTree => "BTree page", ENDCASE => ERROR]; };--PagetagToString END.--StoragePrintImpl CHANGE LOG Created by MBrown on May 27, 1980 11:04 AM Changed by MBrown on May 28, 1980 9:59 AM Changed by MBrown on June 1, 1980 12:33 PM Changed by MBrown on June 18, 1980 8:19 PM Changed by MBrown on August 2, 1980 10:37 PM Changed by MBrown on August 23, 1980 10:39 AM Changed by MBrown on August 23, 1980 12:18 PM Changed by Cattell on 30-Dec-81 10:35:01 Changed by Willie-Sue on June 24, 1982 12:07 pm Changed by Willie-Sue on June 30, 1982 4:31 pm Changed by Willie-Sue on February 15, 1985 ŒFile: DBStoragePrintImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Last edited by: MBrown on February 27, 1981 3:41 PM Cattell on June 16, 1983 3:31 pm Willie-Sue on February 15, 1985 11:29:18 am PST Widom, September 3, 1985 5:10:59 pm PDT Maximum printing with minimum keystrokes Still working on it... Changed for new definition of GroupListOfTuple. Changed for rearrangements in storage level. Changed for change of interface: this module now is to print any type of page, not just vec pages. Right now it does no more than print a string name for the page tag if the page has some other type (e.g. AMap, BTree). Types that used to be in DBStoragePrivateB have now moved to separate defs. Added printing of LStrings and EStrings. Changed PF format codes to IOStream format codes. IOStream => IO debugStream => DBCommon.GetDebugStream[] made Cedar, added tioga formatting ʃ˜šœ™Jšœ Ïmœ1™<—Jšœ™Jšœ$™$Jšœ ™ Jšœ/™/J™'J˜J˜šÏk ˜ Jšžœ˜J˜ J˜ J˜J˜J˜J˜J˜J˜J˜J˜ J˜J˜J˜ J˜J˜—šœžœž˜!šž˜J˜ J˜ J˜J˜J˜J˜J˜ Jšž˜—Jšžœ˜J˜—Jšžœžœžœ˜˜Jš Ïnœžœ žœžœ žœžœ˜>J˜šŸœžœ˜Jšœ(™(Jšœ!žœžœ˜DJšœ*žœ˜0J˜SJ˜J˜—šŸ œžœžœ˜Jšœžœžœ žœ˜Ašžœžœž˜/J˜J˜J˜J˜?J˜Jšœ6žœ˜NJšœ=žœ˜U—Jšžœ+˜2J˜%JšœÏc ˜ —J˜š Ÿ œžœžœžœ žœ˜UJšœ:žœ+žœ˜wJšœ ˜—J˜š Ÿœžœžœžœ žœ˜X˜\Jšœžœ˜+—Jšœ ˜—J˜šŸ œžœ˜Jš œžœžœ žœžœ˜IJ˜Jšœžœžœ˜-˜FJšžœX˜Z—Jšžœ žœžœ˜J˜šžœ žœžœ,ž˜HJ˜%šžœ'ž˜1J˜)J˜-J˜9J˜7JšžœI˜K—Jšžœ>˜E—Jšžœ˜Jšœ ˜—J˜šŸœžœ˜Jš œžœžœ žœžœ˜IJ˜Jšœ žœžœ˜2˜OJ˜5—Jšžœ žœžœ˜J˜šžœ žœžœ,ž˜HJ˜*šžœ'ž˜1J˜7—Jšžœ>˜E—Jšžœ˜Jšœ ˜—J˜šŸ œžœ˜Jš œžœžœžœ"žœžœ˜IJ˜šœ žœžœžœ˜2Jšžœ'˜/—Jšœ žœ˜#Jšœžœ=˜TJšœ žœžœ˜2˜LJ˜(—J˜"šžœžœžœž˜*J˜.Jšžœ˜—J˜Jšœ ˜—J˜šŸ œžœ˜Jš œžœžœžœ"žœžœ˜IJ˜šœ žœžœžœ˜2Jšžœ'˜/—Jšœ žœ˜#˜aJ˜1—Jšœ ˜—J˜šŸ œžœ˜Jš œžœžœžœ"žœžœ˜JJ˜šœžœžœžœ˜/Jšžœ'˜/—Jšœ žœ#˜5Jšœžœ˜Jšœ žœžœ˜2J˜4J˜Ršžœžœž˜J˜'J˜KJ˜AJ˜B—Jšžœ˜Jšœ  ˜—J˜šŸ œžœ˜Jš œžœžœžœ"žœžœ˜IJ˜šœžœžœžœ˜5Jšžœ'˜/—Jšœ žœ:˜Nšœ žœž œžœ˜9J˜.—Jšœžœ˜Jšœ žœžœ˜2˜fJšœDžœ˜X—J˜Jšžœ žœžœ9žœ˜cJ˜šžœžœžœ ž˜&J˜'J˜EJ˜GJ˜F—Jšžœ˜Jšœ ˜—J˜šŸ œžœ˜J˜.Jšœ ˜—J˜šŸœžœ˜J˜IJšœ ˜—J˜šŸœžœ žœ˜0J˜ZJšœ ˜—J˜š Ÿ œžœžœžœžœ˜6šžœžœž˜J˜*J˜&J˜&J˜-J˜5J˜(Jšžœžœ˜—Jšœ ˜—J˜J˜J˜—Jšžœ ˜J˜J˜Jšžœž˜ J˜Jšœ)ž˜+J˜Jšœ(ž˜*Jšœ™J˜Jšœ)ž˜+Jšœ/™/J˜Jšœ)ž˜+Jšœ,™,J˜Jšœ+ž˜-Jšœ[™[Jšœ[™[Jšœ#™#J˜Jšœ,ž˜.JšœK™KJ˜Jšœ,ž˜.Jšœ(™(J˜J˜(Jšœ1™1J˜J˜/Jšœ™J˜J˜.Jšœ(™(J™J˜*J™"—…—x(‡