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

Commita535cdf

Browse files
committed
Revert temp_tablespaces because of coding problems, per Tom.
1 parent4ae6967 commita535cdf

File tree

10 files changed

+16
-258
lines changed

10 files changed

+16
-258
lines changed

‎doc/src/sgml/config.sgml

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.114 2007/03/03 18:46:40 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.115 2007/03/06 02:06:12 momjian Exp $ -->
22

33
<chapter Id="runtime-config">
44
<title>Server Configuration</title>
@@ -3440,35 +3440,6 @@ SELECT * FROM parent WHERE key = 2400;
34403440
</listitem>
34413441
</varlistentry>
34423442

3443-
<varlistentry id="guc-temp-tablespaces" xreflabel="temp_tablespaces">
3444-
<term><varname>temp_tablespaces</varname> (<type>string</type>)</term>
3445-
<indexterm>
3446-
<primary><varname>temp_tablespaces</> configuration parameter</primary>
3447-
</indexterm>
3448-
<indexterm><primary>tablespace</><secondary>temp</></>
3449-
<listitem>
3450-
<para>
3451-
This variable specifies tablespaces in which to create temp
3452-
objects (temp tables and indexes on temp tables) when a
3453-
<command>CREATE</> command does not explicitly specify a tablespace
3454-
and temp files when necessary (eg. for sorting operations).
3455-
</para>
3456-
3457-
<para>
3458-
The value is either a list of names of tablespaces, or an empty
3459-
string to specify using the default tablespace of the current database.
3460-
If the value does not match the name of any existing tablespace,
3461-
<productname>PostgreSQL</> will automatically use the default
3462-
tablespace of the current database.
3463-
</para>
3464-
3465-
<para>
3466-
For more information on tablespaces,
3467-
see <xref linkend="manage-ag-tablespaces">.
3468-
</para>
3469-
</listitem>
3470-
</varlistentry>
3471-
34723443
<varlistentry id="guc-check-function-bodies" xreflabel="check_function_bodies">
34733444
<term><varname>check_function_bodies</varname> (<type>boolean</type>)</term>
34743445
<indexterm>

‎src/backend/commands/indexcmds.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.155 2007/02/01 19:10:26 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.156 2007/03/06 02:06:12 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -209,13 +209,7 @@ DefineIndex(RangeVar *heapRelation,
209209
}
210210
else
211211
{
212-
/*
213-
* if the target table is temporary then use a temp_tablespace
214-
*/
215-
if (!rel->rd_istemp)
216-
tablespaceId=GetDefaultTablespace();
217-
else
218-
tablespaceId=GetTempTablespace();
212+
tablespaceId=GetDefaultTablespace();
219213
/* note InvalidOid is OK in this case */
220214
}
221215

‎src/backend/commands/tablecmds.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.215 2007/02/16 22:04:02 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.216 2007/03/06 02:06:13 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -330,10 +330,6 @@ DefineRelation(CreateStmt *stmt, char relkind)
330330
errmsg("tablespace \"%s\" does not exist",
331331
stmt->tablespacename)));
332332
}
333-
elseif (stmt->relation->istemp)
334-
{
335-
tablespaceId=GetTempTablespace();
336-
}
337333
else
338334
{
339335
tablespaceId=GetDefaultTablespace();

‎src/backend/commands/tablespace.c

Lines changed: 2 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.42 2007/02/01 19:10:26 momjian Exp $
40+
* $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.43 2007/03/06 02:06:13 momjian Exp $
4141
*
4242
*-------------------------------------------------------------------------
4343
*/
@@ -65,12 +65,9 @@
6565
#include"utils/lsyscache.h"
6666

6767

68-
/* GUCvariables */
68+
/* GUCvariable */
6969
char*default_tablespace=NULL;
70-
char*temp_tablespaces=NULL;
7170

72-
intnext_temp_tablespace;
73-
intnum_temp_tablespaces;
7471

7572
staticboolremove_tablespace_directories(Oidtablespaceoid,boolredo);
7673
staticvoidset_short_version(constchar*path);
@@ -933,142 +930,6 @@ GetDefaultTablespace(void)
933930
returnresult;
934931
}
935932

936-
/*
937-
* Routines for handling the GUC variable 'temp_tablespaces'.
938-
*/
939-
940-
/* assign_hook: validate new temp_tablespaces, do extra actions as needed */
941-
constchar*
942-
assign_temp_tablespaces(constchar*newval,booldoit,GucSourcesource)
943-
{
944-
char*rawname;
945-
List*namelist;
946-
ListCell*l;
947-
948-
/* Need a modifiable copy of string */
949-
rawname=pstrdup(newval);
950-
951-
/* Parse string into list of identifiers */
952-
if (!SplitIdentifierString(rawname,',',&namelist))
953-
{
954-
/* syntax error in name list */
955-
pfree(rawname);
956-
list_free(namelist);
957-
returnNULL;
958-
}
959-
960-
num_temp_tablespaces=0;
961-
foreach(l,namelist)
962-
{
963-
char*curname= (char*)lfirst(l);
964-
965-
/*
966-
* If we aren't inside a transaction, we cannot do database access so
967-
* cannot verify the individual names.Must accept the list on faith.
968-
*/
969-
if (source >=PGC_S_INTERACTIVE&&IsTransactionState())
970-
{
971-
/*
972-
* Verify that all the names are valid tablspace names
973-
* We do not check for USAGE rights should we?
974-
*/
975-
if (get_tablespace_oid(curname)==InvalidOid)
976-
ereport((source==PGC_S_TEST) ?NOTICE :ERROR,
977-
(errcode(ERRCODE_UNDEFINED_OBJECT),
978-
errmsg("tablespace \"%s\" does not exist",curname)));
979-
}
980-
num_temp_tablespaces++;
981-
}
982-
983-
/*
984-
* Select the first tablespace to use
985-
*/
986-
next_temp_tablespace=MyProcPid %num_temp_tablespaces;
987-
988-
pfree(rawname);
989-
list_free(namelist);
990-
returnnewval;
991-
}
992-
993-
/*
994-
* GetTempTablespace -- get the OID of the tablespace for temporary objects
995-
*
996-
* May return InvalidOid to indicate "use the database's default tablespace"
997-
*
998-
* This exists to hide the temp_tablespace GUC variable.
999-
*/
1000-
Oid
1001-
GetTempTablespace(void)
1002-
{
1003-
Oidresult;
1004-
char*curname=NULL;
1005-
char*rawname;
1006-
List*namelist;
1007-
ListCell*l;
1008-
inti=0;
1009-
1010-
if (temp_tablespaces==NULL )
1011-
returnInvalidOid;
1012-
1013-
/* Need a modifiable version of temp_tablespaces */
1014-
rawname=pstrdup(temp_tablespaces);
1015-
1016-
/* Parse string into list of identifiers */
1017-
if (!SplitIdentifierString(rawname,',',&namelist))
1018-
{
1019-
/* syntax error in name list */
1020-
pfree(rawname);
1021-
list_free(namelist);
1022-
returnInvalidOid;
1023-
}
1024-
1025-
/*
1026-
* Iterate through the list of namespaces until the one we need
1027-
* (next_temp_tablespace)
1028-
*/
1029-
foreach(l,namelist)
1030-
{
1031-
curname= (char*)lfirst(l);
1032-
if (i==next_temp_tablespace )
1033-
break;
1034-
i++;
1035-
}
1036-
1037-
1038-
/* Prepare for the next time the function is called */
1039-
next_temp_tablespace++;
1040-
if (next_temp_tablespace==num_temp_tablespaces)
1041-
next_temp_tablespace=0;
1042-
1043-
/* Fast path for temp_tablespaces == "" */
1044-
if (curname==NULL||curname[0]=='\0') {
1045-
list_free(namelist);
1046-
pfree(rawname);
1047-
returnInvalidOid;
1048-
}
1049-
1050-
/*
1051-
* It is tempting to cache this lookup for more speed, but then we would
1052-
* fail to detect the case where the tablespace was dropped since the GUC
1053-
* variable was set. Note also that we don't complain if the value fails
1054-
* to refer to an existing tablespace; we just silently return InvalidOid,
1055-
* causing the new object to be created in the database's tablespace.
1056-
*/
1057-
result=get_tablespace_oid(curname);
1058-
1059-
/* We don't free rawname before because curname points to a part of it */
1060-
pfree(rawname);
1061-
1062-
/*
1063-
* Allow explicit specification of database's default tablespace in
1064-
* default_tablespace without triggering permissions checks.
1065-
*/
1066-
if (result==MyDatabaseTableSpace)
1067-
result=InvalidOid;
1068-
1069-
list_free(namelist);
1070-
returnresult;
1071-
}
1072933

1073934
/*
1074935
* get_tablespace_oid - given a tablespace name, look up the OID

‎src/backend/executor/execMain.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*
2727
*
2828
* IDENTIFICATION
29-
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.289 2007/02/27 01:11:25 tgl Exp $
29+
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.290 2007/03/06 02:06:13 momjian Exp $
3030
*
3131
*-------------------------------------------------------------------------
3232
*/
@@ -2440,10 +2440,6 @@ OpenIntoRel(QueryDesc *queryDesc)
24402440
errmsg("tablespace \"%s\" does not exist",
24412441
into->tableSpaceName)));
24422442
}
2443-
elseif (into->rel->istemp)
2444-
{
2445-
tablespaceId=GetTempTablespace();
2446-
}
24472443
else
24482444
{
24492445
tablespaceId=GetDefaultTablespace();

‎src/backend/storage/file/fd.c

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.136 2007/02/28 15:59:30 mha Exp $
10+
* $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.137 2007/03/06 02:06:14 momjian Exp $
1111
*
1212
* NOTES:
1313
*
@@ -46,8 +46,6 @@
4646
#include<unistd.h>
4747
#include<fcntl.h>
4848

49-
#include"commands/tablespace.h"
50-
5149
#include"miscadmin.h"
5250
#include"access/xact.h"
5351
#include"storage/fd.h"
@@ -78,7 +76,6 @@
7876
*/
7977
#defineFD_MINFREE10
8078

81-
#defineOIDCHARS 10/* max chars printed by %u */
8279

8380
/*
8481
* A number of platforms allow individual processes to open many more files
@@ -883,51 +880,13 @@ OpenTemporaryFile(bool interXact)
883880
{
884881
chartempfilepath[MAXPGPATH];
885882
Filefile;
886-
Oidoid;
887-
char*path;
888-
intpathlen;
889883

890884
/*
891-
* Take a look what should be the path of the temporary file
885+
* Generate a tempfile name that should be unique within the current
886+
* database instance.
892887
*/
893-
oid=GetTempTablespace();
894-
if (oid!=InvalidOid)
895-
{
896-
/*
897-
* As we got a valid tablespace, try to create the
898-
* file there
899-
*/
900-
901-
pathlen=strlen("pg_tblspc/")+OIDCHARS+1;
902-
path= (char*)palloc(pathlen);
903-
snprintf(path,pathlen,"pg_tblspc/%u",oid );
904-
905-
/*
906-
* Generate a tempfile name that should be unique within the current
907-
* database instance.
908-
*/
909-
snprintf(tempfilepath,sizeof(tempfilepath),
910-
"%s/%s%d.%ld",path,PG_TEMP_FILE_PREFIX,
911-
MyProcPid,tempFileCounter++);
912-
pfree(path);
913-
file=PathNameOpenFile(tempfilepath,
914-
O_RDWR |O_CREAT |O_TRUNC |PG_BINARY,
915-
0600);
916-
}
917-
918-
/*
919-
* Create a normal temporary file if no tablespace returned or
920-
* couldn't create the file in the tablespace "oid"
921-
*/
922-
if (oid==InvalidOid||file <=0)
923-
{
924-
path=PG_TEMP_FILES_DIR;
925-
/*
926-
* Generate a tempfile name that should be unique within the current
927-
* database instance.
928-
*/
929-
snprintf(tempfilepath,sizeof(tempfilepath),
930-
"%s/%s%d.%ld",path,PG_TEMP_FILE_PREFIX,
888+
snprintf(tempfilepath,sizeof(tempfilepath),
889+
"%s/%s%d.%ld",PG_TEMP_FILES_DIR,PG_TEMP_FILE_PREFIX,
931890
MyProcPid,tempFileCounter++);
932891

933892
/*
@@ -959,8 +918,7 @@ OpenTemporaryFile(bool interXact)
959918
if (file <=0)
960919
elog(ERROR,"could not create temporary file \"%s\": %m",
961920
tempfilepath);
962-
}
963-
}
921+
}
964922

965923
/* Mark it for deletion at close */
966924
VfdCache[file].fdstate |=FD_TEMPORARY;

‎src/backend/utils/misc/guc.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.378 2007/03/03 18:46:40 momjian Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.379 2007/03/06 02:06:14 momjian Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -99,7 +99,6 @@ extern bool Log_disconnections;
9999
externintCommitDelay;
100100
externintCommitSiblings;
101101
externchar*default_tablespace;
102-
externchar*temp_tablespaces;
103102
externboolfullPageWrites;
104103

105104
#ifdefTRACE_SORT
@@ -2317,16 +2316,6 @@ static struct config_string ConfigureNamesString[] =
23172316
"content",assign_xmloption,NULL
23182317
},
23192318

2320-
{
2321-
{"temp_tablespaces",PGC_USERSET,PGC_S_FILE,
2322-
gettext_noop("Sets the tablespaces suitable for creating new objects and sort files."),
2323-
NULL,
2324-
GUC_LIST_INPUT |GUC_LIST_QUOTE
2325-
},
2326-
&temp_tablespaces,
2327-
NULL,assign_temp_tablespaces,NULL
2328-
},
2329-
23302319
#ifdefUSE_SSL
23312320
{
23322321
{"ssl_ciphers",PGC_POSTMASTER,CONN_AUTH_SECURITY,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp