客户的问题是:

向Slony-I运行环境中,增加新的slaveDB节点的时候发生错误。

log中反复出现错误,然后再重新开始(重新开始部分的log省略):

CONFIG remoteWorkerThread_1: connected to provider DB
CONFIG remoteWorkerThread_1: prepare to copy table "tst"."a_tbl"
CONFIG remoteWorkerThread_1: prepare to copy table "tst"."b_tbl"
CONFIG remoteWorkerThread_1: prepare to copy table "tst"."c_tbl"
CONFIG remoteWorkerThread_1: all tables for set found on subscriber
CONFIG remoteWorkerThread_1: copy sequence "tst"."a_no_seq"
CONFIG remoteWorkerThread_1: copy sequence "tst"."b_no_seq"
CONFIG remoteWorkerThread_1: copy sequence "tst"."c_no_seq" CONFIG remoteWorkerThread_1: copy table "tst"."a_tbl"
CONFIG remoteWorkerThread_1: Begin COPY of table "tst"."a_tbl"
NOTICE: truncate of "tst"."a_tbl" succeeded
CONFIG remoteWorkerThread_1: bytes copied for table "tst"."a_tbl"
CONFIG remoteWorkerThread_1: 27.97 seconds to copy table "tst"."a_tbl" CONFIG remoteWorkerThread_1: copy table "tst"."b_tbl"
CONFIG remoteWorkerThread_1: Begin COPY of table "tst"."b_tbl"
ERROR remoteWorkerThread_1: "select "_mycluster".copyFields(2);" WARN remoteWorkerThread_1: data copy for set failed times - sleep seconds
NOTICE: Slony-I: Logswitch to sl_log_2 initiated
CONTEXT: SQL statement "SELECT "_mycluster".logswitch_start()"

经过查阅资料,并且和客户沟通,发现是他们的网络环境有问题:原有节点所在网段和新增节点不在一个网段。而他们又使用了网络工具来监控网络,在某些特定情况下,网络工具会切点网络连接。

正式此原因,导致出错。然后我进行了代码分析,发现remoteworker是很勤劳的,如果发生了通讯错误,它会反复重试的:

remoteWorkerThread_main函数的while循环,就会完成这个工作。

