Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit92244e8

Browse files
committed
Fix some minor issues with the new Win32 service code for autovacuum,
and add documentation. Dave Page
1 parentb04e70b commit92244e8

File tree

2 files changed

+32
-21
lines changed

2 files changed

+32
-21
lines changed

‎contrib/pg_autovacuum/README.pg_autovacuum

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ postmasters on a particular host, you will need multiple pg_autovacuum
5555
instances, and they have no way, at present, to coordinate between one
5656
another to ensure that they do not concurrently vacuum big tables.
5757

58+
When installed as a service under Windows, there is currently no way to
59+
know the name of the PostgreSQL server service (if there even is one)
60+
so it is not possible to specify a startup dependency. It is therefore
61+
possible for pg_autovacuum to start before the server.
62+
63+
When installed as a service under Windows, if the -P option is used to
64+
specify the connection password, this option (and the password) is
65+
stored in plain text in the registry.
66+
5867
TODO:
5968
-----
6069

@@ -117,7 +126,9 @@ pg_autovacuum has the following optional arguments:
117126
-L log file: Name of file to which output is submitted, otherwise STDERR
118127
-U username: Username pg_autovacuum will use to connect with, if not
119128
specified the current username is used.
120-
-P password: Password pg_autovacuum will use to connect with.
129+
-P password: Password pg_autovacuum will use to connect with. *WARNING*
130+
When installed as a Windows Service, this option will be stored in plain
131+
text in the registry.
121132
-H host: host name or IP to connect to.
122133
-p port: port used for connection.
123134
-h help: list of command line options.
@@ -133,6 +144,19 @@ the time of writing they are:
133144
-s 300 (5 minutes)
134145
-S 2
135146

147+
The following arguments are used on Windows only:
148+
149+
-I Install the executable as a Windows service. Other appropriate command
150+
line options will be stored in the registry and passed to the service
151+
at startup. *WARNING* This includes the connection password which will
152+
be stored in plain text.
153+
154+
-N service user: Name of the Windows user account under which the service
155+
will run.
156+
157+
-W service password: The password for the service account.
158+
159+
-R Uninstall pg_autovacuum as a service.
136160

137161
Vacuum and Analyze:
138162
-------------------

‎contrib/pg_autovacuum/pg_autovacuum.c

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,8 @@ log_entry(const char *logentry, int level)
2525
{
2626
/*
2727
* Note: Under Windows we dump the log entries to the normal
28-
* stderr/logfile
29-
*/
30-
31-
/*
32-
* as well, otherwise it can be a pain to debug service install
33-
* failures etc.
28+
* stderr/logfile as well, otherwise it can be a pain to debug
29+
* service install failures etc.
3430
*/
3531

3632
time_tcurtime;
@@ -117,7 +113,7 @@ log_entry(const char *logentry, int level)
117113
}
118114
}
119115

120-
ReportEvent(evtHandle,elevel,0,1,NULL,1,0,&logentry,NULL);
116+
ReportEvent(evtHandle,elevel,0,0,NULL,1,0,&logentry,NULL);
121117
#endif
122118
}
123119

@@ -1219,7 +1215,7 @@ InstallService()
12191215
if (args->user)
12201216
sprintf(szCommand,"%s -U %s",szCommand,args->user);
12211217
if (args->password)
1222-
sprintf(szCommand,"%s -p %s",szCommand,args->password);
1218+
sprintf(szCommand,"%s -P %s",szCommand,args->password);
12231219
if (args->logfile)
12241220
sprintf(szCommand,"%s -L %s",szCommand,args->logfile);
12251221
if (args->sleep_base_value!= (int)SLEEPBASEVALUE)
@@ -1249,21 +1245,12 @@ InstallService()
12491245
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,szKey,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hk,NULL))
12501246
return-5;
12511247

1252-
/* TODOCreate an actual message file! */
1253-
/* Messagecount */
1254-
sprintf(szMsgDLL,"pgmessages.dll");
1248+
/* TODOTry to find pgevent.dll, rather than hope it's in the path.! */
1249+
/* MessageDLL */
1250+
sprintf(szMsgDLL,"pgevent.dll");
12551251
if (RegSetValueEx(hk,"EventMessageFile",0,REG_EXPAND_SZ, (LPBYTE)szMsgDLL, (DWORD)strlen(szMsgDLL)+1))
12561252
return-6;
12571253

1258-
/* Category message file */
1259-
if (RegSetValueEx(hk,"CategoryMessageFile",0,REG_EXPAND_SZ, (LPBYTE)szMsgDLL, (DWORD)strlen(szMsgDLL)+1))
1260-
return-7;
1261-
1262-
/* Category message count */
1263-
dwData=0;
1264-
if (RegSetValueEx(hk,"CategoryCount",0,REG_DWORD, (LPBYTE)&dwData,sizeof(DWORD)))
1265-
return-8;
1266-
12671254
/* Set the event types supported */
12681255
dwData=EVENTLOG_ERROR_TYPE |EVENTLOG_WARNING_TYPE |EVENTLOG_INFORMATION_TYPE |EVENTLOG_SUCCESS;
12691256
if (RegSetValueEx(hk,"TypesSupported",0,REG_DWORD, (LPBYTE)&dwData,sizeof(DWORD)))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp