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

Commitb619cb0

Browse files
committed
iBrought in a fix for backend crashes
Submitted by: "Vadim B. Mikheev" <vadim@sable.krasnoyarsk.su>
1 parent00fe588 commitb619cb0

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

‎src/backend/storage/buf_internals.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: buf_internals.h,v 1.2 1996/07/22 22:59:42 scrappy Exp $
9+
* $Id: buf_internals.h,v 1.3 1996/07/23 05:43:11 scrappy Exp $
1010
*
1111
* NOTE
1212
*If BUFFERPAGE0 is defined, then 0 will be used as a
@@ -118,8 +118,8 @@ struct sbufdesc {
118118
int16bufsmgr;/* storage manager id for buffer */
119119
unsignedrefcount;/* # of times buffer is pinned */
120120

121-
char*sb_dbname;/* name of db in which buf belongs */
122-
char*sb_relname;/* name of reln */
121+
charsb_dbname[NAMEDATALEN+1];/* name of db in which buf belongs */
122+
charsb_relname[NAMEDATALEN+1];/* name of reln */
123123
#ifdefHAS_TEST_AND_SET
124124
/* can afford a dedicated lock if test-and-set locks are available */
125125
slock_tio_in_progress_lock;
@@ -164,7 +164,7 @@ struct sbufdesc {
164164

165165
#if defined(PORTNAME_BSD44_derived)|| \
166166
defined(PORTNAME_bsdi)|| \
167-
defined(PORTNAME_i86pc_solaris)|| \
167+
defined(PORTNAME_i386_solaris)|| \
168168
defined(PORTNAME_linux)|| \
169169
defined(PORTNAME_sparc)|| \
170170
defined(PORTNAME_sparc_solaris)

‎src/backend/storage/buffer/bufmgr.c

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.1.1.1 1996/07/09 06:21:54 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.2 1996/07/23 05:44:10 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -485,20 +485,23 @@ BufferAlloc(Relation reln,
485485
}
486486
}
487487

488+
if (buf!=NULL )
489+
{
488490
#ifdefHAS_TEST_AND_SET
489-
S_UNLOCK(&(buf->io_in_progress_lock));
491+
S_UNLOCK(&(buf->io_in_progress_lock));
490492
#else/* !HAS_TEST_AND_SET */
491-
if (buf->refcount>1)
492-
SignalIO(buf);
493+
if (buf->refcount>1)
494+
SignalIO(buf);
493495
#endif/* !HAS_TEST_AND_SET */
494496

495497
/* give up the buffer since we don't need it any more */
496-
buf->refcount--;
497-
PrivateRefCount[BufferDescriptorGetBuffer(buf)-1]=0;
498-
AddBufferToFreelist(buf);
499-
buf->flags |=BM_FREE;
500-
buf->flags &= ~BM_DIRTY;
501-
buf->flags &= ~BM_IO_IN_PROGRESS;
498+
buf->refcount--;
499+
PrivateRefCount[BufferDescriptorGetBuffer(buf)-1]=0;
500+
AddBufferToFreelist(buf);
501+
buf->flags |=BM_FREE;
502+
buf->flags &= ~BM_DIRTY;
503+
buf->flags &= ~BM_IO_IN_PROGRESS;
504+
}
502505

503506
SpinRelease(BufMgrLock);
504507

@@ -537,8 +540,8 @@ BufferAlloc(Relation reln,
537540
}
538541

539542
/* record the database name and relation name for this buffer */
540-
buf->sb_relname=pstrdup(reln->rd_rel->relname.data);
541-
buf->sb_dbname=pstrdup(GetDatabaseName());
543+
strcpy (buf->sb_relname,reln->rd_rel->relname.data);
544+
strcpy (buf->sb_dbname,GetDatabaseName());
542545

543546
/* remember which storage manager is responsible for it */
544547
buf->bufsmgr=reln->rd_rel->relsmgr;
@@ -1248,7 +1251,7 @@ PrintBufferDescs()
12481251
elog(NOTICE,"[%02d] (freeNext=%d, freePrev=%d, relname=%.*s, \
12491252
blockNum=%d, flags=0x%x, refcount=%d %d)",
12501253
i,buf->freeNext,buf->freePrev,NAMEDATALEN,
1251-
&(buf->sb_relname),buf->tag.blockNum,buf->flags,
1254+
buf->sb_relname,buf->tag.blockNum,buf->flags,
12521255
buf->refcount,PrivateRefCount[i]);
12531256
}
12541257
SpinRelease(BufMgrLock);
@@ -1273,7 +1276,7 @@ PrintPinnedBufs()
12731276
if (PrivateRefCount[i]>0)
12741277
elog(NOTICE,"[%02d] (freeNext=%d, freePrev=%d, relname=%.*s, \
12751278
blockNum=%d, flags=0x%x, refcount=%d %d)\n",
1276-
i,buf->freeNext,buf->freePrev,NAMEDATALEN,&(buf->sb_relname),
1279+
i,buf->freeNext,buf->freePrev,NAMEDATALEN,buf->sb_relname,
12771280
buf->tag.blockNum,buf->flags,
12781281
buf->refcount,PrivateRefCount[i]);
12791282
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp