tikv / website

Website for tikv.org
19 stars 62 forks source link

TiKV in 5 minutes docs has wrong link for Java client jar #285

Closed karuppiah7890 closed 3 years ago

karuppiah7890 commented 3 years ago

Change Request

https://tikv.org/docs/5.1/concepts/tikv-in-5-minutes/ refers to https://download.pingcap.org/tikv-client-java-3.2.0-SNAPSHOT.jar for Java client jar but that link does not work

Describe the problem

Suggest an improvement/fix

I had to then use https://search.maven.org/remotecontent?filepath=org/tikv/tikv-client-java/3.1.2/tikv-client-java-3.1.2.jar to get v3.1.2 with this jar the code snippet also didn't work giving errors like this -

$ jshell --class-path tikv-client-java.jar:slf4j-api.jar --startup test_raw.java
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Error:
incompatible types: org.tikv.shade.com.google.protobuf.ByteString cannot be converted to java.util.Optional<org.tikv.shade.com.google.protobuf.ByteString>
Optional<ByteString> result = client.get(ByteString.copyFromUtf8("k1"));
                              ^---------------------------------------^
Error:
cannot find symbol
  symbol:   variable result
System.out.println(result.get().toStringUtf8());
                   ^----^
[key: "k1"
value: "Hello"
, key: "k3"
value: "World"
]
[key: "k1"
value: "Hello"
, key: "k2"
value: ","
, key: "k3"
value: "World"
, key: "k4"
value: "!"
, key: "k5"
value: "Raw KV"
]
|  Welcome to JShell -- Version 16.0.1
|  For an introduction type: /help intro

jshell> 

Note the error -

Error:
incompatible types: org.tikv.shade.com.google.protobuf.ByteString cannot be converted to java.util.Optional<org.tikv.shade.com.google.protobuf.ByteString>
Optional<ByteString> result = client.get(ByteString.copyFromUtf8("k1"));
                              ^---------------------------------------^
Error:
cannot find symbol
  symbol:   variable result
System.out.println(result.get().toStringUtf8());
                   ^----^

I had to then change the code, and not use Optional for result, something like this -

ByteString result = client.get(ByteString.copyFromUtf8("k1"));
System.out.println(result.toStringUtf8());

and then it worked with this output

$ jshell --class-path tikv-client-java.jar:slf4j-api.jar --startup test_raw.java
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Hello
[key: "k1"
value: "Hello"
, key: "k3"
value: "World"
]
[key: "k1"
value: "Hello"
, key: "k2"
value: ","
, key: "k3"
value: "World"
, key: "k4"
value: "!"
, key: "k5"
value: "Raw KV"
]
|  Welcome to JShell -- Version 16.0.1
|  For an introduction type: /help intro

jshell> 
marsishandsome commented 3 years ago

https://tikv.org/docs/5.1/concepts/tikv-in-5-minutes/ refers to https://download.pingcap.org/tikv-client-java-3.2.0-SNAPSHOT.jar for Java client jar but that link does not work

what do you mean by that link does not work?

karuppiah7890 commented 3 years ago

The JAR file link https://download.pingcap.org/tikv-client-java-3.2.0-SNAPSHOT.jar does not work, I'm not able to download that JAR file

karuppiah7890 commented 3 years ago
$ curl -f -o tikv-client-java.jar https://download.pingcap.org/tikv-client-java-3.2.0-SNAPSHOT.jar
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
curl: (22) The requested URL returned error: 403 
marsishandsome commented 3 years ago

you can use this link https://github.com/tikv/client-java/releases/download/v3.2.0-rc/tikv-client-java-3.2.0-SNAPSHOT.jar