JRNSTOP ;Stop Journalling, ;HYY354 09/14/99 ; Compiled March 6, 2000 19:36:08 ; +--------------------------------------------------------+ ; | Copyright 1986-2000 by InterSystems Corporation, | ; | Cambridge, Massachusetts, U.S.A. | ; | All rights reserved. | ; | | ; | Confidential, unpublished property of InterSystems. | ; | | ; | This media contains an authorized copy or copies | ; | of material copyrighted by InterSystems and is the | ; | confidential, unpublished property of InterSystems. | ; | This copyright notice and any other copyright notices | ; | included in machine readable copies must be reproduced | ; | on all authorized copies. | ; +--------------------------------------------------------+ ;%ST.INC DAS309 11/08/99 ;%system.INC ; DAS280 06/29/99 ; %system.inc: compiled for NETWIDENAMESPACE ; %system.inc: compiled for DDPGROUPS ; %system.inc: compiled for NETMOREDCPDMN ; %system.inc: compiled for USECLUSTER ; %system.inc: compiled for RTNINGBL ; %system.inc: compiled for DBMSNSP MAIN N curfile,dummy,jrnflag,jrninfo D INIT I curfile="" W !,"Not journaling now." QUIT N status,yndef S status=$zu(78,22),yndef="Y" I $P(status,"^",2) W ! DO S yndef="N" g ask ;PAUSED (JRNSWITCH) . W !,"Note: Journaling is currently PAUSED because JRNSWITCH is" . w !," running. Stopping journaling now will cause journal" . w !," data to be lost. This should only be used if JRNSWITCH" . w !," is hung or if it is not possible to switch to another" . w !," journal file due to limited disk space." I $P(status,"^",3) W ! DO S yndef="Y" g ask ;SUSPENDED . W !,"Note: Journaling is currently SUSPENDED -- there has been" . W !," an I/O error in journaling which has not yet been" . W !," resolved and some journaling information has been lost." . W !," (This is just an informational message, there is no" . W !," reason not to stop journaling at this point)" I $P(status,"^",4) W ! DO S yndef="N" g ask ;I/O RETRY IN PROGRESS . W !,"Note: The journaling system is currently in the process of" . w !," retrying a failed I/O or a failed journal file" . w !," expansion. Stopping journaling now will cause journal" . w !," data to be lost. This should only be used if JRNSWITCH" . w !," is hung or if it is not possible to switch to another" . w !," journal file due to limited disk space." ask ; I $$YN("Stop journaling now",yndef)'="Y" DO Q . W !,"Journaling remains active." n err,stopped s stopped=$$INT(.err,0) i 'stopped w !,"Failed to stop journaling" w:$g(err)'="" !,"ERROR: ",err q INT(err,io) ; Internal Entry Point (for SHUTDOWN, etc.) N curfile,jrninfo,jrnflag,stopped,glo s stopped=0 s $zt="etINT" i $d(io),$e(io)="^" s glo=io k io ;ideally I should try a SET on glo L +^%SYS("JOURNAL"):1 e s err=(-2_",unable to lock "_$s(""="":"^%SYS(""JOURNAL"")",1:"")) q 0 D INIT ;curfile/jrninfo should always be updated to be safe I curfile="" s err=(-3_",Not journaling") L -^%SYS("JOURNAL") q 0 ; Not journaling ; a sanity check to make sure last journal history START record is complete i +$g(^%SYS("JOURNAL"))#2 d ;journal started, but record incomplete . d log^JRNSTART(),loginfo("Last journal history log is completed with "_$name(^%SYS("TMPJRN"))) S stopped=$zu(78,2,1) S ^%SYS("JOURNAL","CURRENT")="" S curfile=$ZU(78,3) ;HYY094 ; bit 1: journalling(=1) ; bit 2: journal all globals(=1) S ^%SYS("JOURNAL","LAST")=jrninfo_"^"_curfile D History^JRNUTIL("STOP",curfile) d HISTORY^JRNUTIL("STOP",curfile) d PURGE^JRNPRG ;KLMxxx f i=1:1:50 q:$ZU(51,1)!'$zu(78,21) h .1 i '$ZU(51,1),$zu(78,21) s err="Unable to quiesce write daemon or update image journaling within 5 seconds" L -^%SYS("JOURNAL") Q stopped etINT ; s $zt="" L -^%SYS("JOURNAL") s err=(-1_","_$ze) q stopped INIT S curfile=$$curfile() S jrnflag=$ZU(40,2,7),jrninfo=$V(jrnflag,-2) Q curfile() S $zt="etcurfile" Q $p($zu(78,4)_","_$zu(78,3),",",2) etcurfile Q "" loginfo(msg) ;must be called from within INT (JRNSTART, JRNSWTCH) i $d(glo) s @glo=$g(@glo)+1,@glo@(@glo)=msg i $d(io) u io w !,msg q YN(P,D,t) N R,X S P=$G(P),D=$E($G(D)_"?"),t=$G(t) ;ask Yes/No w/ Prompt,Default S D=$S("Yy"[D:"Yes => ","Nn"[D:"No => ",1:"") ;Yes, No or no default F W !,P_"? "_D Read:t R:t Read:'t R DO I "^YN"[R Q ;timed or non-timed read . S X=R,R=$TR($E(R_D_"?"),"yn","YN") I "^YN"'[R W " enter Yes or No, please" S POP=(R="^") W $E($S(R="N":"No",R="Y":"Yes",1:""),$L(X)+1,3) Q R