博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
对Slony-I中wait on的理解
阅读量:5354 次
发布时间:2019-06-15

本文共 1881 字,大约阅读时间需要 6 分钟。

4.1.2. Event ConfirmationsWhen an event is processed by the slon process for a remote node, a CONFIRM message is generated byinserting a tuple into the sl_confirm table.This tuple indicates that a particular event has been confirmed by a particular receiver node.Confirmation messages are then transferred back to all other nodes in the cluster.

For instance, many people have run afoul of problems with SLONIK SUBSCRIBE SET, when subscribing a newset.Be aware (and beware!) that a SLONIK SUBSCRIBE SET request will return the event confirmation almostimmediately, even though there might be several hours of work to do before the subscription is ready.The trouble with SLONIK SUBSCRIBE SET is that it is processed as two events, one on the origin node,with a second event, to enable the subscription, on the subscriber. In order to more reliably monitor from within a slonik script that SLONIK SUBSCRIBE SET is complete,you may submit a SLONIK SYNC event after the subscription, and have the WAIT request wait on the SYNCevent...SYNC...Generates a SYNC event on a specified node.ID = ivalThe node on which to generate the SYNC event.Example      SYNC (ID = 1);      WAIT FOR EVENT (ORIGIN = 1, CONFIRMED = 2, WAIT ON=1); ... Slonik does not wait for event confirmations before performing this command.

根据以上的说明,

为了保证复数个Slonik命令的执行顺序关系,

通过SYNC和 WAIT FOR EVENT 命令来控制 
SUBSCRIBE SET 命令执行一直到完毕,才开始其它命令的执行。

 

我个人的理解是,SUBSCRIBE SET 命令实际执行完毕的时候,

无论Provider也好,还是Receiver也罢,其所拥有的sl_confirm表的内容,
都可以起到表示 SUBSCRIBE SET 命令实际执行完毕的作用。

所以只要 sync 与 wait for event 的 wait on 中的 id 相同,都是可以的。

SUBSCRIBE SET (ID = 999, PROVIDER = 1, RECEIVER = 2);
SYNC (ID = 1)
WAIT FOR EVENT (ORIGIN = 1, CONFIRMED = ALL, WAIT ON=1);

 

SUBSCRIBE SET (ID = 999, PROVIDER = 1, RECEIVER = 2);
SYNC (ID = 2)
WAIT FOR EVENT (ORIGIN = 1, CONFIRMED = ALL, WAIT ON=2);

都是一样的效果

转载于:https://www.cnblogs.com/gaojian/p/3227210.html

你可能感兴趣的文章
常见错误总结
查看>>
BZOJ3545&3551[ONTAK2010]Peaks——kruskal重构树+主席树+dfs序+树上倍增
查看>>
Django框架(十九)--Django rest_framework-认证组件
查看>>
我的MFC/C++学习笔记 http://blog.bccn.net/CrystalFan/6909
查看>>
Beta 冲刺(3/7)
查看>>
控制反转(IOC)和依赖注入(DI)
查看>>
php的<?php ?>标签匹配
查看>>
百马百石
查看>>
计算几何讲义——计算几何中的欧拉定理
查看>>
第7本《万万没想到-用理工科思维理解世界1》含书评
查看>>
深入nginx之《获取用户的真实IP》
查看>>
selenium断言
查看>>
python day03
查看>>
cocos2d HelloWorld 项目横竖屏、自动旋转问题
查看>>
1013. Battle Over Cities (25)
查看>>
poj 3280 Cheapest Palindrome
查看>>
maven 安装alipay-sdk包到本地及远程仓库
查看>>
牛客网在线判题系统JavaScript(V8)使用
查看>>
PL/SQL Developer StringBuffer 专用复制
查看>>
系统吞吐量
查看>>