[ 
https://issues.apache.org/jira/browse/THRIFT-4685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17249030#comment-17249030
 ] 

Fedor Korotkiy commented on THRIFT-4685:
----------------------------------------

> For example, in parquet-go, an exported API, 
> [page.ReadPageRawData|https://github.com/xitongsys/parquet-go/blob/cb8d8853825eb1adfd98e356d8a0785985daac83/layout/page.go#L390],
>  takes *thrift.TBufferedTransport as the type of one of its args. In that API 
> the package "thrift" must be thrift in the version parquet-go uses, not the 
> version your code uses. So when your code needs to call that API, you need to 
> convert whatever thrift-v2.TBufferedTransport into thrift.TBufferedTransport 
> to be able to call that function.

 

You are correct here. When thrift types are exposed in public api, user of 
library must use the same thrift version, as is used by the library. That case 
can't be solved by import path versioning. But import path versioning solves 
conflicts, when thrift typed from different version don't interact. (1) when 
thrift is used internally and is not exposed in public api (like jaeger 
client). (2) when multiple microservices live in a single monorepo and use 
single go.mod file.

 

> Thrift is an open source project maintained by volunteers (while protobuf is 
> backed by Google), and we really don't have the resource to do that.

 

Protobuf provides full two way compatibility. As you correctly pointed out, 
that requires a lot of work from protobuf maintainers. But there is another way 
of doing this. It does not require much work from maintainer, but requires more 
work from users.

 

Here is an example:

 - [https://github.com/slon/thrift-versioning] - thrift repository

 - [https://github.com/slon/thrift-test] - example client that imports both 
versions.

 - 
[https://github.com/slon/thrift-versioning/commit/e0f8636552d108b17a63109913454a6a87d69d50]
 - commit making incompatible change. It moves all files to /v2 and creates new 
go.mod.

 - [https://github.com/slon/thrift-test/blob/master/go.mod] - client depends on 
old commit for old version of the library and new commit for new version of the 
library.

 

While experimenting with this approach, I ended up polluting gosum database, so 
if you wish to try this locally, use GOPROXY=direct GOSUMDB=off environment 
variables. Also, go.mod file in repository root seems to be required, I'm not 
sure why.

 

In a nut shell, my proposal is: (1) Create go.mod in repository root. (2) 
Whenever incompatible change is made, move all files to /vN, create new go.mod, 
and update compiler accordingly.

> Support the new golang modules (1.11 or later)
> ----------------------------------------------
>
>                 Key: THRIFT-4685
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4685
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Go - Library
>    Affects Versions: 0.12.0
>         Environment: golang 1.11 or later
>            Reporter: James E. King III
>            Assignee: Duru Can Celasun
>            Priority: Minor
>
> Go added new module support in 1.11, see:
> https://github.com/golang/go/wiki/Modules
> We should move towards it.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to