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

Veena Basavaraj commented on SQOOP-1623:
----------------------------------------


Digging deeper here is the answer on how this all works.

sqoop-common package does a bit of magic generating the{code} 
VersionAnnotation{code} class as part of building the sqoop-common package. 
This annotation information is used in {code}Versionifo{code} class that gets 
the current build version of the sqoop-common.

The VersionInfoBean also uses the same technique underneath.


Next, if we see the client/shell that print outs the versions for client and 
then the server.
{code}

    // Print out client string if needed
    if (client) {
      printlnResource(Constants.RES_SHOW_PROMPT_VERSION_CLIENT_SERVER,
        Constants.OPT_CLIENT,
        // See SQOOP-1623 to understand how the client version is derived.
        VersionInfo.getBuildVersion(),
        VersionInfo.getSourceRevision(),
        VersionInfo.getUser(),
        VersionInfo.getBuildDate()
      );
    }

    // If only client version was required we do not need to continue
    if(!server && !restApi) {
      return;
    }

    if (versionRequest == null) {
      versionRequest = new VersionResourceRequest();
    }
    VersionBean versionBean = versionRequest.read(getServerUrl());

    if (server) {
      printlnResource(Constants.RES_SHOW_PROMPT_VERSION_CLIENT_SERVER,
        Constants.OPT_SERVER,
        versionBean.getBuildVersion(),
        versionBean.getSourceRevision(),
        versionBean.getSystemUser(),
        versionBean.getBuildDate()
      );
    }
{code}

The client version literally means the version of the sqoop common jar embedded 
in the client.
The server version is then got from the REST api. As a result it will use the 
sqoop common jar version that the server was built with


> Sqoop2: Derive the correct Client version for sqoop
> ---------------------------------------------------
>
>                 Key: SQOOP-1623
>                 URL: https://issues.apache.org/jira/browse/SQOOP-1623
>             Project: Sqoop
>          Issue Type: Bug
>            Reporter: Veena Basavaraj
>            Assignee: Veena Basavaraj
>             Fix For: 1.99.4
>
>
> Currently the sqoop client version is the same as the server version and it 
> is not correct.
> The client and server can be release independently and hence they can be 
> different.
> saveVersion.sh equivalent is required for the sqoop client as well
> Before
> {code}
> {
> revision: "52d5446af0cb63b739c9773efe1d2534ebe20100",
> protocols: [
> "1"
> ],
> date: "Fri Oct 24 08:09:24 PDT 2014",
> user: "vbasavaraj",
> url: "git://vbasavaraj.local/Users/vbasavaraj/Projects/sqoop2/common",
> version: "2.0.0-SNAPSHOT"
> }
> {code}
> FROM shell
> {code}
> sqoop:000> show version -all 
> client version:
>   Sqoop 2.0.0-SNAPSHOT revision 52d5446af0cb63b739c9773efe1d2534ebe20100 
>   Compiled by vbasavaraj on Fri Oct 24 08:09:24 PDT 2014
> server version:
>   Sqoop 2.0.0-SNAPSHOT revision 52d5446af0cb63b739c9773efe1d2534ebe20100 
>   Compiled by vbasavaraj on Fri Oct 24 08:09:24 PDT 2014
> Protocol version:
>   [1]
> sqoop:000> 
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to