-
Notifications
You must be signed in to change notification settings - Fork 3
/
glass_maintenance
executable file
·118 lines (106 loc) · 3.44 KB
/
glass_maintenance
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/bash
if [ -s $GEMSTONE/seaside/etc/gemstone.secret ]; then
. $GEMSTONE/seaside/etc/gemstone.secret
else
echo 'Missing password file $GEMSTONE/seaside/etc/gemstone.secret'
exit 1
fi
# Requires the gemstone name as a parameter
if [ "a$1" = "a" ]; then
echo 'Missing argument <gemstone name>'
exit 1
fi
GEMSTONE_NAME=$1
echo "GEMSTONE_NAME is $GEMSTONE_NAME"
# Make sure the environment is sane before we start up
if [ -z $LANG ]; then echo "LANG is not set, bailing out"; exit 3; fi
if [ -z $GEMSTONE_NAME ]; then echo "GEMSTONE_NAME is not set, bailing out"; exit 3; fi
exec $GEMSTONE/bin/topaz -l -T300000 << EOF
set user DataCurator pass $GEMSTONE_CURATOR_PASS gems $1
display oops
iferror where
login
run
"record gems pid in the pid file"
| file |
(GsFile isServerDirectory: '$GEMSTONE_DATADIR') ifFalse: [ ^nil ].
file := GsFile openWriteOnServer: '$GEMSTONE_DATADIR/${1}_maintenance_gem.pid'.
file nextPutAll: (System gemVersionReport at: 'processId') printString.
file cr.
file close.
(ObjectLogEntry
info: 'MTCE: startup'
object: 'pid: ', (System gemVersionReport at: 'processId') printString) addToLog.
System commitTransaction
ifFalse: [
System abortTransaction.
nil error: 'Could not commit ObjectLog entry' ].
%
run
| count |
true "enable for remote breakpoints and profiling"
ifTrue: [
GemToGemAnnouncement installStaticHandler.
Exception
installStaticException:
[:ex :cat :num :args |
BreakpointNotification signal.
"needed to avoid infinite loop when resuming from a breakpoint"
ex _incrementBreakpointsToIgnore. ]
category: GemStoneError
number: 6005 "#rtErrCodeBreakpoint"
subtype: nil.
System commitTransaction ifFalse: [ nil error: 'Could not commit for GemToGemSignaling' ]].
System transactionMode: #manualBegin.
Exception
installStaticException:
[:ex :cat :num :args |
"Run the abort in a lowPriority process, since we must acquire the
transactionMutex."
[
GRPlatform current transactionMutex
critical: [
GRPlatform current doAbortTransaction ].
System enableSignaledAbortError.
] forkAt: Processor lowestPriority.
]
category: GemStoneError
number: 6009 "#rtErrSignalAbort"
subtype: nil.
System enableSignaledAbortError.
"This thread is needed to handle the SigAbort exception, when the primary
thread is blocked. Assuming default 60 second STN_GEM_ABORT_TIMEOUT, wake
up at 30 second intervals."
[
[ true ] whileTrue: [ (Delay forSeconds: 30) wait ].
] forkAt: Processor lowestPriority.
count := 0.
[true] whileTrue: [ [
"run maintenance tasks"
WAGemStoneMaintenanceTask performTasks: count.
"Sleep for a minute"
(Delay forSeconds: 60) wait.
count := count + 1]
on: Error, Halt, BreakpointNotification
do: [:ex |
System inTransaction
ifTrue: [
DebuggerLogEntry createContinuationLabeled: 'MTCE continuation'.
System commitTransaction.
System beginTransaction ]
ifFalse: [
System beginTransaction.
DebuggerLogEntry createContinuationLabeled: 'MTCE continuation'.
System commitTransaction].
ex isResumable ifTrue: [ex resume]]].
%
run
GemToGemAnnouncement uninstallStaticHandler.
System beginTransaction.
(ObjectLogEntry
fatal: 'MTCE: topaz exit'
object:
'pid: ', (System gemVersionReport at: 'processId') printString) addToLog.
System commitTransaction.
%
EOF