Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
92244e8e
Commit
92244e8e
authored
Sep 14, 2004
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some minor issues with the new Win32 service code for autovacuum,
and add documentation. Dave Page
parent
b04e70b1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
21 deletions
+32
-21
contrib/pg_autovacuum/README.pg_autovacuum
contrib/pg_autovacuum/README.pg_autovacuum
+25
-1
contrib/pg_autovacuum/pg_autovacuum.c
contrib/pg_autovacuum/pg_autovacuum.c
+7
-20
No files found.
contrib/pg_autovacuum/README.pg_autovacuum
View file @
92244e8e
...
@@ -55,6 +55,15 @@ postmasters on a particular host, you will need multiple pg_autovacuum
...
@@ -55,6 +55,15 @@ postmasters on a particular host, you will need multiple pg_autovacuum
instances, and they have no way, at present, to coordinate between one
instances, and they have no way, at present, to coordinate between one
another to ensure that they do not concurrently vacuum big tables.
another to ensure that they do not concurrently vacuum big tables.
When installed as a service under Windows, there is currently no way to
know the name of the PostgreSQL server service (if there even is one)
so it is not possible to specify a startup dependency. It is therefore
possible for pg_autovacuum to start before the server.
When installed as a service under Windows, if the -P option is used to
specify the connection password, this option (and the password) is
stored in plain text in the registry.
TODO:
TODO:
-----
-----
...
@@ -117,7 +126,9 @@ pg_autovacuum has the following optional arguments:
...
@@ -117,7 +126,9 @@ pg_autovacuum has the following optional arguments:
-L log file: Name of file to which output is submitted, otherwise STDERR
-L log file: Name of file to which output is submitted, otherwise STDERR
-U username: Username pg_autovacuum will use to connect with, if not
-U username: Username pg_autovacuum will use to connect with, if not
specified the current username is used.
specified the current username is used.
-P password: Password pg_autovacuum will use to connect with.
-P password: Password pg_autovacuum will use to connect with. *WARNING*
When installed as a Windows Service, this option will be stored in plain
text in the registry.
-H host: host name or IP to connect to.
-H host: host name or IP to connect to.
-p port: port used for connection.
-p port: port used for connection.
-h help: list of command line options.
-h help: list of command line options.
...
@@ -133,6 +144,19 @@ the time of writing they are:
...
@@ -133,6 +144,19 @@ the time of writing they are:
-s 300 (5 minutes)
-s 300 (5 minutes)
-S 2
-S 2
The following arguments are used on Windows only:
-I Install the executable as a Windows service. Other appropriate command
line options will be stored in the registry and passed to the service
at startup. *WARNING* This includes the connection password which will
be stored in plain text.
-N service user: Name of the Windows user account under which the service
will run.
-W service password: The password for the service account.
-R Uninstall pg_autovacuum as a service.
Vacuum and Analyze:
Vacuum and Analyze:
-------------------
-------------------
...
...
contrib/pg_autovacuum/pg_autovacuum.c
View file @
92244e8e
...
@@ -25,12 +25,8 @@ log_entry(const char *logentry, int level)
...
@@ -25,12 +25,8 @@ log_entry(const char *logentry, int level)
{
{
/*
/*
* Note: Under Windows we dump the log entries to the normal
* Note: Under Windows we dump the log entries to the normal
* stderr/logfile
* stderr/logfile as well, otherwise it can be a pain to debug
*/
* service install failures etc.
/*
* as well, otherwise it can be a pain to debug service install
* failures etc.
*/
*/
time_t
curtime
;
time_t
curtime
;
...
@@ -117,7 +113,7 @@ log_entry(const char *logentry, int level)
...
@@ -117,7 +113,7 @@ log_entry(const char *logentry, int level)
}
}
}
}
ReportEvent
(
evtHandle
,
elevel
,
0
,
1
,
NULL
,
1
,
0
,
&
logentry
,
NULL
);
ReportEvent
(
evtHandle
,
elevel
,
0
,
0
,
NULL
,
1
,
0
,
&
logentry
,
NULL
);
#endif
#endif
}
}
...
@@ -1219,7 +1215,7 @@ InstallService()
...
@@ -1219,7 +1215,7 @@ InstallService()
if
(
args
->
user
)
if
(
args
->
user
)
sprintf
(
szCommand
,
"%s -U %s"
,
szCommand
,
args
->
user
);
sprintf
(
szCommand
,
"%s -U %s"
,
szCommand
,
args
->
user
);
if
(
args
->
password
)
if
(
args
->
password
)
sprintf
(
szCommand
,
"%s -
p
%s"
,
szCommand
,
args
->
password
);
sprintf
(
szCommand
,
"%s -
P
%s"
,
szCommand
,
args
->
password
);
if
(
args
->
logfile
)
if
(
args
->
logfile
)
sprintf
(
szCommand
,
"%s -L %s"
,
szCommand
,
args
->
logfile
);
sprintf
(
szCommand
,
"%s -L %s"
,
szCommand
,
args
->
logfile
);
if
(
args
->
sleep_base_value
!=
(
int
)
SLEEPBASEVALUE
)
if
(
args
->
sleep_base_value
!=
(
int
)
SLEEPBASEVALUE
)
...
@@ -1249,21 +1245,12 @@ InstallService()
...
@@ -1249,21 +1245,12 @@ InstallService()
if
(
RegCreateKeyEx
(
HKEY_LOCAL_MACHINE
,
szKey
,
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
KEY_ALL_ACCESS
,
NULL
,
&
hk
,
NULL
))
if
(
RegCreateKeyEx
(
HKEY_LOCAL_MACHINE
,
szKey
,
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
KEY_ALL_ACCESS
,
NULL
,
&
hk
,
NULL
))
return
-
5
;
return
-
5
;
/* TODO
Create an actual message file
! */
/* TODO
Try to find pgevent.dll, rather than hope it's in the path.
! */
/* Message
count
*/
/* Message
DLL
*/
sprintf
(
szMsgDLL
,
"pg
messages
.dll"
);
sprintf
(
szMsgDLL
,
"pg
event
.dll"
);
if
(
RegSetValueEx
(
hk
,
"EventMessageFile"
,
0
,
REG_EXPAND_SZ
,
(
LPBYTE
)
szMsgDLL
,
(
DWORD
)
strlen
(
szMsgDLL
)
+
1
))
if
(
RegSetValueEx
(
hk
,
"EventMessageFile"
,
0
,
REG_EXPAND_SZ
,
(
LPBYTE
)
szMsgDLL
,
(
DWORD
)
strlen
(
szMsgDLL
)
+
1
))
return
-
6
;
return
-
6
;
/* Category message file */
if
(
RegSetValueEx
(
hk
,
"CategoryMessageFile"
,
0
,
REG_EXPAND_SZ
,
(
LPBYTE
)
szMsgDLL
,
(
DWORD
)
strlen
(
szMsgDLL
)
+
1
))
return
-
7
;
/* Category message count */
dwData
=
0
;
if
(
RegSetValueEx
(
hk
,
"CategoryCount"
,
0
,
REG_DWORD
,
(
LPBYTE
)
&
dwData
,
sizeof
(
DWORD
)))
return
-
8
;
/* Set the event types supported */
/* Set the event types supported */
dwData
=
EVENTLOG_ERROR_TYPE
|
EVENTLOG_WARNING_TYPE
|
EVENTLOG_INFORMATION_TYPE
|
EVENTLOG_SUCCESS
;
dwData
=
EVENTLOG_ERROR_TYPE
|
EVENTLOG_WARNING_TYPE
|
EVENTLOG_INFORMATION_TYPE
|
EVENTLOG_SUCCESS
;
if
(
RegSetValueEx
(
hk
,
"TypesSupported"
,
0
,
REG_DWORD
,
(
LPBYTE
)
&
dwData
,
sizeof
(
DWORD
)))
if
(
RegSetValueEx
(
hk
,
"TypesSupported"
,
0
,
REG_DWORD
,
(
LPBYTE
)
&
dwData
,
sizeof
(
DWORD
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment