Hello, I just want to say thank you very much for your work, scylla is a really cool tool, but here I have a few questions, if you know the answer to them, please let me know.
Let me tell you right away that I work on Windows 11, but on our project we have docker, which runs the container with ScyllaDB
Driver version 3.11.5.0
- This WARN is not critical, but anyway, is there any way to solve this warning?
Found Netty's native epoll transport, but not running on linux-based operating system. Using NIO instead.
- When sending a request to the database, a list of WARNs (about 10 pieces) pops up and reports
Advanced shard awareness: requested connection to shard 1, but connected to 0. Is there a NAT between client and server?
, I tried for a long time, but it didn’t work I couldn’t solve this problem, I hope you can help me, the request is being executed, but seeing it constantly in the log is quite confusing - Well, probably the strangest thing is request hashing, I hash the request so that the database is not loaded with prepared requests, but the error that the request needs to be hashed also appears, I have rewritten the code, maybe this is a problem on my part, please let me know Please
Re-preparing already prepared query is generally an anti-pattern and will likely affect performance. Consider preparing the statement only once. Query='INSERT INTO message (id, author, context, content, timestamp) VALUES (?, ?, ?, ?, ?)'
public class Cache {
private PreparedStatement request;
public Cache() {
this.request = null;
}
public PreparedStatement request(@NotNull PreparedStatement statement) {
if (this.request == null || this.request.hashCode() != statement.hashCode()) {
System.out.println("1");
this.request = statement;
}
return this.request;
}
}
private BoundStatement cache(@NotNull Session session) {
return channel.getServer()
.getEventManager()
.getCache()
.request(session.prepare(INSERT))
.bind();
}
public MessageCreateAction applyData(JsonObject data) {
this.getProvider().insert("channel", session -> {
return cache(session)
.setLong("id", Snowflake.generate())
.setLong("author", data.getJsonNumber("author").longValue())
.setLong("context", data.getJsonNumber("context").longValue())
.setString("content", data.getString("content"))
.setLong("timestamp", data.getJsonNumber("timestamp").longValue());
});
return this;
}
public class ClusterConnectionFactoryProvider {
private final ClusterConnectionFactorySource source;
public ClusterConnectionFactoryProvider(Config config) {
this.source = new ClusterConnectionFactorySource(config);
}
public void insert(String database, @NotNull Function<Session, BoundStatement> function) {
Flux.just(this.source.getChannel().connect(database))
.doOnNext(session -> session.execute(function.apply(session)))
.subscribe(Session::close);
}
}
public class ClusterConnectionFactorySource {
private final Cluster channel;
public ClusterConnectionFactorySource(Config config) {
this.channel = init("127.0.0.1", 19042, "datacenter1");
}
private static Cluster init(String hostname, int port, String cluster) {
return Cluster.builder()
.addContactPoint(hostname)
.withLoadBalancingPolicy(getPolicy(cluster))
.withAuthProvider(new PlainTextAuthProvider("username", "password"))
.withPort(port)
.withAddressTranslator(new EC2MultiRegionAddressTranslator())
.build();
}
private static DCAwareRoundRobinPolicy getPolicy(String cluster) {
return DCAwareRoundRobinPolicy.builder()
.withLocalDc(cluster)
.build();
}
public Cluster getChannel() {
return channel;
}
}