å ¥é
PostgreSQLã«ã¯ãã®ãããªèå³æ·±ãæè¡ç解決çããããŸã-ããŒã¿ããŒã¹èªäœã®ãã¡ã€ã«å ã®äœããå®éã«å€æŽããåã«ãDBMSã¯ãã§ã«å éšåœ¢åŒã«å€æãããã³ãã³ããç¹å¥ãªãžã£ãŒãã«ã«æžã蟌ã¿ãŸã-ãã°ãå æžããããã©ã³ã¶ã¯ã·ã§ã³ãæ£åžžã«å®äºããåŸããã®ãã°ã«ã¡ã¢ããŸãã ããã¯é害ããå埩ããããã«è¡ãããŸããããæçµçã«ãéçºè ã®æ¢ç©¶å¿ã¯ããã®ãžã£ãŒãã«ãããã¯ã¢ãããšã¬ããªã±ãŒã·ã§ã³ã«äœ¿çšãããšããã¢ã€ãã¢ã«æãã€ããŸããã ååãšããŠããã¹ãŠã®åããããã«èšé²ãããããšã¯è«ççã§ããããã«ãããã¯ã¢ããããããŒã¿ã埩å ããã ãã§ãªããç¹å®ã®æç¹ã§ããŒã¿ããŒã¹ã®ç¶æ ã埩å ããé©åãªã¿ã€ãã³ã°ã§WALãã°ãšã³ããªã®åçãäžæããããšãã§ããŸãã
ãããããã®ãããªã·ããªãªãèŠãŠã¿ãŸããã-æææ¥ã«åºæ¬çãªããã¯ã¢ãããäœæããŠWALãã°ã®ã¢ãŒã«ã€ããéå§ããæ°Žææ¥ã«èª€ã£ããã¹ã¯ã§åé€ãªã¯ãšã¹ããå®è¡ãããããŒãžã£ãŒãå¿ èŠãªã¬ã³ãŒãã®æ¶å€±ãéææ¥ã«çºè¡šãããšããŸãããã ãã®ç¶æ³ã§ã¯ãããã¯ã¢ããããæ°Žææ¥ãŸã§ããå埩ã§ãããæšææ¥ãšéææ¥ã«ãããŒãžã£ãŒã®äœæ¥ããã¹ãŠå€±ãããŸããã
è«ççãªçåãçããŸãããééã£ãããªã¯ãšã¹ããé€å€ããªãããæææ¥ããéææ¥ãŸã§WALãã°ãåçããããšã¯å¯èœã§ããïŒ
éåžžã®ç¶æ³ã§ã¯ããã©ãŒã©ã ã®è³ªåã«éå®ãããŸããã2ã€ã®FreeBSDãã£ã¹ããªãã¥ãŒã·ã§ã³ãç°ãªãããŒãžã§ã³ã®PostgreSQLãœãŒã¹ã³ãŒããå«ã10ã®tarballã10 GBã®ç©ºã容éãgccã2ã€ã®æ¯èŒçã¢ã³ããŒããããé±ããããŒã©ãã©ã é ãããŒã«ã®ç®±ãæççãªèšæ¶ããããŸããCæ§æããœãªã¥ãŒã·ã§ã³ã«å¿ èŠãªãã®ã§ã¯ãªãã£ããããœãŒã¹ã³ãŒãã調ã¹ãã®ã§ãæ¢ããã®ã¯é£ãã...
ãã®ãããå®éšã®ããã«ãFreeBSD 10ãšPostgreSQL 9.2.8ãããŒãããååŸããŸããã 察å¿ããããŒãžã§ã³ã®ã¯ã©ã€ã¢ã³ãã¯pkgã䜿çšããŠé ä¿¡ã§ããŸãããå€æŽããå¿ èŠã¯ãããŸããã ãã£ããã³ãšããŠã®å¯èœæ§ãäºåã«è¬çœªããŸãããããã¹ãã¯åå¿è åããšãå¿ èŠã«å¿ããŠé ã®ãã¹ãŠããã°ããæŽæ°ããããã«äœæãããããããã¹ãŠã®ããŒã ã詳现ã«æãããŠããŸãã
ã€ã³ã¹ããŒã«ãšåºæ¬çãªãµãŒããŒã®ã»ããã¢ãã
root@leninzhiv> cd /usr/ports/databases/postgresql92-server root@leninzhiv> make fetch root@leninzhiv> make extract
ããŠã³ããŒããããœãŒã¹ãã¡ã€ã«ã¯ãããŒããã£ã¬ã¯ããªã®äœæ¥ãã©ã«ããŒã«å±éãããŸãã ç§ã¯æ£çŽã«ãå€æŽåŸã«ãœãŒã¹ãåæ§ç¯ããæ¹æ³ãç解ããŠããŸããã§ãããmakeåæ§ç¯ãmake cleanã¯ãããŸããã§ãããããã¹ãŠã®å€æŽã§ãã®ãã©ã«ããåçŽã«ç Žå£ããŸãã ããã§ãäœæ¥ãã©ã«ããŒãããŒã ãã£ã¬ã¯ããªã«ã³ããŒããããã§å€æŽãå ããŠãããããŒããã©ã«ããŒã«ã³ããŒããŠmake installãå®è¡ããŸããã
ãŸã äœãå€æŽããŠããŸãããpostgresãèšå®ããã ãã§ãïŒ
root@leninzhiv> make install
ã¢ãŒã«ã€ãçšã®ãã©ã«ããŒãäœæããŸãã
root@leninzhiv> mkdir -p /usr/db_archive/wal root@leninzhiv> mkdir -p /usr/db_archive/data root@leninzhiv> chown -R pgsql:wheel /usr/pg_archive
Postgresã§ã¯ãããŒã¿ãã£ã¬ã¯ããªã«ã¢ã¯ã»ã¹ã§ããã®ã¯ãŠãŒã¶ãŒã®ã¿ã§ããå¿ èŠããããããæš©éãå€æŽããŸãã
root@leninzhiv> chmod 0700 /usr/pg_archive/data
ããªããã£ããªã»ããã¢ãããè¡ããŸãã ããã§ã¯ãpgsql postgresã¢ã«ãŠã³ãã«åãæ¿ããŠããã¡ã€ã«ã®ã¢ã¯ã»ã¹æš©ã«é¢ããé¢åãå°ãªãããã®ãçã«ããªã£ãŠããŸãã
root@leninzhiv> su - pgsql pgsql@leninzhiv> initdb -D /usr/local/pgsql/data
/usr/local/pgsql/data/postgresql.confã®WALãã°ã¢ãŒã«ã€ããã©ã¡ãŒã¿ãŒã®ã³ã¡ã³ããå€ããŠç·šéããŸãã
archive_mode = on
wal_level =ã¢ãŒã«ã€ã
archive_command = 'ãã¹ãïŒ -f / usr / db_archive / wal /ïŒ f && cpïŒ p / usr / db_archive / wal /ïŒ f '
ïŒäŸã¯kamentyã®è¿ãã«ãããŸãïŒ
max_wal_senders = 1
/usr/local/pgsql/data/pg_hba.confã§è¡ã®ã³ã¡ã³ãã解é€ããŸã
ããŒã«ã«ã¬ããªã±ãŒã·ã§ã³pgsql trust
ãµãŒããŒãèµ·åããŸã
pgsql@leninzhiv> /usr/local/etc/rc.d/postgresql start
åºæ¬çãªããã¯ã¢ãããäœæãã
pgsql@leninzhiv> pg_basebackup -D /usr/db_archive/data/
ãã©ã«ããŒ/ usr / db_archive / data /ã«ããŒã¿ãã£ã¬ã¯ããªã®ã³ããŒãããããšã/ usr / db_archive / wal /ã«çŽ000000010000000000000003ãšãã圢åŒã®WALãã¡ã€ã«ãããããšã確èªããŸãã
æ§æãã¡ã€ã«ãå埩çšã«ããŒã¿ãã£ã¬ã¯ããªã®ããã¯ã¢ãããã©ã«ããŒã«ã³ããŒããŸã
cp /usr/local/share/postgresql/recovery.conf.sample /usr/db_archive/data/recovery.conf
ã³ã¡ã³ãã解é€ããŠã埩å ã³ãã³ããç·šéããŸãïŒäŸã¯ã³ã¡ã³ãã®è¿ãã«ãããŸãïŒã
restore_command = 'cp / usr / db_archive / data /ïŒ fïŒ p'
ãšã³ããªãäœæããŸãã
pgsql@leninzhiv> psql -U pgsql -d postgres
postgres=# CREATE TABLE z (z_id serial, z_text character(50)); postgres=# INSERT INTO z (z_text) VALUES ('Karlin'); postgres=# INSERT INTO z (z_text) VALUES ('Petrov'); postgres=# INSERT INTO z (z_text) VALUES ('Ivanov'); postgres=# INSERT INTO z (z_text) VALUES ('Kaplan'); postgres=# INSERT INTO z (z_text) VALUES ('Karas'); postgres=# INSERT INTO z (z_text) VALUES ('Bukova'); postgres=# INSERT INTO z (z_text) VALUES ('Sidorova'); postgres=# INSERT INTO z (z_text) VALUES ('Karman'); postgres=# INSERT INTO z (z_text) VALUES ('Nikolaev');
ã¬ã³ãŒããåé€ããïŒ
postgres=# DELETE FROM z WHERE z_text ILIKE 'Ka%';
ã¬ã³ãŒãã®å€æŽãæ°ããã¬ã³ãŒãã®äœæããã£ã¹ã³
postgres=# UPDATE z SET z_text='Petrova' WHERE z_text='Sidorova'; postgres=# INSERT INTO z (z_text) VALUES ('Kruglov'); postgres=# UPDATE z SET z_text='Alexeeva' WHERE z_text='Bukova'; postgres=# INSERT INTO z (z_text) VALUES ('Kvadrat');
ãã¹ã¯ãšã³ããªãåé€ããã®ã¯åŸçã§ã¯ãªãããšãããããŸãããKarlinãšãšãã«ãKaplanãKarasãKarmanãåé€ããŸããã
ãµãŒããŒãåæ¢ããŸã
pgsql@leninzhiv> /usr/local/etc/rc.d/postgresql stop pgsql@leninzhiv> exit root@leninzhiv>
ãããŠäœããã¹ããèãå§ããŸãã
ãœãŒã¹ã«è¡ããŸã
èŠããŠããããã«ãmake extractã®åŸã«ãäœæ¥ãã©ã«ããŒãããŒããã£ã¬ã¯ããªããããŒã ãã©ã«ããŒã«ã³ããŒããå€æŽãå ããŸããã ãããã£ãŠãæã ã¯ããã«è¡ããŸãã ããŒããã©ã«ããŒèªäœã®ãœãŒã¹ã³ãŒããå€æŽããæ¹æ³ã誰ããæããŠãã³ãŒãã«å ããããå€æŽåŸã«ãã¹ãŠãé©åã«åæ§ç¯ãããããã«ãªãã°ãéåžžã«æè¬ããŸãã
æåã«ãWALãã°ããã¡ã€ã«ããèªã¿åãããå ŽæãèŠã€ãããšããç®æšãèšå®ããŸããã
work / postgresql-9.2.8 / srcãã£ã¬ã¯ããªãšåžžèã®ãã¡ã€ã«ã®å 容ã§ãWALãè¡ãæ€çŽ¢ããŠãWALé¢é£ã®ã³ãŒããå«ããã¡ã€ã«ãèŠã€ããŸãããããã¯xlog.cãã¡ã€ã«ã§ããããšãå€æããŸããã
Cããã°ã©ã ããã¬ãŒã¹ããæ¹æ³ãããããªãã®ã§ãåé¢æ°ã®å é ã§ãã®ååã®ã¬ã³ãŒãããã¡ã€ã«ã«è¿œå ãããã«ãããŠå®è¡ããŸããã
çµæã¯ãã¡ã€ã«ã«æ¬¡ã®ããã«ãªããŸãã
bool check_wal_buffers(int *newval, void **extra, GucSource source) void assign_xlog_sync_method(int new_sync_method, void *extra) Size XLOGShmemSize(void) static int XLOGChooseNumBuffers(void) bool check_wal_buffers(int *newval, void **extra, GucSource source) void XLOGShmemInit(void) Size XLOGShmemSize(void) static void ReadControlFile(void) void StartupXLOG(void) static void ReadControlFile(void) static char * str_time(pg_time_t tnow) static void ValidateXLOGDirectoryStructure(void) static void readRecoveryCommandFile(void) static List * readTimeLineHistory(TimeLineID targetTLI) static bool read_backup_label(XLogRecPtr *checkPointLoc, bool *backupEndRequired, bool *backupFromStandby) static XLogRecord * ReadCheckpointRecord(XLogRecPtr RecPtr, int whichChkpt) static XLogRecord * ReadRecord(XLogRecPtr *RecPtr, int emode, bool fetching_ckpt) static bool XLogPageRead(XLogRecPtr *RecPtr, int emode, bool fetching_ckpt, bool randAccess) static int XLogFileReadAnyTLI(uint32 log, uint32 seg, int emode, int sources) ... static XLogRecord * ReadRecord(XLogRecPtr *RecPtr, int emode, bool fetching_ckpt) static bool XLogPageRead(XLogRecPtr *RecPtr, int emode, bool fetching_ckpt, bool randAccess) static bool RecordIsValid(XLogRecord *record, XLogRecPtr recptr, int emode) static bool recoveryStopsHere(XLogRecord *record, bool *includeThis) static void CheckRecoveryConsistency(void) static XLogRecord * ReadRecord(XLogRecPtr *RecPtr, int emode, bool fetching_ckpt) static bool XLogPageRead(XLogRecPtr *RecPtr, int emode, bool fetching_ckpt, bool randAccess) ...
äžè¬çã«ãã¡ã€ã³ã¢ã¯ã·ã§ã³ã¯ReadRecord-> XLogPageRead-> RecordIsValid-> RecoveryStopsHere-> CheckRecoveryConsistencyã«ãŒãã§å®è¡ããããšããå°è±¡ãåããŸããã
ReadRecordé¢æ°ãããç¥ã£ãŠãããšãæ»ãã¬ã³ãŒããšæ»ãïŒXLogRecord *ïŒãããã¡ãŒã®2ã€ã®å Žæã§ã¬ã³ãŒããè¿ãããããšãããããŸãããäžèšã®ç°¡åãªæ¹æ³ã§ãWALãã°ããå埩ããéçšã§æ»ããreturnïŒXLogRecord *ïŒãããã¡ãŒãééããããšãæããã«ããŸããã ãããïŒ çµæããã¡ã€ã«ã«æžã蟌ã¿ãŸãã
ã¿ã€ãXLogRecordã®æ§é ã¯xlog.hãã¡ã€ã«ã§è¡šç€ºã§ããéåžžã«ç°¡æœã§ãã
typedef struct XLogRecord { pg_crc32 xl_crc; /* CRC for this record */ XLogRecPtr xl_prev; /* ptr to previous record in log */ TransactionId xl_xid; /* xact id */ uint32 xl_tot_len; /* total len of entire record */ uint32 xl_len; /* total len of rmgr data */ uint8 xl_info; /* flag bits, see below */ RmgrId xl_rmid; /* resource manager for this record */ /* ACTUAL LOG DATA FOLLOWS AT END OF STRUCT */ } XLogRecord;
ããŠãé·ããããå Žåã¯ãããã䜿çšããŠã¬ã³ãŒãã®å 容ããã¡ã€ã«ã«åºåãããªã¿ãŒã³ïŒXLogRecord *ïŒãããã¡ãŒãè¿œå ããŸãïŒ
FILE *pf2 = fopen("/usr/local/pgsql/data/log3.txt", "a"); char *buf_poi = buffer; for (uint32 i=0; i < record->xl_tot_len; i++) {fputc(*buf_poi, pf2); buf_poi++;} fprintf(pf2, "\n crc32: %u \n xl_xid=%i \n", record->xl_crc, record->xl_xid); fclose(pf2);
å€ãPostgresãç Žå£ããæ°ããPostgresãçµã¿ç«ãŠãŠã€ã³ã¹ããŒã«ããŸãã
root@leninzhiv> cd /usr/ports/databases/postgresql92-server root@leninzhiv> make deinstall
äœæ¥ãã£ã¬ã¯ããªãããŒã ãã©ã«ããŒã«ã³ããŒããããã§ãã¹ãŠã®ã³ãŒããå€æŽããããšãæãåºããŠãã ããã 次ã«ããããããŒããã£ã¬ã¯ããªã®äœæ¥ãã©ã«ããŒã®å Žæã«ã³ããŒããŸãã
root@leninzhiv> rm -R /usr/ports/databases/postgresql92-server/work root@leninzhiv> cp -R ~/work /usr/ports/databases/postgresql92-server/work root@leninzhiv> make install
ããŒã¿ããŒã¹ãã¡ã€ã«ãåé€ããããŒã¹ããã¯ã¢ããããããã®å Žæã«ã³ããŒããŸãã WALãã¡ã€ã«èªäœãè¿œãã€ããŸãã
root@leninzhiv> su - pgsql pgsql@leninzhiv> /usr/local/etc/rc.d/postgresql stop pgsql@leninzhiv> rm -R /usr/local/pgsql/data pgsql@leninzhiv> cp -R /usr/db_archive/data /usr/local/pgsql/data pgsql@leninzhiv> /usr/local/etc/rc.d/postgresql start pgsql@leninzhiv> psql -U pgsql -d postgres
postgres=# select * from z; postgres=# \q
pgsql@leninzhiv> /usr/local/etc/rc.d/postgresql stop
log3.txtãã¡ã€ã«ã®å 容ã確èªããŸããæåã«ãå€ãã®å€§ããªã¬ã³ãŒããæããã«ãµãŒãã¹ããŒãã«ãšããŒã¿ã®äœæã確èªããŸãã
#{####T#####r###R#### ###### ####0###@###### #e######## ###gNikolaev crc32: 3682278083 l_xid=1002 W# #####U#####,### ###`#######âºÐ%Ñ###### crc32: 3423214679 xl_xid=1002 r" ####xU#####5######## ###### ####0###@########## crc32: 2698322546 xl_xid=1003 #%2####U#####5######## ###### ####0###@########## crc32: 841341184 xl_xid=1003 #W####U#####5######## ###### ####0###@########## crc32: 3881244668 xl_xid=1003 Z7######V#####5######## ###### ####0###@########## crc32: 4028315482 xl_xid=1003 µÐÐÑ####PV#####,### ###`########ÐÐ%Ñ###### crc32: 2426645173 xl_xid=1003 Ñ-B####â¬V#####y###Y###@ ###### ####0###@########I##### ####Ð#(######gPetrova crc32: 1110285523 xl_xid=1004
ãã³ã©ãšããšããããã®ããç¥ãããååã®éã«ã¯ãåãååŒçªå·ã®äžã§4ã€ã®é¡äŒŒãããšã³ããªãš1ã€ã®ç°ãªããšã³ããªãããããšãããããŸãã æããã«ããããã¯åé€ã³ãã³ãã§ããã€ãŸãããããŒãã«64822ã®è¡50ãåé€ããªã©ã®ã³ãã³ãã¯ãã§ã«WALãã°ã«æžã蟌ãŸããŠããŸãã ååãšããŠãäºæ³ã©ããã xl_xid = 1003ã§ãæžã蟌ã¿ã®ä»£ããã«NULLãè¿ããã§ãã¯ãè¿œå ããŸãã
åã³ãå€ãPostgresãåé€ããæ°ããPostgresãåéããŠã€ã³ã¹ããŒã«ãããªã«ããªãéå§ããŸã
æå®ã®å Žæã§ã¬ã³ãŒããåé€ããŸããïŒ ç¢ºãã«ãåé€åŸã«çºçããã¯ãã®ãã¹ãŠãçºçããŸããã§ããã
ãã®ãããç®æš2ã¯ãèšé²ã®ãåçããã©ãã«åãã£ãŠããããèŠã€ããããšã§ãã åããã¡ã€ã«ã§readRecordã®äœ¿çšããã°ããæ€çŽ¢ããçµæãvoid StartupXLOGïŒvoidïŒé¢æ°ãèŠã€ãããŸãã...ãããŠããã®é¢æ°ã®readRecordåŒã³åºãã®2çªç®ãŸãã¯3çªç®ã®åºçŸçŽåŸã«ãééã£ãæ¹åã«é²ãã§ããããšãããããŸãã次ïŒããã«æåã®ã·ãã¯ãªèšºæããŒã¹ãæ¥ãŠã2çªç®ã«ããWALã¬ã³ãŒãèªäœãé©çšããããšããã³ã¡ã³ãã®çŽåŸ-ã¬ã³ãŒãã倱ãã³ãã³ãRmgrTable [record-> xl_rmid] .rm_redoïŒEndRecPtrãrecordïŒ;
ãã®ã³ãŒãã次ã®ããã«å€æŽããŸã
if (record->xl_xid==1003) {} else RmgrTable[record->xl_rmid].rm_redo(EndRecPtr, record);
åæ§ç¯ãèµ·åãå確èª...åå©ïŒ åé€ãããã¬ã³ãŒããåé€ãããåé€åŸã«è¡ãããå€æŽãé©çšãããŸãïŒ
å°åœ¢ã«çŠç¹ãåœãŠãŸã
ãŸããããã¯ééããªãè¯ãããšã§ãããéåžžã«éãããããŒã¿ã»ããã§åé¡ã解決ããŸããããäœæ¥ããŒã¿ããŒã¹ã®ãã°ã§å¿ èŠãªã¬ã³ãŒããèŠã€ããæ¹æ³ã¯ïŒ
StartupXLOGé¢æ°ã§èšåããã·ãã¯ãªèšºæéšåã«æ»ããŸãããã
#ifdef WAL_DEBUG if (XLOG_DEBUG || (rmid == RM_XACT_ID && trace_recovery_messages <= DEBUG2) || (rmid != RM_XACT_ID && trace_recovery_messages <= DEBUG3)) { StringInfoData buf; initStringInfo(&buf); appendStringInfo(&buf, "REDO @ %X/%X; LSN %X/%X: ", ReadRecPtr.xlogid, ReadRecPtr.xrecoff, EndRecPtr.xlogid, EndRecPtr.xrecoff); xlog_outrec(&buf, record); appendStringInfo(&buf, " - "); RmgrTable[record->xl_rmid].rm_desc(&buf, record->xl_info, XLogRecGetData(record)); elog(LOG, "%s", buf.data); pfree(buf.data); } #endif
pg_config_manual.hã§#define WAL_DEBUGã®ã³ã¡ã³ããå€ããpostgresql.confãã¡ã€ã«ã«wal_debug = onãè¿œå ããã ãã§ããã°ã«åºåãå«ããããšãã§ããŸãããç¿æ £çã«ãåºåãå¥ã®ãã¡ã€ã«ã«éä¿¡ããŸããã ç§ãç解ããŠããããã«ããã®éšåã¯rm_descé¢æ°ã䜿çšããŠã³ãã³ãã®èª¬æã衚瀺ããŸãïŒãã®å ŽåãRmgrTableã¯é¢æ°ã®é åã§ããïŒïŒã次ã®ããã«ãªããŸãã
REDO @ 0/3015500; LSN 0/3015578: prev 0/30154D0; xid 1002; len 82: Heap - insert: rel 1663/12318/16386; tid 0/9 REDO @ 0/3015578; LSN 0/30155A8: prev 0/3015500; xid 1002; len 12: Transaction - commit: 2014-06-06 08:38:27.537874+00 REDO @ 0/30155A8; LSN 0/30155E0: prev 0/3015578; xid 1003; len 21: Heap - delete: rel 1663/12318/16386; tid 0/1 REDO @ 0/30155E0; LSN 0/3015618: prev 0/30155A8; xid 1003; len 21: Heap - delete: rel 1663/12318/16386; tid 0/4 REDO @ 0/3015618; LSN 0/3015650: prev 0/30155E0; xid 1003; len 21: Heap - delete: rel 1663/12318/16386; tid 0/5 REDO @ 0/3015650; LSN 0/3015688: prev 0/3015618; xid 1003; len 21: Heap - delete: rel 1663/12318/16386; tid 0/8 REDO @ 0/3015688; LSN 0/30156B8: prev 0/3015650; xid 1003; len 12: Transaction - commit: 2014-06-06 08:38:27.54153+00 REDO @ 0/30156B8; LSN 0/3015738: prev 0/3015688; xid 1004; len 89: Heap - hot_update: rel 1663/12318/16386; tid 0/7; new 0/10
ããã¯ããã©ã³ã¶ã¯ã·ã§ã³çªå·1003ã§æ¢ã«ããã£ãŠããéšåã§ãããããããã¯ãããããã¯4ã€ã®åé€ã³ãã³ããš1ã€ã®ãã©ã³ã¶ã¯ã·ã§ã³ç¢ºèªã§ããããšãããããŸãã åé€ã³ãã³ãã§ã¯ãrel-ãoid namespace / oid database / oid tableããšãã圢åŒã®ããŒãã«ã®èå¥åã衚瀺ãããŸãã 察å¿ããçªå·ã¯ãªã¯ãšã¹ãã§ååŸã§ããŸã
SELECT oidãspcname FROM pg_catalog.pg_tablespace;
SELECT oidãdatname FROM pg_catalog.pg_database;
ãããŠãçªç¶ã
SELECT oidãrelname FROM pg_catalog.pg_class;
2çªç®ã®ã¬ã€ãã©ã€ã³ã¯ããã©ã³ã¶ã¯ã·ã§ã³ã®èª¬æã«ã¿ã€ã ã¹ã¿ã³ããããããšã§ãã ããŠãããã§äœãã説æããå¿ èŠã¯ãããŸããããã®åãç¯çœªããã€ç¯ããããããããã°ã察å¿ããèšé²ãèŠã€ãããŸãã
ããŠãå¥ã®æ¹æ³ãšããŠãkrakozyabraã®ãšã³ããªã®è¡šç€ºã«æ»ããç®çã®ã誀ã£ãããªã¯ãšã¹ãã®çŽåãŸãã¯çŽåŸã«ãã©ã¡ãŒã¿ãäœæãããã¯ãšãªãèŠããŠããã°ãINSERTããã³UPDATEã³ãã³ãã«ãã©ã¡ãŒã¿ãšããŠæž¡ãããããã¹ãã®äžéšãããã²ãŒãã§ããŸãã ãã ããUPDATEã®å Žåãæ°ããå€ãšããŠäœ¿çšãããè¡ã®ã¿ãèŠã€ããããšãã§ããŸãããã®è¡ãã¬ã³ãŒãã®æ€çŽ¢ã«äœ¿çšãããå ŽåãWALãã°ã§ã¯çºçããŸããã
æåŸã«ãPostgreSQL 9.3ã«ãŠã³ã¿ãŒã«pg_xlogdumpãŠãŒãã£ãªãã£ãç»å ŽããŸãããããã¯ã人éãèªãã圢åŒã§WALãã°ã³ã³ãã³ããæäŸããåé¡ã解決ããããšãç®çãšããŠããããã§ãã äžéšã®æ©èœã«èå³ãããå Žåã¯ãéçºè ã«é£çµ¡ããã®ãçã«ããªã£ãŠããŸãã
äœæ¥äžã®ããŒã¿ããŒã¹ã®ã¢ãŒã«ã€ãã§ãã®æ¹æ³ã䜿çšãããšãããã€ãã®èœãšãç©Žãçããå¯èœæ§ããããŸãã ããšãã°ãé »ç¹ãªé¿é£ã䜿çšããããŒã¿ããŒã¹å ã®ã¬ã³ãŒãã®äžéšããã¹ãããããããšãUPDATEã¯ã©ã®ããã«æ©èœããŸããïŒ ãã§ãã¯ããŸããã§ããã ãããããããã«ããããã®å Žåã«ã¯ããšã©ãŒãä¿®æ£ããããšããŸã£ããæãã§ããªãããããå°ãªããšãããçšåºŠã®åžæãæã£ãŠããæ¹ãè¯ãã§ãã