-
Notifications
You must be signed in to change notification settings - Fork 3.9k
ADD UDS support #1132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ADD UDS support #1132
Conversation
|
@sunheehnus tests fail for JDK 1.6. Seems like the junixsocket dependency added is compiled only for 1.7 and above. Can we see if 1.6 can be supported also?. There are still many Jedis clients that use this JDK version. |
pom.xml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep old file format. Re-formatting has been applied
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, will do, but there is a mix of tabs and spaces in old file.
|
@sunheehnus thanks for this awesome contribution. We've been willing to add UDS to Jedis for a long time and we haven't find a proper approach to do it. I like your PR as it keeps everything clean and simple. There are some comments which I would like to review before merging. |
|
Thanks for your quick reply @marcosnils.
diff --git a/pom.xml b/pom.xml
index 5808306..fd95e78 100644
--- a/pom.xml
+++ b/pom.xml
@@ -68,9 +68,9 @@
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>com.kohlschutter.junixsocket</groupId>
- <artifactId>junixsocket-common</artifactId>
- <version>2.0.4</version>
+ <groupId>org.newsclub.net</groupId>
+ <artifactId>junixsocket</artifactId>
+ <version>1.3</version>
</dependency>
<dependency>
<groupId>com.kohlschutter.junixsocket</groupId>
@@ -85,6 +85,13 @@
</dependency>
</dependencies>
+ <repositories>
+ <repository>
+ <id>vt-middleware</id>
+ <name>VT Middleware GitHub Repository</name>
+ <url>https://raw.github.com/vt-middleware/maven-repo/master</url>
+ </repository>
+ </repositories>
<distributionManagement>
<repository>
<id>github</id> |
|
All comments I want to say were addressed by @marcosnils. |
|
Hi @HeartSaVioR , I just test it on a Windows machine, using the service of RedisLabs'. I add the following to the pom.xml <plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass></mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin> It can generate the jedis-jar-with-dependencies.jar. |
|
If we decide that Jedis should provide assembled jar (fat/uber jar), we can consider about shading dependencies. |
|
ping guys. Really important PR |
|
@sunheehnus ping? |
|
Hi @marcosnils , I will do some clean as you suggested and squash the commits to one ASAP, just sent an email to the creator of junixsocket to ask for some hints about the JDK 1.6 :-) |
|
Hi @marcosnils , there is a trade off to solve the JDK 1.6 issue:
This could be the most clean way to using junixsocket IMHO. |
|
@sunheehnus we're planning to drop support for Java 1.6 and older from jedis 3.0 onwards. I'll remove older JVM support in CI master branch so you can run tests accordingly. There are still pending comments to resolve in this PR, can you please rebase and check the pending items? Thanks!. |
|
Hello @marcosnils , that's great, the new commit will be pushed today. :-) |
UDS addrss should be given as an absolute path
|
Hello @marcosnils , I have already fixed the issues you suggested, and squashed the commits to a single one. There are some more informations I want to share:
Thanks very much. :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we might be hitting some performance issue when running this condition every time Jedis tries to establish a connection and needs to parse the supplied host.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about just check if it is an ABS path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's easy to avoid the recheck each time. Keep a static ConcurrentHashMap of the string and whether it is 'ok'. On the first reference do the lookup, store the results, and keep going. On subsequent lookups, read from the hash map. If it's there, you're done.
If you are betting that the status of each of these hosts will change over time, start up a Timer which clears the map every so often, as determined by your level of paranoia. So every so often a new check will be done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about just check if it is an ABS path?
Maybe it could also be a relative path to the CWD?It's easy to avoid the recheck each time. Keep a static ConcurrentHashMap of the string and whether it is 'ok'. On the first reference do the lookup, store the results, and keep going. On subsequent lookups, read from the hash map. If it's there, you're done.
If you are betting that the status of each of these hosts will change over time, start up a Timer which clears the map every so often, as determined by your level of paranoia. So every so often a new check will be done.
Seems a bit unnecessary as connect shouldn't happen that often in the code. I was looking for an alternative to check the supplied path. I don't care if the file exists because the UDS library already checks this and throws a proper exception (just realized that we're not testing this).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @marcosnils , if we use a relative path, the current approach this patch implement may have a potential bug that if the path is already included in /etc/hosts, then we may open a TCP connection instead, maybe we should change the API or just keep it simple using the abs path?
|
ping |
|
Ping, would quite like to use this. @sunheehnus I am happy to revive this in another pull request if you don't have time? |
…main Socket) or any other custom address resolution - Related pull requests: redis#2036 and redis#1942 and redis#1132
|
Resolved by #2151 |
No description provided.