Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
pulsar
提交
536d353e
pulsar
项目概览
apache
/
pulsar
通知
129
Star
40
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Wiki
1
Wiki
分析
仓库
DevOps
项目成员
Pages
pulsar
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
Wiki
1
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
体验新版 GitCode,发现更多精彩内容 >>
提交
536d353e
编写于
11月 16, 2016
作者:
R
Rajan
提交者:
Matteo Merli
11月 16, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix: Discovery-lookup returns correct PartitionMetadataResponse on partition-lookup (#112)
上级
f9993942
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
1 deletion
+30
-1
pulsar-common/src/main/java/com/yahoo/pulsar/common/api/Commands.java
...n/src/main/java/com/yahoo/pulsar/common/api/Commands.java
+18
-0
pulsar-discovery-service/src/main/java/com/yahoo/pulsar/discovery/service/ServerConnection.java
.../com/yahoo/pulsar/discovery/service/ServerConnection.java
+12
-1
未找到文件。
pulsar-common/src/main/java/com/yahoo/pulsar/common/api/Commands.java
浏览文件 @
536d353e
...
...
@@ -377,10 +377,28 @@ public class Commands {
return
res
;
}
public
static
ByteBuf
newPartitionMetadataResponse
(
String
brokerServiceUrl
,
String
brokerServiceUrlTls
,
long
requestId
)
{
CommandPartitionedTopicMetadataResponse
.
Builder
partitionMetadataResponseBuilder
=
CommandPartitionedTopicMetadataResponse
.
newBuilder
();
partitionMetadataResponseBuilder
.
setBrokerServiceUrl
(
brokerServiceUrl
);
partitionMetadataResponseBuilder
.
setBrokerServiceUrlTls
(
brokerServiceUrlTls
);
partitionMetadataResponseBuilder
.
setResponse
(
CommandPartitionedTopicMetadataResponse
.
LookupType
.
Redirect
);
partitionMetadataResponseBuilder
.
setRequestId
(
requestId
);
CommandPartitionedTopicMetadataResponse
partitionMetadataResponse
=
partitionMetadataResponseBuilder
.
build
();
ByteBuf
res
=
serializeWithSize
(
BaseCommand
.
newBuilder
().
setType
(
Type
.
PARTITIONED_METADATA_RESPONSE
)
.
setPartitionMetadataResponse
(
partitionMetadataResponse
));
partitionMetadataResponseBuilder
.
recycle
();
partitionMetadataResponse
.
recycle
();
return
res
;
}
public
static
ByteBuf
newPartitionMetadataResponse
(
int
partitions
,
long
requestId
)
{
CommandPartitionedTopicMetadataResponse
.
Builder
partitionMetadataResponseBuilder
=
CommandPartitionedTopicMetadataResponse
.
newBuilder
();
partitionMetadataResponseBuilder
.
setPartitions
(
partitions
);
partitionMetadataResponseBuilder
.
setResponse
(
CommandPartitionedTopicMetadataResponse
.
LookupType
.
Success
);
partitionMetadataResponseBuilder
.
setRequestId
(
requestId
);
CommandPartitionedTopicMetadataResponse
partitionMetadataResponse
=
partitionMetadataResponseBuilder
.
build
();
...
...
pulsar-discovery-service/src/main/java/com/yahoo/pulsar/discovery/service/ServerConnection.java
浏览文件 @
536d353e
...
...
@@ -70,7 +70,7 @@ public class ServerConnection extends PulsarHandler {
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"Received PartitionMetadataLookup from {}"
,
remoteAddress
);
}
send
Lookup
Response
(
partitionMetadata
.
getRequestId
());
send
PartitionMetadata
Response
(
partitionMetadata
.
getRequestId
());
}
/**
...
...
@@ -97,6 +97,17 @@ public class ServerConnection extends PulsarHandler {
}
}
private
void
sendPartitionMetadataResponse
(
long
requestId
)
{
try
{
LoadReport
availableBroker
=
discoveryProvider
.
nextBroker
();
ctx
.
writeAndFlush
(
Commands
.
newPartitionMetadataResponse
(
availableBroker
.
getPulsarServiceUrl
(),
availableBroker
.
getPulsarServieUrlTls
(),
requestId
));
}
catch
(
PulsarServerException
e
)
{
LOG
.
warn
(
"[{}] Failed to get next active broker {}"
,
remoteAddress
,
e
.
getMessage
(),
e
);
ctx
.
writeAndFlush
(
Commands
.
newPartitionMetadataResponse
(
ServerError
.
ServiceNotReady
,
e
.
getMessage
(),
requestId
));
}
}
@Override
protected
boolean
isHandshakeCompleted
()
{
return
state
==
State
.
Connected
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录