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
84a89e24
Commit
84a89e24
authored
Mar 08, 2000
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Repair access-to-already-freed-memory error recently introduced into
VACUUM.
parent
d261adf6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
12 deletions
+25
-12
src/backend/commands/vacuum.c
src/backend/commands/vacuum.c
+25
-12
No files found.
src/backend/commands/vacuum.c
View file @
84a89e24
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.14
1 2000/02/24 04:34:38 inoue
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.14
2 2000/03/08 23:41:00 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -144,6 +144,7 @@ PortalVariableMemory CommonSpecialPortalGetMemory(void)
{
return
PortalGetVariableMemory
(
vc_portal
);
}
bool
CommonSpecialPortalIsOpen
(
void
)
{
return
CommonSpecialPortalInUse
;
...
...
@@ -153,6 +154,7 @@ void
vacuum
(
char
*
vacrel
,
bool
verbose
,
bool
analyze
,
List
*
va_spec
)
{
NameData
VacRel
;
Name
VacRelName
;
PortalVariableMemory
pmem
;
MemoryContext
old
;
List
*
le
;
...
...
@@ -173,17 +175,22 @@ vacuum(char *vacrel, bool verbose, bool analyze, List *va_spec)
if
(
IsTransactionBlock
())
elog
(
ERROR
,
"VACUUM cannot run inside a BEGIN/END block"
);
/* initialize vacuum cleaner, particularly vc_portal */
vc_init
();
if
(
verbose
)
MESSAGE_LEVEL
=
NOTICE
;
else
MESSAGE_LEVEL
=
DEBUG
;
/* vacrel gets de-allocated on transaction commit, so copy it */
/* Create special portal for cross-transaction storage */
CommonSpecialPortalOpen
();
/* vacrel gets de-allocated on xact commit, so copy it to safe storage */
if
(
vacrel
)
strcpy
(
NameStr
(
VacRel
),
vacrel
);
{
namestrcpy
(
&
VacRel
,
vacrel
);
VacRelName
=
&
VacRel
;
}
else
VacRelName
=
NULL
;
/* must also copy the column list, if any, to safe storage */
pmem
=
CommonSpecialPortalGetMemory
();
...
...
@@ -196,11 +203,18 @@ vacuum(char *vacrel, bool verbose, bool analyze, List *va_spec)
}
MemoryContextSwitchTo
(
old
);
/*
* Start up the vacuum cleaner.
*
* NOTE: since this commits the current transaction, the memory holding
* any passed-in parameters gets freed here. We must have already copied
* pass-by-reference parameters to safe storage. Don't make me fix this
* again!
*/
vc_init
();
/* vacuum the database */
if
(
vacrel
)
vc_vacuum
(
&
VacRel
,
analyze
,
va_cols
);
else
vc_vacuum
(
NULL
,
analyze
,
NIL
);
vc_vacuum
(
VacRelName
,
analyze
,
va_cols
);
/* clean up */
vc_shutdown
();
...
...
@@ -229,8 +243,6 @@ vacuum(char *vacrel, bool verbose, bool analyze, List *va_spec)
static
void
vc_init
()
{
CommonSpecialPortalOpen
();
/* matches the StartTransaction in PostgresMain() */
CommitTransactionCommand
();
}
...
...
@@ -252,6 +264,7 @@ vc_shutdown()
*/
unlink
(
RELCACHE_INIT_FILENAME
);
/* Clean up working storage */
CommonSpecialPortalClose
();
/* matches the CommitTransaction in PostgresMain() */
...
...
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