Skip to content

Commit

Permalink
downgrade sofa-rpc to 5.12.
Browse files Browse the repository at this point in the history
  • Loading branch information
imbajin committed Oct 22, 2024
1 parent aae62e0 commit 66c47cb
Show file tree
Hide file tree
Showing 23 changed files with 85 additions and 97 deletions.
66 changes: 33 additions & 33 deletions hugegraph-commons/hugegraph-rpc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-rpc-all</artifactId>
<version>5.13.1</version>
<version>5.12.0</version>
<exclusions>
<exclusion>
<groupId>org.jboss.resteasy</groupId>
Expand Down Expand Up @@ -100,38 +100,38 @@
<groupId>io.grpc</groupId>
<artifactId>grpc-core</artifactId>
</exclusion>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-all</artifactId>
</exclusion>
<exclusion>
<artifactId>bolt</artifactId>
<groupId>com.alipay.sofa</groupId>
</exclusion>
<exclusion>
<artifactId>jackson-annotations</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
<exclusion>
<artifactId>jackson-core</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
<exclusion>
<artifactId>jackson-databind</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
<exclusion>
<artifactId>netty-all</artifactId>
<groupId>io.netty</groupId>
</exclusion>
<exclusion>
<artifactId>commons-lang3</artifactId>
<groupId>org.apache.commons</groupId>
</exclusion>
<exclusion>
<artifactId>protobuf-java</artifactId>
<groupId>com.google.protobuf</groupId>
</exclusion>
<!-- <exclusion>-->
<!-- <groupId>io.grpc</groupId>-->
<!-- <artifactId>grpc-all</artifactId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <artifactId>bolt</artifactId>-->
<!-- <groupId>com.alipay.sofa</groupId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <artifactId>jackson-annotations</artifactId>-->
<!-- <groupId>com.fasterxml.jackson.core</groupId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <artifactId>jackson-core</artifactId>-->
<!-- <groupId>com.fasterxml.jackson.core</groupId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <artifactId>jackson-databind</artifactId>-->
<!-- <groupId>com.fasterxml.jackson.core</groupId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <artifactId>netty-all</artifactId>-->
<!-- <groupId>io.netty</groupId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <artifactId>commons-lang3</artifactId>-->
<!-- <groupId>org.apache.commons</groupId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <artifactId>protobuf-java</artifactId>-->
<!-- <groupId>com.google.protobuf</groupId>-->
<!-- </exclusion>-->
</exclusions>
</dependency>
<dependency>
Expand Down
1 change: 1 addition & 0 deletions hugegraph-server/hugegraph-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
<!-- Keep consistent with grpc dependency version (pd/store) -->
<!-- <version>1.47.0</version>-->
<version>1.39.0</version>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.apache.hugegraph.backend.store.ram.RamTable;
import org.apache.hugegraph.backend.tx.GraphTransaction;
import org.apache.hugegraph.backend.tx.ISchemaTransaction;
import org.apache.hugegraph.backend.tx.SchemaTransaction;
import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.event.EventHub;
import org.apache.hugegraph.job.EphemeralJob;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ public BinaryBackendEntry(HugeType type, byte[] bytes, boolean enablePartition)
}

