T_smart D28X天迈怎么进去smart recoveryy模式

温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
Free PostgreSQL Support.
LOFTER精选
1. smart 模式下promote standby数据库时, 在结束恢复后, 必须执行完一个checkpoint才激活.2. fast 模式下promote standby数据库时, 在结束恢复后, 不需要等待checkpoin结束, 而是往XLOG中写入XLOG_END_OF_RECOVERY标记, 然后激活.原文如下 :&pg_ctl promote -m fast will skip the checkpoint at end of recovery so that wecan achieve very fast failover when the apply delay is low. Write new WAL recordXLOG_END_OF_RECOVERY to allow us to switch timeline correctly for downstream logreaders. If we skip synchronous end of recovery checkpoint we request a normalspread checkpoint so that the window of re-recovery is low.Simon Riggs and Kyotaro Horiguchi, with input from Fujii Masao.Review by Heikki Linnakangas【注意】1. 不管是哪种模式, 都需要等待已经接收到的xlog全部恢复.&所以如果standby的恢复速度与XLOG的接收量相差很大的话, fast模式也快不到哪去.2. wal receiver进程是在apply xlog的进程逻辑(startup process)中关闭的. 如下,src/backend/access/transam/xlog.c/*&* Check to see whether the user-specified trigger file exists and whether a&* promote request has arrived. &If either condition holds, return true.&*/static boolCheckForStandbyTrigger(void){& & & & struct stat stat_& & & & static bool triggered =& & & & if (triggered)& & & & & & & && & & & if (IsPromoteTriggered())& & & & {& & & & & & & & ereport(LOG,& & & & & & & & & & & & & & & & (errmsg("received promote request")));& & & & & & & & ResetPromoteTriggered();& & & & & & & & triggered =& & & & & & & && & & & }& & & & if (TriggerFile == NULL)& & & & & & & && & & & if (stat(TriggerFile, &stat_buf) == 0)& & & & {& & & & & & & & ereport(LOG,& & & & & & & & & & & & & & & & (errmsg("trigger file found: %s", TriggerFile)));& & & & & & & & unlink(TriggerFile);& & & & & & & & triggered =& & & & & & & && & & & }& & & &}所以在检测到触发文件或者promote_triggered=true也就是接收到pg_ctl的promote请求后, 将关闭WALreceiver进程.src/backend/access/transam/xlog.c/*&* In standby mode, wait for WAL at position 'RecPtr' to become available, either&* via restore_command succeeding to restore the segment, or via walreceiver&* having streamed the record (or via someone copying the segment directly to&* pg_xlog, but that is not documented or recommended).&*&* If 'fetching_ckpt' is true, we're fetching a checkpoint record, and should&* prepare to read WAL starting from RedoStartLSN after this.&*&* 'RecPtr' might not point to the beginning of the record we're interested&* in, it might also point to the page or segment header. In that case,&* 'tliRecPtr' is the position of the WAL record we're interested in. It is&* used to decide which timeline to stream the requested WAL from.&*&* When the requested record becomes available, the function opens the file&* containing it (if not open already), and returns true. When end of standby&* mode is triggered by the user, and there is no more WAL available, returns&* false.&*/static boolWaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,& & & & & & & & & & & & & & & & & & & & & & & & & & & & bool fetching_ckpt, XLogRecPtr tliRecPtr){& & & & static pg_time_t last_fail_time = 0;& & & & pg_time_& & & & /*-------& & & & &* Standby mode is implemented by a state machine:& & & & &*& & & & &* 1. Read from archive (XLOG_FROM_ARCHIVE)& & & & &* 2. Read from pg_xlog (XLOG_FROM_PG_XLOG)& & & & &* 3. Check trigger file& & & & &* 4. Read from primary server via walreceiver (XLOG_FROM_STREAM)& & & & &* 5. Rescan timelines& & & & &* 6. Sleep 5 seconds, and loop back to 1.& & & & &*& & & & &* Failure to read from the current source advances the state machine to& & & & &* the next state. In addition, successfully reading a file from pg_xlog& & & & &* moves the state machine from state 2 back to state 1 (we always prefer& & & & &* files in the archive over files in pg_xlog).& & & & &*& & & & &* 'currentSource' indicates the current state. There are no currentSource& & & & &* values for "check trigger", "rescan timelines", and "sleep" states,& & & & &* those actions are taken when reading from the previous source fails, as& & & & &* part of advancing to the next state.& & & & &*-------& & & & &*/....略& & & & & & & & & & & & & & & & case XLOG_FROM_PG_XLOG:& & & & & & & & & & & & & & & & & & & & /*& & & & & & & & & & & & & & & & & & & & &* Check to see if the trigger file exists. Note that we do& & & & & & & & & & & & & & & & & & & & &* this only after failure, so when you create the trigger& & & & & & & & & & & & & & & & & & & & &* file, we still finish replaying as much as we can from& & & & & & & & & & & & & & & & & & & & &* archive and pg_xlog before failover.& & & & & & & & & & & & & & & & & & & & &*/& & & & & & & & & & & & & & & & & & & & if (CheckForStandbyTrigger())& & & & & & & & & & & & & & & & & & & & {& & & & & & & & & & & & & & & & & & & & & & & & ShutdownWalRcv();& & & & & & & & & & & & & & & & & & & & & & & && & & & & & & & & & & & & & & & & & & & }略...src/backend/postmaster/startup.cvoidResetPromoteTriggered(void){& & & & promote_triggered =}【参考】1.&2. src/bin/pg_ctl/pg_ctl.c printf(_("\nPromotion modes are:\n")); printf(_(" &smart & & & promote after performing a checkpoint\n")); printf(_(" &fast & & & &promote quickly without waiting for checkpoint completion\n"));00278 static pgpid_t00279 get_pgpid(void)00280 {00281 & & FILE & & & *00282 & & long & & & &00283&00284 & & pidf = fopen(pid_file, "r");00285 & & if (pidf == NULL)00286 & & {00287 & & & & /* No pid file, not an error on startup */00288 & & & & if (errno == ENOENT)00289 & & & & & & return 0;00290 & & & & else00291 & & & & {00292 & & & & & & write_stderr(_("%s: could not open PID file \"%s\": %s\n"),00293 & & & & & & & & & & & & &progname, pid_file, strerror(errno));00294 & & & & & & exit(1);00295 & & & & }00296 & & }00297 & & if (fscanf(pidf, "%ld", &pid) != 1)00298 & & {00299 & & & & /* Is the file empty? */00300 & & & & if (ftell(pidf) == 0 && feof(pidf))00301 & & & & & & write_stderr(_("%s: the PID file \"%s\" is empty\n"),00302 & & & & & & & & & & & & &progname, pid_file);00303 & & & & else00304 & & & & & & write_stderr(_("%s: invalid data in PID file \"%s\"\n"),00305 & & & & & & & & & & & & &progname, pid_file);00306 & & & & exit(1);00307 & & }00308 & & fclose(pidf);00309 & & return (pgpid_t)00310 }01102 /*01103 &* promote01104 &*/01105&01106 static void01107 do_promote(void)01108 {01109 & & FILE & & & *01110 & & pgpid_t & &01111 & &01112&01113 & & pid = get_pgpid();01114&01115 & & if (pid == 0) & & & & & & & /* no pid file */01116 & & {01117 & & & & write_stderr(_("%s: PID file \"%s\" does not exist\n"), progname, pid_file);01118 & & & & write_stderr(_("Is server running?\n"));01119 & & & & exit(1);01120 & & }01121 & & else if (pid & 0) & & & & & /* standalone backend, not postmaster */01122 & & {01123 & & & & pid = -01124 & & & & write_stderr(_("%s: c "01125 & & & & & & & & & & & &"single-user server is running (PID: %ld)\n"),01126 & & & & & & & & & & &progname, pid);01127 & & & & exit(1);01128 & & }01129&01130 & & /* If recovery.conf doesn't exist, the server is not in standby mode */01131 & & if (stat(recovery_file, &statbuf) != 0)01132 & & {01133 & & & & write_stderr(_("%s: c "01134 & & & & & & & & & & & &"server is not in standby mode\n"),01135 & & & & & & & & & & &progname);01136 & & & & exit(1);01137 & & }01138&01139 & & /*01140 & & &* Use two different kinds of promotion file so we can understand01141 & & &* the difference between smart and fast promotion.01142 & & &*/01143 & & if (shutdown_mode &= FAST_MODE)01144 & & & & snprintf(promote_file, MAXPGPATH, "%s/fast_promote", pg_data);01145 & & else01146 & & & & snprintf(promote_file, MAXPGPATH, "%s/promote", pg_data);01147&01148 & & if ((prmfile = fopen(promote_file, "w")) == NULL)01149 & & {01150 & & & & write_stderr(_("%s: could not create promote signal file \"%s\": %s\n"),01151 & & & & & & & & & & &progname, promote_file, strerror(errno));01152 & & & & exit(1);01153 & & }01154 & & if (fclose(prmfile))01155 & & {01156 & & & & write_stderr(_("%s: could not write promote signal file \"%s\": %s\n"),01157 & & & & & & & & & & &progname, promote_file, strerror(errno));01158 & & & & exit(1);01159 & & }01160&01161 & & sig = SIGUSR1;01162 & & if (kill((pid_t) pid, sig) != 0)01163 & & {01164 & & & & write_stderr(_("%s: could not send promote signal (PID: %ld): %s\n"),01165 & & & & & & & & & & &progname, pid, strerror(errno));01166 & & & & if (unlink(promote_file) != 0)01167 & & & & & & write_stderr(_("%s: could not remove promote signal file \"%s\": %s\n"),01168 & & & & & & & & & & & & &progname, promote_file, strerror(errno));01169 & & & & exit(1);01170 & & }01171&01172 & & print_msg(_("server promoting\n"));01173 }3. src/backend/postmaster/postmaster.c04617 /*04618 &* sigusr1_handler - handle signal conditions from child processes04619 &*/04620 static void04621 sigusr1_handler(SIGNAL_ARGS)04622 {04623 & & int & & & & save_errno =04624&04625 & & PG_SETMASK(&BlockSig);04626&04627 & & /*04628 & & &* RECOVERY_STARTED and BEGIN_HOT_STANDBY signals are ignored in04629 & & &* unexpected states. If the startup process quickly starts up, completes04630 & & &* recovery, exits, we might process the death of the startup process04631 & & &* first. We don't want to go back to recovery in that case.04632 & & &*/04633 & & if (CheckPostmasterSignal(PMSIGNAL_RECOVERY_STARTED) &&04634 & & & & pmState == PM_STARTUP && Shutdown == NoShutdown)04635 & & {04636 & & & & /* WAL redo has started. We're out of reinitialization. */04637 & & & & FatalError =04638&04639 & & & & /*04640 & & & & &* Crank up the background tasks. &It doesn't matter if this fails,04641 & & & & &* we'll just try again later.04642 & & & & &*/04643 & & & & Assert(CheckpointerPID == 0);04644 & & & & CheckpointerPID = StartCheckpointer();04645 & & & & Assert(BgWriterPID == 0);04646 & & & & BgWriterPID = StartBackgroundWriter();04647&04648 & & & & pmState = PM_RECOVERY;04649 & & }04650 & & if (CheckPostmasterSignal(PMSIGNAL_BEGIN_HOT_STANDBY) &&04651 & & & & pmState == PM_RECOVERY && Shutdown == NoShutdown)04652 & & {04653 & & & & /*04654 & & & & &* Likewise, start other special children as needed.04655 & & & & &*/04656 & & & & Assert(PgStatPID == 0);04657 & & & & PgStatPID = pgstat_start();04658&04659 & & & & ereport(LOG,04660 & & & & (errmsg("database system is ready to accept read only connections")));04661&04662 & & & & pmState = PM_HOT_STANDBY;04663&04664 & & & & /* Some workers may be scheduled to start now */04665 & & & & StartOneBackgroundWorker();04666 & & }04667&04668 & & if (CheckPostmasterSignal(PMSIGNAL_WAKEN_ARCHIVER) &&04669 & & & & PgArchPID != 0)04670 & & {04671 & & & & /*04672 & & & & &* Send SIGUSR1 to archiver process, to wake it up and begin archiving04673 & & & & &* next transaction log file.04674 & & & & &*/04675 & & & & signal_child(PgArchPID, SIGUSR1);04676 & & }04677&04678 & & if (CheckPostmasterSignal(PMSIGNAL_ROTATE_LOGFILE) &&04679 & & & & SysLoggerPID != 0)04680 & & {04681 & & & & /* Tell syslogger to rotate logfile */04682 & & & & signal_child(SysLoggerPID, SIGUSR1);04683 & & }04684&04685 & & if (CheckPostmasterSignal(PMSIGNAL_START_AUTOVAC_LAUNCHER) &&04686 & & & & Shutdown == NoShutdown)04687 & & {04688 & & & & /*04689 & & & & &* Start one iteration of the autovacuum daemon, even if autovacuuming04690 & & & & &* is nominally not enabled. &This is so we can have an active defense04691 & & & & &* against transaction ID wraparound. &We set a flag for the main loop04692 & & & & &* to do it rather than trying to do it here --- this is because the04693 & & & & &* autovac process itself may send the signal, and we want to handle04694 & & & & &* that by launching another iteration as soon as the current one04695 & & & & &* completes.04696 & & & & &*/04697 & & & & start_autovac_launcher =04698 & & }04699&04700 & & if (CheckPostmasterSignal(PMSIGNAL_START_AUTOVAC_WORKER) &&04701 & & & & Shutdown == NoShutdown)04702 & & {04703 & & & & /* The autovacuum launcher wants us to start a worker process. */04704 & & & & StartAutovacuumWorker();04705 & & }04706&04707 & & if (CheckPostmasterSignal(PMSIGNAL_START_WALRECEIVER) &&04708 & & & & WalReceiverPID == 0 &&04709 & & & & (pmState == PM_STARTUP || pmState == PM_RECOVERY ||04710 & & & & &pmState == PM_HOT_STANDBY || pmState == PM_WAIT_READONLY) &&04711 & & & & Shutdown == NoShutdown)04712 & & {04713 & & & & /* Startup Process wants us to start the walreceiver process. */04714 & & & & WalReceiverPID = StartWalReceiver();04715 & & }04716&04717 & & if (CheckPostmasterSignal(PMSIGNAL_ADVANCE_STATE_MACHINE) &&04718 & & & & (pmState == PM_WAIT_BACKUP || pmState == PM_WAIT_BACKENDS))04719 & & {04720 & & & & /* Advance postmaster's state machine */04721 & & & & PostmasterStateMachine();04722 & & }04723&04724 & & if (CheckPromoteSignal() && StartupPID != 0 &&04725 & & & & (pmState == PM_STARTUP || pmState == PM_RECOVERY ||04726 & & & & &pmState == PM_HOT_STANDBY || pmState == PM_WAIT_READONLY))04727 & & {04728 & & & & /* Tell startup process to finish recovery */04729 & & & & signal_child(StartupPID, SIGUSR2);04730 & & }04731&04732 & & PG_SETMASK(&UnBlockSig);04733&04734 & & errno = save_04735 }4. src/backend/access/transam/xlog.c09568 /*09569 &* Check to see if a promote request has arrived. Should be09570 &* called by postmaster after receiving SIGUSR1.09571 &*/09572 bool09573 CheckPromoteSignal(void)09574 {09575 & & struct stat stat_09576&09577 & & if (stat(PROMOTE_SIGNAL_FILE, &stat_buf) == 0 ||09578 & & & & stat(FAST_PROMOTE_SIGNAL_FILE, &stat_buf) == 0)09579 & & & &09580&09581 & &09582 }5. src/backend/postmaster/startup.c00106 /* SIGUSR2: set flag to finish recovery */ 00107 static void 00108 StartupProcTriggerHandler(SIGNAL_ARGS) 00109 { 00110
save_errno = 0
promote_triggered = 00113
WakeupRecovery(); 0
errno = save_ 00116 }6. src/backend/access/transam/xlog.c00438 & & /*00439 & & &* recoveryWakeupLatch is used to wake up the startup process to continue00440 & & &* WAL replay, if it is waiting for WAL to arrive or failover trigger file00441 & & &* to appear.00442 & & &*/00443 & & Latch & & & recoveryWakeupL09584 /*09585 &* Wake up startup process to replay newly arrived WAL, or to notice that09586 &* failover has been requested.09587 &*/09588 void09589 WakeupRecovery(void)09590 {09591 & & SetLatch(&XLogCtl-&recoveryWakeupLatch);09592 }7. src/include/storage/latch.h00090 /*00091 &* Latch structure should be treated as opaque and only accessed through00092 &* the public functions. It is defined here to allow embedding Latches as00093 &* part of bigger structs.00094 &*/00095 typedef struct00096 {00097 & & sig_atomic_t is_00098 & & bool & & & &is_00099 & & int & & & & owner_00100 #ifdef WIN3200101 & & HANDLE & & &00102 #endif00103 } L
阅读(12342)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
在LOFTER的更多文章
loftPermalink:'',
id:'fks_',
blogTitle:'PostgreSQL 9.3 add Fast promote mode skips checkpoint at end of recovery',
blogAbstract:'PostgreSQL 将新增promote的选项, -m smart | fast1. smart 模式下promote standby数据库时, 在结束恢复后, 必须执行完一个checkpoint才激活.2. fast 模式下promote standby数据库时, 在结束恢复后, 不需要等待checkpoin结束, 而是往XLOG中写入XLOG_END_OF_RECOVERY标记, 然后激活.原文如下 :&pg_ctl promote -m fast will skip the checkpoint at end of recovery so that we',
blogTag:'',
blogUrl:'blog/static/',
isPublished:1,
istop:false,
modifyTime:7,
publishTime:1,
permalink:'blog/static/',
commentCount:0,
mainCommentCount:0,
recommendCount:0,
bsrk:-100,
publisherId:0,
recomBlogHome:false,
currentRecomBlog:false,
attachmentsFileIds:[],
groupInfo:{},
friendstatus:'none',
followstatus:'unFollow',
pubSucc:'',
visitorProvince:'',
visitorCity:'',
visitorNewUser:false,
postAddInfo:{},
mset:'000',
remindgoodnightblog:false,
isBlackVisitor:false,
isShowYodaoAd:false,
hostIntro:'Free PostgreSQL Support.',
hmcon:'1',
selfRecomBlogCount:'0',
lofter_single:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}T-smart天迈G18手机如何破解root权限??_百度知道
T-smart天迈G18手机如何破解root权限??
提问者采纳
也有这手机,只有重新刷机获取,要不只有刷机。目前那些获取root权限的软件还没收录这个手机型号,除非这手机变得非常火,只有等等看
提问者评价
原来是这样,感谢!
其他类似问题
手机会重启,大多数的刷机大师,如果不行,和临时root,基本上都可以、刷机精灵等都可以,然后连接手机,然后在手机中寻找有没有一个叫superuser或者是 “授权管理”的东西。我使用的是蘑菇云这个软件,你只需要在电脑上下载一个安装1,里面基本上都有root.,那就试一试其他的刷机软件,里面有永久root,呵呵,你就点击永久root。,这时会显示root成功。,如果有,那就说明root成功,我就是用这个root了华录s3000(你可能没听过)还有联想a336t等手机,我只能说这么多了,祝你成功可以说
基本都试过,无用!
一键root,例如z4,kingroot
root权限的相关知识
您可能关注的推广回答者:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁

我要回帖

更多关于 easyrecovery 的文章

 

随机推荐