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
a535cdf1
Commit
a535cdf1
authored
Mar 06, 2007
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert temp_tablespaces because of coding problems, per Tom.
parent
4ae6967f
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
16 additions
and
258 deletions
+16
-258
doc/src/sgml/config.sgml
doc/src/sgml/config.sgml
+1
-30
src/backend/commands/indexcmds.c
src/backend/commands/indexcmds.c
+2
-8
src/backend/commands/tablecmds.c
src/backend/commands/tablecmds.c
+1
-5
src/backend/commands/tablespace.c
src/backend/commands/tablespace.c
+2
-141
src/backend/executor/execMain.c
src/backend/executor/execMain.c
+1
-5
src/backend/storage/file/fd.c
src/backend/storage/file/fd.c
+6
-48
src/backend/utils/misc/guc.c
src/backend/utils/misc/guc.c
+1
-12
src/backend/utils/misc/postgresql.conf.sample
src/backend/utils/misc/postgresql.conf.sample
+0
-2
src/include/commands/tablespace.h
src/include/commands/tablespace.h
+1
-2
src/include/utils/guc.h
src/include/utils/guc.h
+1
-5
No files found.
doc/src/sgml/config.sgml
View file @
a535cdf1
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.11
4 2007/03/03 18:46:40
momjian Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.11
5 2007/03/06 02:06:12
momjian Exp $ -->
<chapter Id="runtime-config">
<chapter Id="runtime-config">
<title>Server Configuration</title>
<title>Server Configuration</title>
...
@@ -3440,35 +3440,6 @@ SELECT * FROM parent WHERE key = 2400;
...
@@ -3440,35 +3440,6 @@ SELECT * FROM parent WHERE key = 2400;
</listitem>
</listitem>
</varlistentry>
</varlistentry>
<varlistentry id="guc-temp-tablespaces" xreflabel="temp_tablespaces">
<term><varname>temp_tablespaces</varname> (<type>string</type>)</term>
<indexterm>
<primary><varname>temp_tablespaces</> configuration parameter</primary>
</indexterm>
<indexterm><primary>tablespace</><secondary>temp</></>
<listitem>
<para>
This variable specifies tablespaces in which to create temp
objects (temp tables and indexes on temp tables) when a
<command>CREATE</> command does not explicitly specify a tablespace
and temp files when necessary (eg. for sorting operations).
</para>
<para>
The value is either a list of names of tablespaces, or an empty
string to specify using the default tablespace of the current database.
If the value does not match the name of any existing tablespace,
<productname>PostgreSQL</> will automatically use the default
tablespace of the current database.
</para>
<para>
For more information on tablespaces,
see <xref linkend="manage-ag-tablespaces">.
</para>
</listitem>
</varlistentry>
<varlistentry id="guc-check-function-bodies" xreflabel="check_function_bodies">
<varlistentry id="guc-check-function-bodies" xreflabel="check_function_bodies">
<term><varname>check_function_bodies</varname> (<type>boolean</type>)</term>
<term><varname>check_function_bodies</varname> (<type>boolean</type>)</term>
<indexterm>
<indexterm>
...
...
src/backend/commands/indexcmds.c
View file @
a535cdf1
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.15
5 2007/02/01 19:10:26
momjian Exp $
* $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.15
6 2007/03/06 02:06:12
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -209,13 +209,7 @@ DefineIndex(RangeVar *heapRelation,
...
@@ -209,13 +209,7 @@ DefineIndex(RangeVar *heapRelation,
}
}
else
else
{
{
/*
* if the target table is temporary then use a temp_tablespace
*/
if
(
!
rel
->
rd_istemp
)
tablespaceId
=
GetDefaultTablespace
();
tablespaceId
=
GetDefaultTablespace
();
else
tablespaceId
=
GetTempTablespace
();
/* note InvalidOid is OK in this case */
/* note InvalidOid is OK in this case */
}
}
...
...
src/backend/commands/tablecmds.c
View file @
a535cdf1
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.21
5 2007/02/16 22:04:02 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.21
6 2007/03/06 02:06:13 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -330,10 +330,6 @@ DefineRelation(CreateStmt *stmt, char relkind)
...
@@ -330,10 +330,6 @@ DefineRelation(CreateStmt *stmt, char relkind)
errmsg
(
"tablespace
\"
%s
\"
does not exist"
,
errmsg
(
"tablespace
\"
%s
\"
does not exist"
,
stmt
->
tablespacename
)));
stmt
->
tablespacename
)));
}
}
else
if
(
stmt
->
relation
->
istemp
)
{
tablespaceId
=
GetTempTablespace
();
}
else
else
{
{
tablespaceId
=
GetDefaultTablespace
();
tablespaceId
=
GetDefaultTablespace
();
...
...
src/backend/commands/tablespace.c
View file @
a535cdf1
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.4
2 2007/02/01 19:10:26
momjian Exp $
* $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.4
3 2007/03/06 02:06:13
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -65,12 +65,9 @@
...
@@ -65,12 +65,9 @@
#include "utils/lsyscache.h"
#include "utils/lsyscache.h"
/* GUC variable
s
*/
/* GUC variable */
char
*
default_tablespace
=
NULL
;
char
*
default_tablespace
=
NULL
;
char
*
temp_tablespaces
=
NULL
;
int
next_temp_tablespace
;
int
num_temp_tablespaces
;
static
bool
remove_tablespace_directories
(
Oid
tablespaceoid
,
bool
redo
);
static
bool
remove_tablespace_directories
(
Oid
tablespaceoid
,
bool
redo
);
static
void
set_short_version
(
const
char
*
path
);
static
void
set_short_version
(
const
char
*
path
);
...
@@ -933,142 +930,6 @@ GetDefaultTablespace(void)
...
@@ -933,142 +930,6 @@ GetDefaultTablespace(void)
return
result
;
return
result
;
}
}
/*
* Routines for handling the GUC variable 'temp_tablespaces'.
*/
/* assign_hook: validate new temp_tablespaces, do extra actions as needed */
const
char
*
assign_temp_tablespaces
(
const
char
*
newval
,
bool
doit
,
GucSource
source
)
{
char
*
rawname
;
List
*
namelist
;
ListCell
*
l
;
/* Need a modifiable copy of string */
rawname
=
pstrdup
(
newval
);
/* Parse string into list of identifiers */
if
(
!
SplitIdentifierString
(
rawname
,
','
,
&
namelist
))
{
/* syntax error in name list */
pfree
(
rawname
);
list_free
(
namelist
);
return
NULL
;
}
num_temp_tablespaces
=
0
;
foreach
(
l
,
namelist
)
{
char
*
curname
=
(
char
*
)
lfirst
(
l
);
/*
* If we aren't inside a transaction, we cannot do database access so
* cannot verify the individual names. Must accept the list on faith.
*/
if
(
source
>=
PGC_S_INTERACTIVE
&&
IsTransactionState
())
{
/*
* Verify that all the names are valid tablspace names
* We do not check for USAGE rights should we?
*/
if
(
get_tablespace_oid
(
curname
)
==
InvalidOid
)
ereport
((
source
==
PGC_S_TEST
)
?
NOTICE
:
ERROR
,
(
errcode
(
ERRCODE_UNDEFINED_OBJECT
),
errmsg
(
"tablespace
\"
%s
\"
does not exist"
,
curname
)));
}
num_temp_tablespaces
++
;
}
/*
* Select the first tablespace to use
*/
next_temp_tablespace
=
MyProcPid
%
num_temp_tablespaces
;
pfree
(
rawname
);
list_free
(
namelist
);
return
newval
;
}
/*
* GetTempTablespace -- get the OID of the tablespace for temporary objects
*
* May return InvalidOid to indicate "use the database's default tablespace"
*
* This exists to hide the temp_tablespace GUC variable.
*/
Oid
GetTempTablespace
(
void
)
{
Oid
result
;
char
*
curname
=
NULL
;
char
*
rawname
;
List
*
namelist
;
ListCell
*
l
;
int
i
=
0
;
if
(
temp_tablespaces
==
NULL
)
return
InvalidOid
;
/* Need a modifiable version of temp_tablespaces */
rawname
=
pstrdup
(
temp_tablespaces
);
/* Parse string into list of identifiers */
if
(
!
SplitIdentifierString
(
rawname
,
','
,
&
namelist
))
{
/* syntax error in name list */
pfree
(
rawname
);
list_free
(
namelist
);
return
InvalidOid
;
}
/*
* Iterate through the list of namespaces until the one we need
* (next_temp_tablespace)
*/
foreach
(
l
,
namelist
)
{
curname
=
(
char
*
)
lfirst
(
l
);
if
(
i
==
next_temp_tablespace
)
break
;
i
++
;
}
/* Prepare for the next time the function is called */
next_temp_tablespace
++
;
if
(
next_temp_tablespace
==
num_temp_tablespaces
)
next_temp_tablespace
=
0
;
/* Fast path for temp_tablespaces == "" */
if
(
curname
==
NULL
||
curname
[
0
]
==
'\0'
)
{
list_free
(
namelist
);
pfree
(
rawname
);
return
InvalidOid
;
}
/*
* It is tempting to cache this lookup for more speed, but then we would
* fail to detect the case where the tablespace was dropped since the GUC
* variable was set. Note also that we don't complain if the value fails
* to refer to an existing tablespace; we just silently return InvalidOid,
* causing the new object to be created in the database's tablespace.
*/
result
=
get_tablespace_oid
(
curname
);
/* We don't free rawname before because curname points to a part of it */
pfree
(
rawname
);
/*
* Allow explicit specification of database's default tablespace in
* default_tablespace without triggering permissions checks.
*/
if
(
result
==
MyDatabaseTableSpace
)
result
=
InvalidOid
;
list_free
(
namelist
);
return
result
;
}
/*
/*
* get_tablespace_oid - given a tablespace name, look up the OID
* get_tablespace_oid - given a tablespace name, look up the OID
...
...
src/backend/executor/execMain.c
View file @
a535cdf1
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.2
89 2007/02/27 01:11:25 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.2
90 2007/03/06 02:06:13 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -2440,10 +2440,6 @@ OpenIntoRel(QueryDesc *queryDesc)
...
@@ -2440,10 +2440,6 @@ OpenIntoRel(QueryDesc *queryDesc)
errmsg
(
"tablespace
\"
%s
\"
does not exist"
,
errmsg
(
"tablespace
\"
%s
\"
does not exist"
,
into
->
tableSpaceName
)));
into
->
tableSpaceName
)));
}
}
else
if
(
into
->
rel
->
istemp
)
{
tablespaceId
=
GetTempTablespace
();
}
else
else
{
{
tablespaceId
=
GetDefaultTablespace
();
tablespaceId
=
GetDefaultTablespace
();
...
...
src/backend/storage/file/fd.c
View file @
a535cdf1
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.13
6 2007/02/28 15:59:30 mha
Exp $
* $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.13
7 2007/03/06 02:06:14 momjian
Exp $
*
*
* NOTES:
* NOTES:
*
*
...
@@ -46,8 +46,6 @@
...
@@ -46,8 +46,6 @@
#include <unistd.h>
#include <unistd.h>
#include <fcntl.h>
#include <fcntl.h>
#include "commands/tablespace.h"
#include "miscadmin.h"
#include "miscadmin.h"
#include "access/xact.h"
#include "access/xact.h"
#include "storage/fd.h"
#include "storage/fd.h"
...
@@ -78,7 +76,6 @@
...
@@ -78,7 +76,6 @@
*/
*/
#define FD_MINFREE 10
#define FD_MINFREE 10
#define OIDCHARS 10
/* max chars printed by %u */
/*
/*
* A number of platforms allow individual processes to open many more files
* A number of platforms allow individual processes to open many more files
...
@@ -883,51 +880,13 @@ OpenTemporaryFile(bool interXact)
...
@@ -883,51 +880,13 @@ OpenTemporaryFile(bool interXact)
{
{
char
tempfilepath
[
MAXPGPATH
];
char
tempfilepath
[
MAXPGPATH
];
File
file
;
File
file
;
Oid
oid
;
char
*
path
;
int
pathlen
;
/*
* Take a look what should be the path of the temporary file
*/
oid
=
GetTempTablespace
();
if
(
oid
!=
InvalidOid
)
{
/*
* As we got a valid tablespace, try to create the
* file there
*/
pathlen
=
strlen
(
"pg_tblspc/"
)
+
OIDCHARS
+
1
;
path
=
(
char
*
)
palloc
(
pathlen
);
snprintf
(
path
,
pathlen
,
"pg_tblspc/%u"
,
oid
);
/*
* Generate a tempfile name that should be unique within the current
* database instance.
*/
snprintf
(
tempfilepath
,
sizeof
(
tempfilepath
),
"%s/%s%d.%ld"
,
path
,
PG_TEMP_FILE_PREFIX
,
MyProcPid
,
tempFileCounter
++
);
pfree
(
path
);
file
=
PathNameOpenFile
(
tempfilepath
,
O_RDWR
|
O_CREAT
|
O_TRUNC
|
PG_BINARY
,
0600
);
}
/*
* Create a normal temporary file if no tablespace returned or
* couldn't create the file in the tablespace "oid"
*/
if
(
oid
==
InvalidOid
||
file
<=
0
)
{
path
=
PG_TEMP_FILES_DIR
;
/*
/*
* Generate a tempfile name that should be unique within the current
* Generate a tempfile name that should be unique within the current
* database instance.
* database instance.
*/
*/
snprintf
(
tempfilepath
,
sizeof
(
tempfilepath
),
snprintf
(
tempfilepath
,
sizeof
(
tempfilepath
),
"%s/%s%d.%ld"
,
path
,
PG_TEMP_FILE_PREFIX
,
"%s/%s%d.%ld"
,
PG_TEMP_FILES_DIR
,
PG_TEMP_FILE_PREFIX
,
MyProcPid
,
tempFileCounter
++
);
MyProcPid
,
tempFileCounter
++
);
/*
/*
...
@@ -960,7 +919,6 @@ OpenTemporaryFile(bool interXact)
...
@@ -960,7 +919,6 @@ OpenTemporaryFile(bool interXact)
elog
(
ERROR
,
"could not create temporary file
\"
%s
\"
: %m"
,
elog
(
ERROR
,
"could not create temporary file
\"
%s
\"
: %m"
,
tempfilepath
);
tempfilepath
);
}
}
}
/* Mark it for deletion at close */
/* Mark it for deletion at close */
VfdCache
[
file
].
fdstate
|=
FD_TEMPORARY
;
VfdCache
[
file
].
fdstate
|=
FD_TEMPORARY
;
...
...
src/backend/utils/misc/guc.c
View file @
a535cdf1
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.37
8 2007/03/03 18:46:40
momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.37
9 2007/03/06 02:06:14
momjian Exp $
*
*
*--------------------------------------------------------------------
*--------------------------------------------------------------------
*/
*/
...
@@ -99,7 +99,6 @@ extern bool Log_disconnections;
...
@@ -99,7 +99,6 @@ extern bool Log_disconnections;
extern
int
CommitDelay
;
extern
int
CommitDelay
;
extern
int
CommitSiblings
;
extern
int
CommitSiblings
;
extern
char
*
default_tablespace
;
extern
char
*
default_tablespace
;
extern
char
*
temp_tablespaces
;
extern
bool
fullPageWrites
;
extern
bool
fullPageWrites
;
#ifdef TRACE_SORT
#ifdef TRACE_SORT
...
@@ -2317,16 +2316,6 @@ static struct config_string ConfigureNamesString[] =
...
@@ -2317,16 +2316,6 @@ static struct config_string ConfigureNamesString[] =
"content"
,
assign_xmloption
,
NULL
"content"
,
assign_xmloption
,
NULL
},
},
{
{
"temp_tablespaces"
,
PGC_USERSET
,
PGC_S_FILE
,
gettext_noop
(
"Sets the tablespaces suitable for creating new objects and sort files."
),
NULL
,
GUC_LIST_INPUT
|
GUC_LIST_QUOTE
},
&
temp_tablespaces
,
NULL
,
assign_temp_tablespaces
,
NULL
},
#ifdef USE_SSL
#ifdef USE_SSL
{
{
{
"ssl_ciphers"
,
PGC_POSTMASTER
,
CONN_AUTH_SECURITY
,
{
"ssl_ciphers"
,
PGC_POSTMASTER
,
CONN_AUTH_SECURITY
,
...
...
src/backend/utils/misc/postgresql.conf.sample
View file @
a535cdf1
...
@@ -404,8 +404,6 @@
...
@@ -404,8 +404,6 @@
#search_path = '"$user",public' # schema names
#search_path = '"$user",public' # schema names
#default_tablespace = '' # a tablespace name, '' uses
#default_tablespace = '' # a tablespace name, '' uses
# the default
# the default
#temp_tablespaces = '' # a list of tablespace names,
# '' uses default_tablespace
#check_function_bodies = on
#check_function_bodies = on
#default_transaction_isolation = 'read committed'
#default_transaction_isolation = 'read committed'
#default_transaction_read_only = off
#default_transaction_read_only = off
...
...
src/include/commands/tablespace.h
View file @
a535cdf1
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/commands/tablespace.h,v 1.1
5 2007/01/25 04:35:11
momjian Exp $
* $PostgreSQL: pgsql/src/include/commands/tablespace.h,v 1.1
6 2007/03/06 02:06:15
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -41,7 +41,6 @@ extern void AlterTableSpaceOwner(const char *name, Oid newOwnerId);
...
@@ -41,7 +41,6 @@ extern void AlterTableSpaceOwner(const char *name, Oid newOwnerId);
extern
void
TablespaceCreateDbspace
(
Oid
spcNode
,
Oid
dbNode
,
bool
isRedo
);
extern
void
TablespaceCreateDbspace
(
Oid
spcNode
,
Oid
dbNode
,
bool
isRedo
);
extern
Oid
GetDefaultTablespace
(
void
);
extern
Oid
GetDefaultTablespace
(
void
);
extern
Oid
GetTempTablespace
(
void
);
extern
Oid
get_tablespace_oid
(
const
char
*
tablespacename
);
extern
Oid
get_tablespace_oid
(
const
char
*
tablespacename
);
extern
char
*
get_tablespace_name
(
Oid
spc_oid
);
extern
char
*
get_tablespace_name
(
Oid
spc_oid
);
...
...
src/include/utils/guc.h
View file @
a535cdf1
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Copyright (c) 2000-2007, PostgreSQL Global Development Group
* Copyright (c) 2000-2007, PostgreSQL Global Development Group
* Written by Peter Eisentraut <peter_e@gmx.net>.
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
*
* $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.
79 2007/01/25 04:35:11
momjian Exp $
* $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.
80 2007/03/06 02:06:15
momjian Exp $
*--------------------------------------------------------------------
*--------------------------------------------------------------------
*/
*/
#ifndef GUC_H
#ifndef GUC_H
...
@@ -238,8 +238,4 @@ extern const char *assign_search_path(const char *newval,
...
@@ -238,8 +238,4 @@ extern const char *assign_search_path(const char *newval,
extern
const
char
*
assign_xlog_sync_method
(
const
char
*
method
,
extern
const
char
*
assign_xlog_sync_method
(
const
char
*
method
,
bool
doit
,
GucSource
source
);
bool
doit
,
GucSource
source
);
/* in commands/tablespace.c */
extern
const
char
*
assign_temp_tablespaces
(
const
char
*
newval
,
bool
doit
,
GucSource
source
);
#endif
/* GUC_H */
#endif
/* GUC_H */
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