/* ----------
* slon_remoteWorkerThread
*
* Listen for events on the local database connection. This means, events
* generated by the local node only.
* ----------
*/
void *
remoteWorkerThread_main(void *cdata)
{

/*
* Work until shutdown or node destruction
*/
while (true)
{

/*
* Event type specific processing
*/
if (strcmp(event->ev_type, "SYNC") == )
{

}
else /* not SYNC */
{

/*
* Simple configuration events. Call the corresponding runtime
* config function, add the query to call the configuration event
* specific stored procedure.
*/
if (strcmp(event->ev_type, "STORE_NODE") == )
{

}

else if (strcmp(event->ev_type, "ENABLE_SUBSCRIPTION") == )
{

int copy_set_retries = ;
… if (sub_receiver == rtcfg_nodeid &&
event->ev_origin == node->no_id)
{
ScheduleStatus sched_rc;
int sleeptime = ;

while (true)
{

/*
* If the copy succeeds, exit the loop and let the
* transaction commit.
*/

if (copy_set(node, local_conn, sub_set, event) == )
{

copy_set_retries = ;
break;
}
copy_set_retries++; /*
* Data copy for new enabled set has failed. Rollback
* the transaction, sleep and try again.
*/
slon_log(SLON_WARN, "remoteWorkerThread_%d: "
"data copy for set %d failed %d times - "
"sleep %d seconds\n",
node->
no_id, sub_set, copy_set_retries,
sleeptime);

}
}
else
{

}

}

else
{

} /*
* All simple configuration events fall through here. Commit the
* transaction.
*/

}

}

} /* ----------
* copy_set
* ----------
*/
static int
copy_set(SlonNode *node, SlonConn *local_conn, int set_id,
SlonWorkMsg_event *event)
{

/*
* Connect to the provider DB
*/

slon_log(SLON_CONFIG, "remoteWorkerThread_%d: "
"connected to provider DB\n",
node->no_id);

/*
* For each table in the set
*/
for (tupno1 = ; tupno1 < ntuples1; tupno1++)
{
char *tab_fqname = PQgetvalue(res1, tupno1, ); gettimeofday(&tv_start2, NULL);
slon_log(SLON_CONFIG, "remoteWorkerThread_%d: "
"prepare to copy table %s\n",
node->no_id, tab_fqname); (void) slon_mkquery(&query3, "select * from %s limit 0;",
tab_fqname);
res2 = PQexec(loc_dbconn, dstring_data(&query3));

}

slon_log(SLON_CONFIG, "remoteWorkerThread_%d: "
"all tables for set %d found on subscriber\n",
node->no_id, set_id);

for (tupno1 = ; tupno1 < ntuples1; tupno1++)
{

slon_log(SLON_CONFIG, "remoteWorkerThread_%d: "
"copy sequence %s\n",
node->no_id, seq_fqname);

}
… /*
* For each table in the set
*/
for (tupno1 = ; tupno1 < ntuples1; tupno1++)
{

slon_log(SLON_CONFIG, "remoteWorkerThread_%d: "
"copy table %s\n",
node->no_id, tab_fqname);

if (omit_copy) {

} else {
slon_log(SLON_CONFIG, "remoteWorkerThread_%d: "
"Begin COPY of table %s\n",
node->no_id, tab_fqname); (void) slon_mkquery(&query2, "select %s.copyFields(%d);",
rtcfg_namespace, tab_id); res3 = PQexec(pro_dbconn, dstring_data(&query2)); if (PQresultStatus(res3) != PGRES_TUPLES_OK)
{
slon_log(SLON_ERROR, "remoteWorkerThread_%d: \"%s\" %s\n",
node->no_id, dstring_data(&query2),
PQresultErrorMessage(res3));

return -;
} …
slon_log(SLON_CONFIG, "remoteWorkerThread_%d: "
INT64_FORMAT " bytes copied for table %s\n",
node->no_id, copysize, tab_fqname);

slon_log(SLON_CONFIG, "remoteWorkerThread_%d: "
"%.3f seconds to copy table %s\n",
node->no_id,
TIMEVAL_DIFF(&tv_start2, &tv_now), tab_fqname);
}

return ;
}

Slony-I的 RemoteWorker重试调查的更多相关文章

  1. ElasticSearch 的一次非正常master脱离的调查 (转 和我碰到的情况一模一样)

    转自 http://simonlei.iteye.com/blog/1669992 一共有4个节点的cluster,其中es4 是master,某个时间突然es1脱离了整个cluster,调查过程如下 ...

  2. 由VIP漂移引发的算法异常问题调查和解决

    最近工作中的一个问题,耗时一个月之久终于调查完毕且顺利解决,顿时感慨万千.耗时之久和预期解决时间和环境搭建以及日志不合理等等有关,当然这个并非此文的重点.之所以在很久以后的今天又开始写文,主要是这个问 ...

  3. easyui模板页面 不良调查

    <%@page import="com.xy.cc.util.CUtil" %><%@page import="com.xy.cc.bean.UserP ...

  4. 当master down掉后,pt-heartbeat不断重试会导致内存缓慢增长

    最近同事反映,在使用pt-heartbeat监控主从复制延迟的过程中,如果master down掉了,则pt-heartbeat则会连接失败,但会不断重试. 重试本无可厚非,毕竟从使用者的角度来说,希 ...

  5. O365(世纪互联)SharePoint 之调查列表简单介绍

    前言 SharePoint中为了提供了很多开箱即用的应用程序,比如调查列表就是其中之一,同样,在O365版本里(国际版和世纪互联版本均可),也有这样的调查列表可以供我们使用,而使用起来非常方便和快速, ...

  6. Office 365使用情况调查不完全分析报告

    感谢大家参与了9月13日在Office 365技术群(O萌)中发起的一个关于Office 365使用情况的调查,在一天左右的时间内,我们一共收到了67份反馈,其中绝大部分是在3分钟内提交的. 本次调查 ...

  7. 基于Lease分布式系统重试服务选举

    /** * Copyright (c) 2015, www.cubbery.com. All rights reserved. */ package com.cubbery.event.retry; ...

  8. 【Java EE 学习 73】【数据采集系统第五天】【参与调查】【导航处理】【答案回显】【保存答案】

    一.参与调查的流程 单击导航栏上的“参与调查”按钮->EntrySurveyAction做出相应,找到所有的Survey对象并转发到显示所有survey对象的页面上供用户选择->用户单击其 ...

  9. 【Java EE 学习 72 上】【数据采集系统第四天】【增加调查logo】【文件上传】【动态错误页指定】【上传限制】【国际化】

    增加logo的技术点:文件上传,国际化 文件上传的功能在struts2中是使用文件上传拦截器完成的. 1.首先需要在页面上添加一个文件上传的超链接. 点击该超链接能够跳转到文件上传页面.我给该表单页面 ...

随机推荐

  1. OpenCV 连接 Android IP摄像头

    0.下载IP摄像头(android软件)并安装 比如这个(图标是一个灰色的摄像头的那个软件) 1.新建cpp文件,编译 #include "opencv2/opencv.hpp" ...

  2. mysql 用户名密码登陆不上

    问题1:刚安装完mysql,设置了用户名密码root,登陆OK的,后来再连怎么也连不上了 操作步骤: 输入:mysql -uroot -proot 提示:ERROR 1045 (28000): Acc ...

  3. 让IE6IE7IE8支持CSS3属性的8种方法介绍

    我们都知道,IE浏览器暂不支持CSS3的一些属性.国外的工程师们,不安于此现状,他们总是尽量使用一些手段使IE浏览器也能支持CSS3属性,我觉得这些都是很有意义,很有价值的工作,可以推动整个技术领域的 ...

  4. webstorm无法格式化

    快捷键失效,一般都是由于快键键冲突引起的.但是像CTRL + ALT + L的组合件冲突,还是没见过. 后来在网上查知,网易云音乐,会引发此冲突,果然高手在网络啊. 打开设置,禁用网易云音乐快捷键,妥 ...

  5. PermGen space Eclipse 终极解决方案

    1.选中项目右键 run or debug configurations... 2.在 VM arguments 加入  -Xms128m -Xmx512m -XX:PermSize=64M -XX: ...

  6. WebGoat学习——SQL注入(SQL Injection)

    SQL注入(SQL Injection) 所谓SQL注入式攻击,就是攻击者把SQL命令插入到Web表单的输入域或页面请求的查询字符串,欺骗服务器执行恶意的SQL命令.攻击者通过web请求提交带有影响正 ...

  7. enum 使用

    1.说明 enum是一个基本的关键字,却一直没弄清楚怎么用,这次在实现二叉树框架时需要用到常量,特地搜了一下,终于知道怎么用了. 2.enum使用要点 enum声明是一个类型,不是变量. enum经常 ...

  8. 《LINUX程序设计 第四版》 阅读笔记:(一)

    1. 头文件 使用-I标志来包含头文件. gcc -I/usr/openwin/include fred.c 2. 库文件 通过给出 完整的库文件路径名 或 用-l标志 来告诉编译器要搜索的库文件. ...

  9. URAL-1997 Those are not the droids you're looking for 二分匹配

    题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1997 题意:记录了n个人进出门的时间点,每个人在房子里面待的时间要么小于等于a,要么大于 ...

  10. 转】从源代码剖析Mahout推荐引擎

    原博文出自于: http://blog.fens.me/mahout-recommend-engine/ 感谢! 从源代码剖析Mahout推荐引擎 Hadoop家族系列文章,主要介绍Hadoop家族产 ...