prestodb / drift Goto Github PK
View Code? Open in Web Editor NEWThis project forked from airlift/drift
An annotation-based Java library for creating Thrift serializable types and services.
License: Apache License 2.0
This project forked from airlift/drift
An annotation-based Java library for creating Thrift serializable types and services.
License: Apache License 2.0
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.
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:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.