// FIXME: `enablePartition` is unused here
public BinaryBackendEntry(HugeType type, byte[] bytes, boolean enablePartition, boolean isOlap) {
public BinaryBackendEntry(HugeType type, byte[] bytes, boolean enablePartition,
boolean isOlap) {
this(type, BytesBuffer.wrap(bytes).parseOlapId(type, isOlap));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package org.apache.hugegraph.backend.serializer;

import static org.apache.hugegraph.schema.SchemaElement.UNDEF;

import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
Expand Down Expand Up @@ -74,8 +76,6 @@
import org.apache.hugegraph.util.StringEncoding;
import org.apache.tinkerpop.gremlin.structure.Edge;

import static org.apache.hugegraph.schema.SchemaElement.UNDEF;

public class BinarySerializer extends AbstractSerializer {

/*
Expand Down Expand Up @@ -932,10 +932,10 @@ public BackendEntry parse(BackendEntry originEntry) {
BytesBuffer buffer = BytesBuffer.allocate(BytesBuffer.BUF_EDGE_ID);
buffer.write(parsedEntry.id().asBytes());
buffer.write(bytes);
parsedEntry = new BinaryBackendEntry(originEntry.type(), new BinaryId(buffer.bytes(),
BytesBuffer.wrap(
buffer.bytes())
.readEdgeId()));
parsedEntry = new BinaryBackendEntry(originEntry.type(),
new BinaryId(buffer.bytes(),
BytesBuffer.wrap(buffer.bytes())
.readEdgeId()));

for (BackendColumn col : originEntry.columns()) {
parsedEntry.column(buffer.bytes(), col.value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import com.google.common.collect.Iterators;

import org.apache.commons.collections.CollectionUtils;
import org.apache.hugegraph.HugeException;
import org.apache.hugegraph.HugeGraph;
Expand Down Expand Up @@ -103,6 +101,7 @@
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterators;

import jakarta.ws.rs.ForbiddenException;

Expand Down Expand Up @@ -1053,8 +1052,10 @@ protected Iterator<HugeEdge> queryEdgesFromBackend(Query query) {
if (query instanceof ConditionQuery && !query.paging()) {
// TODO: support: paging + parent label
boolean supportIn = this.storeFeatures().supportsQueryWithInCondition();
// consider multi labels + properties, see org.apache.hugegraph.core.EdgeCoreTest.testQueryInEdgesOfVertexByLabels
Stream<ConditionQuery> flattenedQueries = ConditionQueryFlatten.flatten((ConditionQuery) query, supportIn).stream();
// consider multi labels + properties,
// see org.apache.hugegraph.core.EdgeCoreTest.testQueryInEdgesOfVertexByLabels
Stream<ConditionQuery> flattenedQueries =
ConditionQueryFlatten.flatten((ConditionQuery) query, supportIn).stream();

Stream<Iterator<HugeEdge>> edgeIterators = flattenedQueries.map(cq -> {
Id label = cq.condition(HugeKeys.LABEL);
Expand All @@ -1073,7 +1074,8 @@ protected Iterator<HugeEdge> queryEdgesFromBackend(Query query) {
}
});

return edgeIterators.reduce(ExtendableIterator::concat).orElse(Collections.emptyIterator());
return edgeIterators.reduce(ExtendableIterator::concat)
.orElse(Collections.emptyIterator());
}

return queryEdgesFromBackendInternal(query);
Expand Down Expand Up @@ -1640,7 +1642,8 @@ private Query optimizeQuery(ConditionQuery query) {
*/
boolean byLabel = (label != null && query.conditionsSize() == 1);
if (!byLabel || this.store().features().supportsQueryByLabel()) {
if (this.storeFeatures().supportsFatherAndSubEdgeLabel() && byLabel && query.resultType().isEdge()) {
if (this.storeFeatures().supportsFatherAndSubEdgeLabel() && byLabel &&
query.resultType().isEdge()) {
// for memory backend
EdgeLabel edgeLabel = graph().edgeLabel(label);
if (edgeLabel.hasFather()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,8 @@ public Id createOlapPk(PropertyKey propertyKey) {
return asyncRun(this.graph(), propertyKey, job);
}

// -- store related methods, divided into two categories: 1. olap table related 2. ID generation strategy
// -- store related methods, divided into two categories:
// 1. olap table related 2. ID generation strategy
// - 1. olap table related
public void createOlapPk(Id id) {
this.graphParams().loadGraphStore().createOlapTable(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.apache.hugegraph.backend.query.Query;
import org.apache.hugegraph.job.UserJob;
import org.apache.hugegraph.job.algorithm.BfsTraverser;
import org.apache.hugegraph.schema.SchemaLabel;
import org.apache.hugegraph.structure.HugeVertex;
import org.apache.hugegraph.traversal.algorithm.HugeTraverser;
import org.apache.hugegraph.type.define.Directions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.tx.GraphTransaction;
import org.apache.hugegraph.backend.tx.ISchemaTransaction;
import org.apache.hugegraph.backend.tx.SchemaTransaction;
import org.apache.hugegraph.schema.EdgeLabel;
import org.apache.hugegraph.type.define.SchemaStatus;
import org.apache.hugegraph.util.LockUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.tx.GraphTransaction;
import org.apache.hugegraph.backend.tx.ISchemaTransaction;
import org.apache.hugegraph.backend.tx.SchemaTransaction;
import org.apache.hugegraph.schema.EdgeLabel;
import org.apache.hugegraph.schema.IndexLabel;
import org.apache.hugegraph.schema.SchemaElement;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.tx.GraphTransaction;
import org.apache.hugegraph.backend.tx.ISchemaTransaction;
import org.apache.hugegraph.backend.tx.SchemaTransaction;
import org.apache.hugegraph.schema.IndexLabel;
import org.apache.hugegraph.type.define.SchemaStatus;
import org.apache.hugegraph.util.LockUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.tx.GraphTransaction;
import org.apache.hugegraph.backend.tx.ISchemaTransaction;
import org.apache.hugegraph.backend.tx.SchemaTransaction;
import org.apache.hugegraph.schema.IndexLabel;
import org.apache.hugegraph.type.define.SchemaStatus;
import org.apache.hugegraph.util.LockUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.hugegraph.job.schema;

import org.apache.hugegraph.backend.tx.ISchemaTransaction;
import org.apache.hugegraph.backend.tx.SchemaTransaction;
import org.apache.hugegraph.schema.PropertyKey;

public class OlapPropertyKeyCreateJob extends SchemaJob {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.tx.ISchemaTransaction;
import org.apache.hugegraph.backend.tx.SchemaTransaction;
import org.apache.hugegraph.schema.PropertyKey;

public class OlapPropertyKeyRemoveJob extends OlapPropertyKeyClearJob {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.tx.GraphTransaction;
import org.apache.hugegraph.backend.tx.ISchemaTransaction;
import org.apache.hugegraph.backend.tx.SchemaTransaction;
import org.apache.hugegraph.schema.EdgeLabel;
import org.apache.hugegraph.schema.VertexLabel;
import org.apache.hugegraph.type.define.SchemaStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// TODO: rename to GlobalNodeRoleInfo
public final class GlobalMasterInfo {

private final static NodeInfo NO_MASTER = new NodeInfo(false, "");
private static final NodeInfo NO_MASTER = new NodeInfo(false, "");

private volatile boolean supportElection;
private volatile NodeInfo masterNodeInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@

public interface MetaDriver {

public void put(String key, String value);
void put(String key, String value);

public String get(String key);
String get(String key);

public void delete(String key);
void delete(String key);

public void deleteWithPrefix(String prefix);
void deleteWithPrefix(String prefix);

public Map<String, String> scanWithPrefix(String prefix);
Map<String, String> scanWithPrefix(String prefix);

public <T> void listen(String key, Consumer<T> consumer);
<T> void listen(String key, Consumer<T> consumer);

public <T> void listenPrefix(String prefix, Consumer<T> consumer);
<T> void listenPrefix(String prefix, Consumer<T> consumer);

public <T> List<String> extractValuesFromResponse(T response);
<T> List<String> extractValuesFromResponse(T response);

/**
* Extract K-V pairs of response
Expand All @@ -48,19 +48,19 @@ public interface MetaDriver {
* @param response
* @return
*/
public <T> Map<String, String> extractKVFromResponse(T response);
<T> Map<String, String> extractKVFromResponse(T response);

public LockResult tryLock(String key, long ttl, long timeout);
LockResult tryLock(String key, long ttl, long timeout);

/**
* return if the key is Locked.
*
* @param key
* @return bool
*/
public boolean isLocked(String key);
boolean isLocked(String key);

public void unlock(String key, LockResult lockResult);
void unlock(String key, LockResult lockResult);

/**
* keepAlive of current lease
Expand All @@ -69,5 +69,5 @@ public interface MetaDriver {
* @param lease
* @return next leaseId
*/
public long keepAlive(String key, long lease);
long keepAlive(String key, long lease);
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ public class EtcdDistributedLock {
private final Lease leaseClient;

private static final int poolSize = 8;
private final ScheduledExecutorService service = new ScheduledThreadPoolExecutor(poolSize, r -> {
Thread t = new Thread(r, "keepalive");
t.setDaemon(true);
return t;
});
private final ScheduledExecutorService service =
new ScheduledThreadPoolExecutor(poolSize, r -> {
Thread t = new Thread(r, "keepalive");
t.setDaemon(true);
return t;
});

private EtcdDistributedLock(Client client) {
this.kvClient = client.getKVClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.id.IdGenerator;
import org.apache.hugegraph.backend.tx.ISchemaTransaction;
import org.apache.hugegraph.backend.tx.SchemaTransaction;
import org.apache.hugegraph.config.CoreOptions;
import org.apache.hugegraph.exception.ExistedException;
import org.apache.hugegraph.exception.NotAllowException;
Expand All @@ -42,17 +41,16 @@
import org.apache.hugegraph.type.define.WriteType;
import org.apache.hugegraph.util.E;

public class PropertyKeyBuilder extends AbstractBuilder
implements PropertyKey.Builder {
public class PropertyKeyBuilder extends AbstractBuilder implements PropertyKey.Builder {

private Id id;
private String name;
private final String name;
private DataType dataType;
private Cardinality cardinality;
private AggregateType aggregateType;
private WriteType writeType;
private boolean checkExist;
private Userdata userdata;
private final Userdata userdata;

public PropertyKeyBuilder(ISchemaTransaction transaction,
HugeGraph graph, String name) {
Expand Down
Loading

0 comments on commit 66c47cb

Please sign in to comment.