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

Commit6f56b41

Browse files
committed
pg_upgrade: Remove converter plugin facility.
We've not found a use for this so far, and the current need, whichis to convert the visibility map to a new format, does not suit theexisting design anyway. So just rip it out.Author: Masahiko Sawada, slightly revised by me.Discussion: 20160215211313.GB31273@momjian.us
1 parenta93aec4 commit6f56b41

File tree

7 files changed

+18
-330
lines changed

7 files changed

+18
-330
lines changed

‎src/bin/pg_upgrade/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ top_builddir = ../../..
88
include$(top_builddir)/src/Makefile.global
99

1010
OBJS = check.o controldata.o dump.o exec.o file.o function.o info.o\
11-
option.opage.oparallel.o pg_upgrade.o relfilenode.o server.o\
11+
option.o parallel.o pg_upgrade.o relfilenode.o server.o\
1212
tablespace.o util.o version.o$(WIN32RES)
1313

1414
overrideCPPFLAGS := -DDLSUFFIX=\"$(DLSUFFIX)\" -I$(srcdir) -I$(libpq_srcdir)$(CPPFLAGS)

‎src/bin/pg_upgrade/check.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ check_and_dump_old_cluster(bool live_check)
8080
if (!live_check)
8181
start_postmaster(&old_cluster, true);
8282

83-
get_pg_database_relfilenode(&old_cluster);
84-
8583
/* Extract a list of databases and tables from the old cluster */
8684
get_db_and_rel_infos(&old_cluster);
8785

‎src/bin/pg_upgrade/file.c

Lines changed: 5 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,13 @@ static intwin32_pghardlink(const char *src, const char *dst);
2323

2424

2525
/*
26-
*copyAndUpdateFile()
26+
*copyFile()
2727
*
28-
*Copies a relation file from src to dst. If pageConverter is non-NULL, this function
29-
*uses that pageConverter to do a page-by-page conversion.
28+
*Copies a relation file from src to dst.
3029
*/
3130
constchar*
32-
copyAndUpdateFile(pageCnvCtx*pageConverter,
33-
constchar*src,constchar*dst,boolforce)
31+
copyFile(constchar*src,constchar*dst,boolforce)
3432
{
35-
if (pageConverter==NULL)
36-
{
3733
#ifndefWIN32
3834
if (copy_file(src,dst,force)==-1)
3935
#else
@@ -42,70 +38,11 @@ copyAndUpdateFile(pageCnvCtx *pageConverter,
4238
returngetErrorText();
4339
else
4440
returnNULL;
45-
}
46-
else
47-
{
48-
/*
49-
* We have a pageConverter object - that implies that the
50-
* PageLayoutVersion differs between the two clusters so we have to
51-
* perform a page-by-page conversion.
52-
*
53-
* If the pageConverter can convert the entire file at once, invoke
54-
* that plugin function, otherwise, read each page in the relation
55-
* file and call the convertPage plugin function.
56-
*/
57-
58-
#ifdefPAGE_CONVERSION
59-
if (pageConverter->convertFile)
60-
returnpageConverter->convertFile(pageConverter->pluginData,
61-
dst,src);
62-
else
63-
#endif
64-
{
65-
intsrc_fd;
66-
intdstfd;
67-
charbuf[BLCKSZ];
68-
ssize_tbytesRead;
69-
constchar*msg=NULL;
70-
71-
if ((src_fd=open(src,O_RDONLY,0))<0)
72-
return"could not open source file";
73-
74-
if ((dstfd=open(dst,O_RDWR |O_CREAT |O_EXCL,S_IRUSR |S_IWUSR))<0)
75-
{
76-
close(src_fd);
77-
return"could not create destination file";
78-
}
79-
80-
while ((bytesRead=read(src_fd,buf,BLCKSZ))==BLCKSZ)
81-
{
82-
#ifdefPAGE_CONVERSION
83-
if ((msg=pageConverter->convertPage(pageConverter->pluginData,buf,buf))!=NULL)
84-
break;
85-
#endif
86-
if (write(dstfd,buf,BLCKSZ)!=BLCKSZ)
87-
{
88-
msg="could not write new page to destination";
89-
break;
90-
}
91-
}
92-
93-
close(src_fd);
94-
close(dstfd);
95-
96-
if (msg)
97-
returnmsg;
98-
elseif (bytesRead!=0)
99-
return"found partial page in source file";
100-
else
101-
returnNULL;
102-
}
103-
}
10441
}
10542

10643

10744
/*
108-
*linkAndUpdateFile()
45+
*linkFile()
10946
*
11047
* Creates a hard link between the given relation files. We use
11148
* this function to perform a true in-place update. If the on-disk
@@ -114,12 +51,8 @@ copyAndUpdateFile(pageCnvCtx *pageConverter,
11451
* instead of copying the data from the old cluster to the new cluster.
11552
*/
11653
constchar*
117-
linkAndUpdateFile(pageCnvCtx*pageConverter,
118-
constchar*src,constchar*dst)
54+
linkFile(constchar*src,constchar*dst)
11955
{
120-
if (pageConverter!=NULL)
121-
return"Cannot in-place update this cluster, page-by-page conversion is required";
122-
12356
if (pg_link_file(src,dst)==-1)
12457
returngetErrorText();
12558
else

‎src/bin/pg_upgrade/page.c

Lines changed: 0 additions & 164 deletions
This file was deleted.

‎src/bin/pg_upgrade/pg_upgrade.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,6 @@ prepare_new_cluster(void)
260260
new_cluster.bindir,cluster_conn_opts(&new_cluster),
261261
log_opts.verbose ?"--verbose" :"");
262262
check_ok();
263-
264-
get_pg_database_relfilenode(&new_cluster);
265263
}
266264

267265

‎src/bin/pg_upgrade/pg_upgrade.h

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ typedef struct
269269
uint32major_version;/* PG_VERSION of cluster */
270270
charmajor_version_str[64];/* string PG_VERSION of cluster */
271271
uint32bin_version;/* version returned from pg_ctl */
272-
Oidpg_database_oid;/* OID of pg_database relation */
273272
constchar*tablespace_suffix;/* directory specification */
274273
}ClusterInfo;
275274

@@ -364,40 +363,8 @@ boolpid_lock_file_exists(const char *datadir);
364363

365364
/* file.c */
366365

367-
#ifdefPAGE_CONVERSION
368-
typedefconstchar*(*pluginStartup) (uint16migratorVersion,
369-
uint16*pluginVersion,uint16newPageVersion,
370-
uint16oldPageVersion,void**pluginData);
371-
typedefconstchar*(*pluginConvertFile) (void*pluginData,
372-
constchar*dstName,constchar*srcName);
373-
typedefconstchar*(*pluginConvertPage) (void*pluginData,
374-
constchar*dstPage,constchar*srcPage);
375-
typedefconstchar*(*pluginShutdown) (void*pluginData);
376-
377-
typedefstruct
378-
{
379-
uint16oldPageVersion;/* Page layout version of the old cluster*/
380-
uint16newPageVersion;/* Page layout version of the new cluster*/
381-
uint16pluginVersion;/* API version of converter plugin */
382-
void*pluginData;/* Plugin data (set by plugin) */
383-
pluginStartupstartup;/* Pointer to plugin's startup function */
384-
pluginConvertFileconvertFile;/* Pointer to plugin's file converter
385-
* function */
386-
pluginConvertPageconvertPage;/* Pointer to plugin's page converter
387-
* function */
388-
pluginShutdownshutdown;/* Pointer to plugin's shutdown function */
389-
}pageCnvCtx;
390-
391-
constpageCnvCtx*setupPageConverter(void);
392-
#else
393-
/* dummy */
394-
typedefvoid*pageCnvCtx;
395-
#endif
396-
397-
constchar*copyAndUpdateFile(pageCnvCtx*pageConverter,constchar*src,
398-
constchar*dst,boolforce);
399-
constchar*linkAndUpdateFile(pageCnvCtx*pageConverter,constchar*src,
400-
constchar*dst);
366+
constchar*copyFile(constchar*src,constchar*dst,boolforce);
367+
constchar*linkFile(constchar*src,constchar*dst);
401368

402369
voidcheck_hard_link(void);
403370
FILE*fopen_priv(constchar*path,constchar*mode);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp