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
33854972
Commit
33854972
authored
Nov 27, 1996
by
Vadim B. Mikheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New smgrtruncate smgr' interface func.
parent
a2a33e13
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
3 deletions
+29
-3
src/backend/storage/smgr/smgr.c
src/backend/storage/smgr/smgr.c
+29
-3
No files found.
src/backend/storage/smgr/smgr.c
View file @
33854972
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.
4 1996/11/08 05:59:15 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.
5 1996/11/27 07:25:52 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -36,6 +36,7 @@ typedef struct f_smgr {
...
@@ -36,6 +36,7 @@ typedef struct f_smgr {
int
(
*
smgr_flush
)();
int
(
*
smgr_flush
)();
int
(
*
smgr_blindwrt
)();
int
(
*
smgr_blindwrt
)();
int
(
*
smgr_nblocks
)();
int
(
*
smgr_nblocks
)();
int
(
*
smgr_truncate
)();
int
(
*
smgr_commit
)();
/* may be NULL */
int
(
*
smgr_commit
)();
/* may be NULL */
int
(
*
smgr_abort
)();
/* may be NULL */
int
(
*
smgr_abort
)();
/* may be NULL */
}
f_smgr
;
}
f_smgr
;
...
@@ -49,12 +50,14 @@ static f_smgr smgrsw[] = {
...
@@ -49,12 +50,14 @@ static f_smgr smgrsw[] = {
/* magnetic disk */
/* magnetic disk */
{
mdinit
,
NULL
,
mdcreate
,
mdunlink
,
mdextend
,
mdopen
,
mdclose
,
{
mdinit
,
NULL
,
mdcreate
,
mdunlink
,
mdextend
,
mdopen
,
mdclose
,
mdread
,
mdwrite
,
mdflush
,
mdblindwrt
,
mdnblocks
,
mdcommit
,
mdabort
},
mdread
,
mdwrite
,
mdflush
,
mdblindwrt
,
mdnblocks
,
mdtruncate
,
mdcommit
,
mdabort
},
#ifdef MAIN_MEMORY
#ifdef MAIN_MEMORY
/* main memory */
/* main memory */
{
mminit
,
mmshutdown
,
mmcreate
,
mmunlink
,
mmextend
,
mmopen
,
mmclose
,
{
mminit
,
mmshutdown
,
mmcreate
,
mmunlink
,
mmextend
,
mmopen
,
mmclose
,
mmread
,
mmwrite
,
mmflush
,
mmblindwrt
,
mmnblocks
,
mmcommit
,
mmabort
},
mmread
,
mmwrite
,
mmflush
,
mmblindwrt
,
mmnblocks
,
NULL
,
mmcommit
,
mmabort
},
#endif
/* MAIN_MEMORY */
#endif
/* MAIN_MEMORY */
};
};
...
@@ -321,6 +324,29 @@ smgrnblocks(int16 which, Relation reln)
...
@@ -321,6 +324,29 @@ smgrnblocks(int16 which, Relation reln)
return
(
nblocks
);
return
(
nblocks
);
}
}
/*
* smgrtruncate() -- Truncate supplied relation to a specified number
* of blocks
*
* Returns the number of blocks on success, aborts the current
* transaction on failure.
*/
int
smgrtruncate
(
int16
which
,
Relation
reln
,
int
nblocks
)
{
int
newblks
;
newblks
=
nblocks
;
if
(
smgrsw
[
which
].
smgr_truncate
)
{
if
((
newblks
=
(
*
(
smgrsw
[
which
].
smgr_truncate
))(
reln
,
nblocks
))
<
0
)
elog
(
WARN
,
"cannot truncate %.*s to %d blocks"
,
NAMEDATALEN
,
&
(
reln
->
rd_rel
->
relname
.
data
[
0
]),
nblocks
);
}
return
(
newblks
);
}
/*
/*
* smgrcommit(), smgrabort() -- Commit or abort changes made during the
* smgrcommit(), smgrabort() -- Commit or abort changes made during the
* current transaction.
* current transaction.
...
...
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