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

Commitc5354df

Browse files
committed
This patch removes a lot of unused code related to assertions and
error handling, and simplifies the code that remains. Apparently,the code that left Berkeley had a whole "error handling subsystem",which exceptions and whatnot. Since we don't use that anymore,there's no reason to keep it around.The regression tests pass with the patch applied. Unless anyonesees a problem, please apply.Neil Conway
1 parent8be9bd8 commitc5354df

File tree

11 files changed

+35
-441
lines changed

11 files changed

+35
-441
lines changed

‎src/backend/bootstrap/bootstrap.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.136 2002/08/04 06:26:38 thomas Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.137 2002/08/10 20:29:17 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -37,7 +37,6 @@
3737
#include"storage/proc.h"
3838
#include"tcop/tcopprot.h"
3939
#include"utils/builtins.h"
40-
#include"utils/exc.h"
4140
#include"utils/fmgroids.h"
4241
#include"utils/guc.h"
4342
#include"utils/lsyscache.h"
@@ -238,7 +237,6 @@ BootstrapMain(int argc, char *argv[])
238237
*/
239238
if (!IsUnderPostmaster)
240239
{
241-
EnableExceptionHandling(true);
242240
MemoryContextInit();
243241
}
244242

‎src/backend/port/ipc_test.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
*
2323
* IDENTIFICATION
24-
* $Header: /cvsroot/pgsql/src/backend/port/ipc_test.c,v 1.3 2002/06/20 20:29:33 momjian Exp $
24+
* $Header: /cvsroot/pgsql/src/backend/port/ipc_test.c,v 1.4 2002/08/10 20:29:18 momjian Exp $
2525
*
2626
*-------------------------------------------------------------------------
2727
*/
@@ -34,7 +34,6 @@
3434
#include"storage/ipc.h"
3535
#include"storage/pg_sema.h"
3636
#include"storage/pg_shmem.h"
37-
#include"utils/exc.h"
3837

3938

4039
/********* stuff needed to satisfy references in shmem/sema code *********/
@@ -56,8 +55,6 @@ intNBuffers = DEF_NBUFFERS;
5655
boolassert_enabled= true;
5756
#endif
5857

59-
ExceptionFailedAssertion= {"Failed Assertion"};
60-
6158

6259
#defineMAX_ON_EXITS 20
6360

@@ -120,14 +117,12 @@ ProcessInterrupts(void)
120117

121118
int
122119
ExceptionalCondition(char*conditionName,
123-
Exception*exceptionP,
124-
char*detail,
120+
char*errorType,
125121
char*fileName,
126122
intlineNumber)
127123
{
128-
fprintf(stderr,"TRAP: %s(\"%s:%s\", File: \"%s\", Line: %d)\n",
129-
exceptionP->message,conditionName,
130-
(detail==NULL ?"" :detail),
124+
fprintf(stderr,"TRAP: %s(\"%s\", File: \"%s\", Line: %d)\n",
125+
errorType,conditionName,
131126
fileName,lineNumber);
132127
abort();
133128
return0;

‎src/backend/postmaster/postmaster.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.282 2002/08/04 06:26:38 thomas Exp $
40+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.283 2002/08/10 20:29:18 momjian Exp $
4141
*
4242
* NOTES
4343
*
@@ -102,7 +102,6 @@
102102
#include"storage/proc.h"
103103
#include"access/xlog.h"
104104
#include"tcop/tcopprot.h"
105-
#include"utils/exc.h"
106105
#include"utils/guc.h"
107106
#include"utils/memutils.h"
108107
#include"utils/ps_status.h"
@@ -380,9 +379,8 @@ PostmasterMain(int argc, char *argv[])
380379
MyProcPid=getpid();
381380

382381
/*
383-
* Fire up essential subsystems:error andmemory management
382+
* Fire up essential subsystems: memory management
384383
*/
385-
EnableExceptionHandling(true);
386384
MemoryContextInit();
387385

388386
/*

‎src/backend/tcop/postgres.c

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.280 2002/08/06 05:24:04 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.281 2002/08/10 20:29:18 momjian Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -54,7 +54,6 @@
5454
#include"tcop/pquery.h"
5555
#include"tcop/tcopprot.h"
5656
#include"tcop/utility.h"
57-
#include"utils/exc.h"
5857
#include"utils/guc.h"
5958
#include"utils/memutils.h"
6059
#include"utils/ps_status.h"
@@ -1148,7 +1147,6 @@ PostgresMain(int argc, char *argv[], const char *username)
11481147
*/
11491148
if (!IsUnderPostmaster)
11501149
{
1151-
EnableExceptionHandling(true);
11521150
MemoryContextInit();
11531151
}
11541152

@@ -1676,7 +1674,7 @@ PostgresMain(int argc, char *argv[], const char *username)
16761674
if (!IsUnderPostmaster)
16771675
{
16781676
puts("\nPOSTGRES backend interactive interface ");
1679-
puts("$Revision: 1.280 $ $Date: 2002/08/06 05:24:04 $\n");
1677+
puts("$Revision: 1.281 $ $Date: 2002/08/10 20:29:18 $\n");
16801678
}
16811679

16821680
/*
@@ -2074,35 +2072,6 @@ ShowUsage(const char *title)
20742072
pfree(str.data);
20752073
}
20762074

2077-
#ifdefNOT_USED
2078-
staticint
2079-
assertEnable(intval)
2080-
{
2081-
assert_enabled=val;
2082-
returnval;
2083-
}
2084-
2085-
#ifdefASSERT_CHECKING_TEST
2086-
int
2087-
assertTest(intval)
2088-
{
2089-
Assert(val==0);
2090-
2091-
if (assert_enabled)
2092-
{
2093-
/* val != 0 should be trapped by previous Assert */
2094-
elog(DEBUG3,"Assert test successful (val = %d)",val);
2095-
}
2096-
else
2097-
elog(DEBUG3,"Assert checking is disabled (val = %d)",val);
2098-
2099-
returnval;
2100-
}
2101-
#endif
2102-
2103-
#endif
2104-
2105-
21062075
/* ----------------------------------------------------------------
21072076
*CreateCommandTag
21082077
*

‎src/backend/utils/error/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
# Makefile for utils/error
55
#
66
# IDENTIFICATION
7-
# $Header: /cvsroot/pgsql/src/backend/utils/error/Makefile,v 1.9 2000/08/31 16:10:48 petere Exp $
7+
# $Header: /cvsroot/pgsql/src/backend/utils/error/Makefile,v 1.10 2002/08/10 20:29:18 momjian Exp $
88
#
99
#-------------------------------------------------------------------------
1010

1111
subdir = src/backend/utils/error
1212
top_builddir = ../../../..
1313
include$(top_builddir)/src/Makefile.global
1414

15-
OBJS = assert.o elog.o exc.o excabort.o excid.o format.o
15+
OBJS = assert.o elog.o
1616

1717
all: SUBSYS.o
1818

‎src/backend/utils/error/assert.c

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,65 +8,44 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/error/assert.c,v 1.21 2002/06/20 20:29:39 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/error/assert.c,v 1.22 2002/08/10 20:29:18 momjian Exp $
1212
*
1313
* NOTE
14-
* This should eventually work with elog(), dlog(), etc.
14+
* This should eventually work with elog()
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
1818
#include"postgres.h"
1919

20-
#include<stdio.h>
2120
#include<unistd.h>
2221

23-
#include"utils/exc.h"
24-
22+
/*
23+
* ExceptionalCondition - Handles the failure of an Assert()
24+
*/
2525
int
2626
ExceptionalCondition(char*conditionName,
27-
Exception*exceptionP,
28-
char*detail,
27+
char*errorType,
2928
char*fileName,
3029
intlineNumber)
3130
{
32-
ExcFileName=fileName;
33-
ExcLineNumber=lineNumber;
34-
3531
if (!PointerIsValid(conditionName)
3632
|| !PointerIsValid(fileName)
37-
|| !PointerIsValid(exceptionP))
33+
|| !PointerIsValid(errorType))
3834
{
3935
fprintf(stderr,"TRAP: ExceptionalCondition: bad arguments\n");
40-
41-
ExcAbort(exceptionP,
42-
(ExcDetail)detail,
43-
(ExcData)NULL,
44-
(ExcMessage)NULL);
4536
}
4637
else
4738
{
48-
fprintf(stderr,"TRAP: %s(\"%s:%s\", File: \"%s\", Line: %d)\n",
49-
exceptionP->message,conditionName,
50-
(detail==NULL ?"" :detail),
39+
fprintf(stderr,"TRAP: %s(\"%s\", File: \"%s\", Line: %d)\n",
40+
errorType,conditionName,
5141
fileName,lineNumber);
5242
}
5343

54-
#ifdefABORT_ON_ASSERT
55-
abort();
56-
#endif
5744
#ifdefSLEEP_ON_ASSERT
5845
sleep(1000000);
5946
#endif
6047

61-
/*
62-
* XXX Depending on the Exception and tracing conditions, you will XXX
63-
* want to stop here immediately and maybe dump core. XXX This may be
64-
* especially true for Assert(), etc.
65-
*/
66-
67-
/* TraceDump();dump the trace stack */
48+
abort();
6849

69-
/* XXX FIXME: detail is lost */
70-
ExcRaise(exceptionP, (ExcDetail)0, (ExcData)NULL,conditionName);
7150
return0;
7251
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp