You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by vg...@apache.org on 2024/08/06 09:45:41 UTC
(incubator-hugegraph) branch limit-conf created (now 6effaafa7)
This is an automated email from the ASF dual-hosted git repository.
vgalaxies pushed a change to branch limit-conf
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git
at 6effaafa7 encode string id length with 2 bits by default
This branch includes the following new commits:
new 9ee816643 enlarge bytes limit
new 6effaafa7 encode string id length with 2 bits by default
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(incubator-hugegraph) 01/02: enlarge bytes limit
Posted by vg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
vgalaxies pushed a commit to branch limit-conf
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git
commit 9ee816643c5c6dd57bbd6b249f6872922e0a33dd
Author: VGalaxies <vg...@apache.org>
AuthorDate: Sat Aug 3 12:08:36 2024 +0800
enlarge bytes limit
---
.../hugegraph/backend/serializer/BinarySerializer.java | 4 ++--
.../apache/hugegraph/backend/serializer/BytesBuffer.java | 13 +++++++++----
.../java/org/apache/hugegraph/structure/HugeElement.java | 3 +--
.../src/main/java/org/apache/hugegraph/task/HugeTask.java | 2 +-
4 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinarySerializer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinarySerializer.java
index 37a7e9a9c..0dd4c9d3e 100644
--- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinarySerializer.java
+++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BinarySerializer.java
@@ -1312,9 +1312,9 @@ public class BinarySerializer extends AbstractSerializer {
}
private byte[] writeIds(Collection<Id> ids) {
- E.checkState(ids.size() <= BytesBuffer.UINT16_MAX,
+ E.checkState(ids.size() <= BytesBuffer.MAX_PROPERTIES,
"The number of properties of vertex/edge label " +
- "can't exceed '%s'", BytesBuffer.UINT16_MAX);
+ "can't exceed '%s'", BytesBuffer.MAX_PROPERTIES);
int size = 2;
for (Id id : ids) {
size += (1 + id.length());
diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java
index f293dd287..74d78b3df 100644
--- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java
+++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java
@@ -52,10 +52,12 @@ public final class BytesBuffer extends OutputStream {
public static final int FLOAT_LEN = Float.BYTES;
public static final int DOUBLE_LEN = Double.BYTES;
public static final int BLOB_LEN = 4;
+ public static final int BYTES_LEN = 5;
public static final int UINT8_MAX = ((byte) -1) & 0xff;
public static final int UINT16_MAX = ((short) -1) & 0xffff;
public static final long UINT32_MAX = (-1) & 0xffffffffL;
+ public static final int INT32_MAX = Integer.MAX_VALUE;
// NOTE: +1 to let code 0 represent length 1
public static final int ID_LEN_MASK = 0x7f;
@@ -64,8 +66,11 @@ public final class BytesBuffer extends OutputStream {
public static final byte STRING_ENDING_BYTE = (byte) 0x00;
public static final byte STRING_ENDING_BYTE_FF = (byte) 0xff;
- public static final int STRING_LEN_MAX = UINT16_MAX;
+
public static final long BLOB_LEN_MAX = 1 * Bytes.GB;
+ public static final long BYTES_LEN_MAX = INT32_MAX;
+
+ public static final int MAX_PROPERTIES = BytesBuffer.UINT16_MAX;
// The value must be in range [8, ID_LEN_MAX]
public static final int INDEX_HASH_ID_THRESHOLD = 32;
@@ -288,10 +293,10 @@ public final class BytesBuffer extends OutputStream {
}
public BytesBuffer writeBytes(byte[] bytes) {
- E.checkArgument(bytes.length <= UINT16_MAX,
+ E.checkArgument(bytes.length <= BYTES_LEN_MAX,
"The max length of bytes is %s, but got %s",
- UINT16_MAX, bytes.length);
- require(SHORT_LEN + bytes.length);
+ BYTES_LEN_MAX, bytes.length);
+ require(BYTES_LEN + bytes.length);
this.writeVInt(bytes.length);
this.write(bytes);
return this;
diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeElement.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeElement.java
index 137e623d8..adb12f31b 100644
--- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeElement.java
+++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeElement.java
@@ -55,7 +55,6 @@ public abstract class HugeElement implements Element, GraphType, Idfiable, Compa
private static final MutableIntObjectMap<HugeProperty<?>> EMPTY_MAP =
CollectionFactory.newIntObjectMap();
- private static final int MAX_PROPERTIES = BytesBuffer.UINT16_MAX;
private final HugeGraph graph;
private MutableIntObjectMap<HugeProperty<?>> properties;
@@ -279,7 +278,7 @@ public abstract class HugeElement implements Element, GraphType, Idfiable, Compa
PropertyKey pkey = prop.propertyKey();
E.checkArgument(this.properties.containsKey(intFromId(pkey.id())) ||
- this.properties.size() < MAX_PROPERTIES,
+ this.properties.size() < BytesBuffer.MAX_PROPERTIES,
"Exceeded the maximum number of properties");
return this.properties.put(intFromId(pkey.id()), prop);
}
diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/HugeTask.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/HugeTask.java
index bfd79f6f2..95ef506f5 100644
--- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/HugeTask.java
+++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/HugeTask.java
@@ -725,7 +725,7 @@ public class HugeTask<V> extends FutureTask<V> {
}
private void checkPropertySize(int propertyLength, String propertyName) {
- long propertyLimit = BytesBuffer.STRING_LEN_MAX;
+ long propertyLimit = BytesBuffer.MAX_PROPERTIES;
HugeGraph graph = this.scheduler().graph();
if (propertyName.equals(P.INPUT)) {
propertyLimit = graph.option(CoreOptions.TASK_INPUT_SIZE_LIMIT);
(incubator-hugegraph) 02/02: encode string id length with 2 bits by default
Posted by vg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
vgalaxies pushed a commit to branch limit-conf
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git
commit 6effaafa7248cc397da443a16ddf04f0df945248
Author: VGalaxies <vg...@apache.org>
AuthorDate: Tue Aug 6 17:45:23 2024 +0800
encode string id length with 2 bits by default
---
.../java/org/apache/hugegraph/backend/serializer/BytesBuffer.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java
index 74d78b3df..fee2a3e61 100644
--- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java
+++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java
@@ -634,7 +634,7 @@ public final class BytesBuffer extends OutputStream {
}
public BytesBuffer writeId(Id id) {
- return this.writeId(id, false);
+ return this.writeId(id, true);
}
public BytesBuffer writeId(Id id, boolean big) {
@@ -684,7 +684,7 @@ public final class BytesBuffer extends OutputStream {
}
public Id readId() {
- return this.readId(false);
+ return this.readId(true);
}
public Id readId(boolean big) {