Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 22f7b96

Browse files
committed
Improve code documentation about "magnetic disk" storage manager.
The modern incarnation of md.c is by no means specific to magnetic disk technology, but every so often we hear from someone who's misled by the label. Try to clarify that it will work for anything that supports standard filesystem operations. Per suggestion from Andrew Dunstan.
1 parent 67eb3e5 commit 22f7b96

File tree

2 files changed

+30
-16
lines changed

2 files changed

+30
-16
lines changed

src/backend/storage/smgr/README

+23-16
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,45 @@
11
src/backend/storage/smgr/README
22

3-
Storage Manager
4-
===============
3+
Storage Managers
4+
================
55

66
In the original Berkeley Postgres system, there were several storage managers,
77
of which only the "magnetic disk" manager remains. (At Berkeley there were
88
also managers for the Sony WORM optical disk jukebox and persistent main
99
memory, but these were never supported in any externally released Postgres,
10-
nor in any version of PostgreSQL.) However, we retain the notion of a storage
11-
manager switch in case anyone wants to reintroduce other kinds of storage
12-
managers.
10+
nor in any version of PostgreSQL.) The "magnetic disk" manager is itself
11+
seriously misnamed, because actually it supports any kind of device for
12+
which the operating system provides standard filesystem operations; which
13+
these days is pretty much everything of interest. However, we retain the
14+
notion of a storage manager switch in case anyone ever wants to reintroduce
15+
other kinds of storage managers. Removing the switch layer would save
16+
nothing noticeable anyway, since storage-access operations are surely far
17+
more expensive than one extra layer of C function calls.
1318

1419
In Berkeley Postgres each relation was tagged with the ID of the storage
15-
manager to use for it. This is gone. It would be more reasonable to
16-
associate storage managers with tablespaces (a feature not present as this
17-
text is being written, but one likely to emerge soon).
20+
manager to use for it. This is gone. It would be probably more reasonable
21+
to associate storage managers with tablespaces, should we ever re-introduce
22+
multiple storage managers into the system catalogs.
1823

1924
The files in this directory, and their contents, are
2025

26+
smgr.c The storage manager switch dispatch code. The routines in
27+
this file call the appropriate storage manager to do storage
28+
accesses requested by higher-level code. smgr.c also manages
29+
the file handle cache (SMgrRelation table).
30+
31+
md.c The "magnetic disk" storage manager, which is really just
32+
an interface to the kernel's filesystem operations.
33+
2134
smgrtype.c Storage manager type -- maps string names to storage manager
2235
IDs and provides simple comparison operators. This is the
23-
regproc support for type 'smgr' in the system catalogs.
36+
regproc support for type "smgr" in the system catalogs.
2437
(This is vestigial since no columns of type smgr exist
2538
in the catalogs anymore.)
2639

27-
smgr.c The storage manager switch dispatch code. The routines in
28-
this file call the appropriate storage manager to do hardware
29-
accesses requested by the backend. smgr.c also manages the
30-
file handle cache (SMgrRelation table).
31-
32-
md.c The magnetic disk storage manager.
33-
3440
Note that md.c in turn relies on src/backend/storage/file/fd.c.
3541

42+
3643
Relation Forks
3744
==============
3845

src/backend/storage/smgr/md.c

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
* md.c
44
* This code manages relations that reside on magnetic disk.
55
*
6+
* Or at least, that was what the Berkeley folk had in mind when they named
7+
* this file. In reality, what this code provides is an interface from
8+
* the smgr API to Unix-like filesystem APIs, so it will work with any type
9+
* of device for which the operating system provides filesystem support.
10+
* It doesn't matter whether the bits are on spinning rust or some other
11+
* storage technology.
12+
*
613
* Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
714
* Portions Copyright (c) 1994, Regents of the University of California
815
*

0 commit comments

Comments
 (0)