Code Monkey home page Code Monkey logo

drift's Issues

Test failure which blocks Netty version upgrade

One interesting observation that I have is our drift code is incompatible with the latest netty version. com.facebook.drift.transport.netty.server.TestDriftNettyServerTransport#testOutOfOrderNotSupported()
starts breaking from netty version 4.1.38.Final .

I think the reason for that is the way our com.facebook.drift.transport.netty.server.ResponseOrderingHandler is coded up.
We set autoread to false when out of order is not supported.
However netty doesn't exclusively rely on autoread flag. This netty change I believe introduced the changes that end up failing our tests. https://github.com/netty/netty/pull/9252/files
This issue is reproducible on master branch.

Could ThriftField support lombok ?

Now, I must annotate ThriftField on a public field or a getter method, like below:

@Data
@ThriftStruct
public class TestRes {
    @ThriftConstructor
    public TestRes(ResultCode code, BaseResp baseResp) {
        this.code = code;
        this.baseResp = baseResp;
    }

    @ThriftField(1)
    public ResultCode code;

    @ThriftField(255)
    public BaseResp baseResp;
}

But when I change public to private, for example:

@Data
@ThriftStruct
public class TestRes {
    @ThriftConstructor
    public TestRes(ResultCode code, BaseResp baseResp) {
        this.code = code;
        this.baseResp = baseResp;
    }

    @ThriftField(1)
    private ResultCode code;

    @ThriftField(255)
    private BaseResp baseResp;
}

exception will happen.

Caused by: com.facebook.drift.codec.metadata.MetadataErrorException: Error: Metadata extraction encountered 2 errors and 0 warnings
	at com.facebook.drift.codec.metadata.MetadataErrors.throwIfHasErrors(MetadataErrors.java:78)
	at com.facebook.drift.codec.metadata.ThriftStructMetadataBuilder.build(ThriftStructMetadataBuilder.java:115)
	at com.facebook.drift.codec.metadata.ThriftCatalog.extractThriftStructMetadata(ThriftCatalog.java:698)
	at com.facebook.drift.codec.metadata.ThriftCatalog.getThriftStructMetadata(ThriftCatalog.java:565)
	at com.facebook.drift.codec.metadata.ThriftCatalog.buildThriftTypeInternal(ThriftCatalog.java:325)
	at com.facebook.drift.codec.metadata.ThriftCatalog.buildThriftType(ThriftCatalog.java:239)
	at com.facebook.drift.codec.metadata.ThriftCatalog.getThriftType(ThriftCatalog.java:227)
	at com.facebook.drift.codec.metadata.ThriftMethodMetadata.<init>(ThriftMethodMetadata.java:87)
	at com.facebook.drift.codec.metadata.ThriftServiceMetadata.<init>(ThriftServiceMetadata.java:69)
	at com.facebook.drift.server.DriftServerMethodInvoker.<init>(DriftServerMethodInvoker.java:55)
	at com.facebook.drift.server.DriftServer.<init>(DriftServer.java:48)
	at com.bytedance.thrift.server.ThriftServer.buildNettyServer(ThriftServer.java:319)
	at com.bytedance.thrift.server.ThriftServer.setup(ThriftServer.java:222)
	at com.bytedance.thrift.server.ThriftServerRunner.onApplicationEvent(ThriftServerRunner.java:204)
	... 12 common frames omitted
	Suppressed: com.facebook.drift.codec.metadata.MetadataErrorException: Error: @ThriftField field 'private com.bytedance.thrift.test.ResultCode com.bytedance.thrift.test.TestRes.code' is not public
		at com.facebook.drift.codec.metadata.MetadataErrors.addError(MetadataErrors.java:96)
		at com.facebook.drift.codec.metadata.AbstractThriftMetadataBuilder.addFields(AbstractThriftMetadataBuilder.java:312)
		at com.facebook.drift.codec.metadata.AbstractThriftMetadataBuilder.extractFromFields(AbstractThriftMetadataBuilder.java:292)
		at com.facebook.drift.codec.metadata.AbstractThriftMetadataBuilder.<init>(AbstractThriftMetadataBuilder.java:95)
		at com.facebook.drift.codec.metadata.ThriftStructMetadataBuilder.<init>(ThriftStructMetadataBuilder.java:42)
		at com.facebook.drift.codec.metadata.ThriftCatalog.extractThriftStructMetadata(ThriftCatalog.java:697)
		... 23 common frames omitted
	Suppressed: com.facebook.drift.codec.metadata.MetadataErrorException: Error: Thrift class 'TestRes' fields [code] do not have an id
		at com.facebook.drift.codec.metadata.MetadataErrors.addError(MetadataErrors.java:96)
		at com.facebook.drift.codec.metadata.AbstractThriftMetadataBuilder.normalizeThriftFields(AbstractThriftMetadataBuilder.java:488)
		at com.facebook.drift.codec.metadata.ThriftStructMetadataBuilder.<init>(ThriftStructMetadataBuilder.java:48)
		at com.facebook.drift.codec.metadata.ThriftCatalog.extractThriftStructMetadata(ThriftCatalog.java:697)
		... 23 common frames omitted

Then I must change code like this:

@Data
@ThriftStruct
public class TestRes {
    @ThriftConstructor
    public TestRes(ResultCode code, BaseResp baseResp) {
        this.code = code;
        this.baseResp = baseResp;
    }

    @Getter(onMethod_ = @ThriftField(1))
    private ResultCode code;

    @Getter(onMethod_ = @ThriftField(255))
    public BaseResp baseResp;
}

So, I wonder that:

  • Will we support add annotation ThriftField on a private field?
  • Could we support lombok?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.