Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

一般错误级别:指定点对点直连地址的消费者,配置无法继承提供者 #2828

Closed
gMan1990 opened this issue Nov 25, 2018 · 4 comments

Comments

@gMan1990
Copy link

gMan1990 commented Nov 25, 2018

https://github.com/apache/incubator-dubbo/blob/46b3458564cd0387d50f26f566556917cb74b999/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java#L329

if (url != null && url.length() > 0) { // user specified URL, could be peer-to-peer address, or register center's address.
    String[] us = Constants.SEMICOLON_SPLIT_PATTERN.split(url);
    if (us != null && us.length > 0) {
        for (String u : us) {
            URL url = URL.valueOf(u);
            if (url.getPath() == null || url.getPath().length() == 0) {
                url = url.setPath(interfaceName);
            }
            if (Constants.REGISTRY_PROTOCOL.equals(url.getProtocol())) {
                urls.add(url.addParameterAndEncoded(Constants.REFER_KEY, StringUtils.toQueryString(map)));
            } else {
                urls.add(ClusterUtils.mergeUrl(url, map));
            }
        }
    }
} else { // assemble URL from register center's configuration

比如提供者配置了serialization=kryo,然后消费者使用直连:
@Reference(url = "dubbo://127.0.0.1:20880")
根据这段代码,消费者还是使用serialization默认的hessian2
如果是不配置走到assemble URL from register center's configuration里就能继承提供者的配置

update: 可以添加自定义参数解决

    <dubbo:consumer>
        <dubbo:parameter key="serialization" value="kryo" />
    </dubbo:consumer>

  1. 另一个问题: 这里日志感觉打印重复了。
    https://github.com/apache/incubator-dubbo/blob/88037747a3b69d3225c73f6fbcda36ebd8435887/dubbo-plugin/dubbo-qos/src/main/java/com/alibaba/dubbo/qos/server/Server.java#L102
    https://github.com/apache/incubator-dubbo/blob/88037747a3b69d3225c73f6fbcda36ebd8435887/dubbo-plugin/dubbo-qos/src/main/java/com/alibaba/dubbo/qos/protocol/QosProtocolWrapper.java#L101
  2. 另一个问题: 我看dubbo-2.6.4.jar 的/META-INF/dubbo/internal里的文件内容都重复了3次
@carryxyh
Copy link
Member

日志的地方是有点重复了。你可以提交一个pr修复掉。
第一个问题和最后一个问题不明白,继承P端配置和ReferenceConfig有什么关系?
internal里的内容能提供一下么,我在2.6.x分支上是看不到重复的。

@gMan1990
Copy link
Author

gMan1990 commented Nov 27, 2018

@carryxyh
Q1: 比如一个提供者运行着(protocol=dubbo,配置是serialization=kryo)

  • 消费者配置直连(peer-to-peer address),此时消费者使用的serialization方式是hessian2
  • 消费者不配置(assemble URL from register center's configuration),此时消费者使用的serialization方式是kryo

好吧,可能这也不算什么错误,消费者自定serialization方式也合理。至少我发现了上面两种配置又一个不同点

Q3: 是打包之后的文件,你可以在你本地的maven仓库里解压开来看,或者去仓库下载。。就是本来是一份内容的都变成3份了,比如内容是1行aaa变成3行aaa

@carryxyh
Copy link
Member

q1你是想说配置直连和使用zk的方式,消费者使用的序列化方式不一样是么?这个你能提供一个demo么我看一下。

q3,这个我看到了,确实重复了三遍,这个可能有问题,老版本是不会出现的。我看一下。

@carryxyh
Copy link
Member

carryxyh commented Dec 3, 2018

对于Q1还有问题么?
如果有问题请提供一个demo。
关于Q3请跟踪这里:#2842

@carryxyh carryxyh closed this as completed Dec 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants