You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hugegraph.apache.org by "imbajin (via GitHub)" <gi...@apache.org> on 2026/01/14 10:56:21 UTC
[PR] refactor: fix update TTL failed & enhance server configs [incubator-hugegraph]
imbajin opened a new pull request, #2938:
URL: https://github.com/apache/incubator-hugegraph/pull/2938
Refactored EdgeLabelBuilder and VertexLabelBuilder to allow updating TTL and TTL start time when appending schema changes. Increased batch limits and write ratio in ServerOptions. Added tests to verify appending TTL to existing vertex and edge labels.
<!--
Thank you very much for contributing to Apache HugeGraph, we are happy that you want to help us improve it!
Here are some tips for you:
1. If this is your first time, please read the [contributing guidelines](https://github.com/apache/hugegraph/blob/master/CONTRIBUTING.md)
2. If a PR fix/close an issue, type the message "close xxx" (xxx is the link of related
issue) in the content, GitHub will auto link it (Required)
3. Name the PR title in "Google Commit Format", start with "feat | fix | perf | refactor | doc | chore",
such like: "feat(core): support the PageRank algorithm" or "fix: wrong break in the compute loop" (module is optional)
skip it if you are unsure about which is the best component.
4. One PR address one issue, better not to mix up multiple issues.
5. Put an `x` in the `[ ]` to mark the item as CHECKED. `[x]` (or click it directly after
published)
-->
## Purpose of the PR
- close #xxx <!-- or use "fix #xxx", "xxx" is the ID-link of related issue, e.g: close #1024 -->
<!--
Please explain more context in this section, clarify why the changes are needed.
e.g:
- If you propose a new API, clarify the use case for a new API.
- If you fix a bug, you can clarify why it is a bug, and should be associated with an issue.
-->
## Main Changes
<!-- Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. These change logs are helpful for better and faster reviews.)
For example:
- If you introduce a new feature, please show detailed design here or add the link of design documentation.
- If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
- If there is a discussion in the mailing list, please add the link. -->
## Verifying these changes
<!-- Please pick the proper options below -->
- [ ] Trivial rework / code cleanup without any test coverage. (No Need)
- [ ] Already covered by existing tests, such as *(please modify tests here)*.
- [ ] Need tests and can be verified as follows:
- xxx
## Does this PR potentially affect the following parts?
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] Dependencies ([add/update license](https://hugegraph.apache.org/docs/contribution-guidelines/contribute/#321-check-licenses) info & [regenerate_known_dependencies.sh](../install-dist/scripts/dependency/regenerate_known_dependencies.sh)) <!-- Don't forget to add/update the info in "LICENSE" & "NOTICE" files (both in root & dist module) -->
- [ ] Modify configurations
- [ ] The public API
- [ ] Other affects (typed here)
- [ ] Nope
## Documentation Status
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `Doc - TODO` <!-- Your PR changes impact docs and you will update later -->
- [ ] `Doc - Done` <!-- Related docs have been already added or updated -->
- [ ] `Doc - No Need` <!-- Your PR changes don't impact/need docs -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] refactor: fix update TTL failed & enhance server configs [incubator-hugegraph]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #2938:
URL: https://github.com/apache/incubator-hugegraph/pull/2938#discussion_r2689969896
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/EdgeLabelBuilder.java:
##########
@@ -670,7 +667,16 @@ private void checkStableVars() {
}
}
- private void checkTtl() {
+ private void updateTTL(EdgeLabel edgeLabel) {
+ if (this.ttl > 0L) {
+ edgeLabel.ttl(this.ttl);
+ if (this.ttlStartTime != null) {
+ edgeLabel.ttlStartTime(this.graph().propertyKey(this.ttlStartTime).id());
Review Comment:
The updateTTL method only updates TTL when ttl > 0, but this prevents clearing TTL by setting it to 0. When appending, if ttl is explicitly set to 0, it should be applied to allow removal of TTL from a label that previously had TTL configured.
```suggestion
/*
* Update ttl in two cases:
* 1) ttl > 0L: set or change a positive ttl;
* 2) ttl == 0L and existing ttl > 0L: explicitly clear an existing ttl.
* This allows removing ttl from a label that previously had ttl configured.
*/
if (this.ttl > 0L || (this.ttl == 0L && edgeLabel.ttl() > 0L)) {
edgeLabel.ttl(this.ttl);
if (this.ttlStartTime != null) {
edgeLabel.ttlStartTime(
this.graph().propertyKey(this.ttlStartTime).id());
```
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/VertexLabelBuilder.java:
##########
@@ -546,7 +533,16 @@ private void checkStableVars() {
}
}
- private void checkTtl() {
+ private void updateTTL(VertexLabel vertexLabel) {
+ if (this.ttl > 0L) {
+ vertexLabel.ttl(this.ttl);
+ if (this.ttlStartTime != null) {
+ vertexLabel.ttlStartTime(this.graph().propertyKey(this.ttlStartTime).id());
+ }
+ }
+ }
Review Comment:
The updateTTL method only updates TTL when ttl > 0, but this prevents clearing TTL by setting it to 0. When appending, if ttl is explicitly set to 0, it should be applied to allow removal of TTL from a label that previously had TTL configured.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] refactor: support update TTL in labels & enhance server configs [incubator-hugegraph]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #2938:
URL: https://github.com/apache/incubator-hugegraph/pull/2938#discussion_r2690026198
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/VertexLabelBuilder.java:
##########
@@ -546,7 +533,25 @@ private void checkStableVars() {
}
}
- private void checkTtl() {
+ /**
+ * Update TTL in two cases:
+ * 1) ttl > 0L: set or change a positive TTL
+ * 2) ttl == 0L and existing ttl > 0L: explicitly clear an existing TTL
+ * This allows removing TTL from a label that previously had TTL configured.
+ */
+ private void updateTTL(VertexLabel vertexLabel) {
+ if (this.ttl > 0L) {
+ vertexLabel.ttl(this.ttl);
+ if (this.ttlStartTime != null) {
+ vertexLabel.ttlStartTime(this.graph().propertyKey(this.ttlStartTime).id());
+ }
+ } else if (this.ttl == 0L && vertexLabel.ttl() > 0L) {
Review Comment:
The condition `this.ttl == 0L` will be true even when `this.ttl` was never explicitly set by the user (default is 0). This means that appending any schema change without specifying TTL will inadvertently clear an existing TTL. Consider tracking whether TTL was explicitly set, or check if this behavior is intentional.
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/EdgeLabelBuilder.java:
##########
@@ -670,7 +667,25 @@ private void checkStableVars() {
}
}
- private void checkTtl() {
+ /**
+ * Update TTL in two cases:
+ * 1) ttl > 0L: set or change a positive TTL
+ * 2) ttl == 0L and existing ttl > 0L: explicitly clear an existing TTL
+ * This allows removing TTL from a label that previously had TTL configured.
+ */
+ private void updateTTL(EdgeLabel edgeLabel) {
+ if (this.ttl > 0L) {
+ edgeLabel.ttl(this.ttl);
+ if (this.ttlStartTime != null) {
+ edgeLabel.ttlStartTime(this.graph().propertyKey(this.ttlStartTime).id());
+ }
+ } else if (this.ttl == 0L && edgeLabel.ttl() > 0L) {
Review Comment:
The condition `this.ttl == 0L` will be true even when `this.ttl` was never explicitly set by the user (default is 0). This means that appending any schema change without specifying TTL will inadvertently clear an existing TTL. Consider tracking whether TTL was explicitly set, or check if this behavior is intentional.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] refactor(server): support update TTL in labels & enhance configs [incubator-hugegraph]
Posted by "zyxxoo (via GitHub)" <gi...@apache.org>.
zyxxoo merged PR #2938:
URL: https://github.com/apache/incubator-hugegraph/pull/2938
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] refactor(server): support update TTL in labels & enhance configs [incubator-hugegraph]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #2938:
URL: https://github.com/apache/incubator-hugegraph/pull/2938#discussion_r2690072424
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/VertexLabelBuilder.java:
##########
@@ -546,7 +533,33 @@ private void checkStableVars() {
}
}
- private void checkTtl() {
+ /**
+ * Update TTL in two cases:
+ * 1) ttl > 0L: set or change a positive TTL
+ * 2) ttl == 0L and existing ttl > 0L: explicitly clear an existing TTL
+ * This allows removing TTL from a label that previously had TTL configured.
+ * Note: ttl == null means not set, so we skip the update.
+ */
+ private void updateTTL(VertexLabel vertexLabel) {
+ if (this.ttl == null) {
+ return;
+ }
+ if (this.ttl > 0L) {
+ vertexLabel.ttl(this.ttl);
+ if (this.ttlStartTime != null) {
+ vertexLabel.ttlStartTime(this.graph().propertyKey(this.ttlStartTime).id());
+ }
+ } else if (this.ttl == 0L && vertexLabel.ttl() > 0L) {
+ // Clear TTL and ttlStartTime
+ vertexLabel.ttl(0L);
+ vertexLabel.ttlStartTime(IdGenerator.ZERO);
+ }
+ }
+
+ private void checkTTL() {
Review Comment:
The method name change from `checkTtl` to `checkTTL` violates Java naming conventions. Method names should use camelCase, so `checkTtl` was correct. Consider reverting to `checkTtl`.
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/EdgeLabelBuilder.java:
##########
@@ -670,7 +667,33 @@ private void checkStableVars() {
}
}
- private void checkTtl() {
+ /**
+ * Update TTL in two cases:
+ * 1) ttl > 0L: set or change a positive TTL
+ * 2) ttl == 0L and existing ttl > 0L: explicitly clear an existing TTL
+ * This allows removing TTL from a label that previously had TTL configured.
+ * Note: ttl == null means not set, so we skip the update.
+ */
+ private void updateTTL(EdgeLabel edgeLabel) {
+ if (this.ttl == null) {
+ return;
+ }
+ if (this.ttl > 0L) {
+ edgeLabel.ttl(this.ttl);
+ if (this.ttlStartTime != null) {
+ edgeLabel.ttlStartTime(this.graph().propertyKey(this.ttlStartTime).id());
+ }
+ } else if (this.ttl == 0L && edgeLabel.ttl() > 0L) {
+ // Clear TTL and ttlStartTime
+ edgeLabel.ttl(0L);
+ edgeLabel.ttlStartTime(IdGenerator.ZERO);
+ }
+ }
+
+ private void checkTTL() {
Review Comment:
The method name change from `checkTtl` to `checkTTL` violates Java naming conventions. Method names should use camelCase, so `checkTtl` was correct. Consider reverting to `checkTtl`.
```suggestion
private void checkTtl() {
```
##########
hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/VertexLabelCoreTest.java:
##########
@@ -566,7 +566,7 @@ public void testAddVertexLabelWithDisableLabelIndex() {
}
@Test
- public void testAddVertexLabelWithTtl() {
+ public void testAddVertexLabelWithTTL() {
Review Comment:
The method name change from `testAddVertexLabelWithTtl` to `testAddVertexLabelWithTTL` improves consistency with the new test methods, but creates inconsistency with Java naming conventions. Method names should use camelCase, so `testAddVertexLabelWithTtl` was actually correct. Consider reverting to `testAddVertexLabelWithTtl` for all TTL-related test methods.
```suggestion
public void testAddVertexLabelWithTtl() {
```
##########
hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeLabelCoreTest.java:
##########
@@ -480,7 +480,7 @@ public void testAddEdgeLabelWithDisableLabelIndex() {
}
@Test
- public void testAddEdgeLabelWithTtl() {
+ public void testAddEdgeLabelWithTTL() {
Review Comment:
The method name change from `testAddEdgeLabelWithTtl` to `testAddEdgeLabelWithTTL` improves consistency with the new test methods, but creates inconsistency with Java naming conventions. Method names should use camelCase, so `testAddEdgeLabelWithTtl` was actually correct. Consider reverting to `testAddEdgeLabelWithTtl` for all TTL-related test methods.
```suggestion
public void testAddEdgeLabelWithTtl() {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] refactor(server): support update TTL in labels & enhance configs [incubator-hugegraph]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #2938:
URL: https://github.com/apache/incubator-hugegraph/pull/2938#discussion_r2692992957
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/VertexLabelBuilder.java:
##########
@@ -546,7 +533,35 @@ private void checkStableVars() {
}
}
- private void checkTtl() {
+ /**
+ * Update TTL in two cases:
+ * 1) ttl > 0L: set or change a positive TTL
+ * 2) ttl == 0L and existing ttl > 0L: explicitly clear an existing TTL
+ * This allows removing TTL from a label that previously had TTL configured.
+ * Note: ttl == null means not set, so we skip the update.
+ */
+ private void updateTTL(VertexLabel vertexLabel) {
+ if (this.ttl == null) {
+ return;
+ }
+ if (this.ttl > 0L) {
+ vertexLabel.ttl(this.ttl);
+ if (this.ttlStartTime != null) {
+ vertexLabel.ttlStartTime(this.graph().propertyKey(this.ttlStartTime).id());
+ }
+ } else if (this.ttl == 0L && vertexLabel.ttl() > 0L) {
+ // Clear TTL and ttlStartTime
+ vertexLabel.ttl(0L);
+ vertexLabel.ttlStartTime(IdGenerator.ZERO);
+ }
+ }
Review Comment:
The `updateTTL` method does not handle the case where a user wants to remove `ttlStartTime` while keeping a positive TTL. When `this.ttl > 0L` and `this.ttlStartTime == null`, the existing `ttlStartTime` on the label is preserved. Consider adding an else clause at line 551 to explicitly clear `ttlStartTime` when `this.ttlStartTime == null` and `this.ttl > 0L`, by calling `vertexLabel.ttlStartTime(IdGenerator.ZERO)`. This would allow users to remove ttlStartTime while maintaining TTL.
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/EdgeLabelBuilder.java:
##########
@@ -670,7 +667,35 @@ private void checkStableVars() {
}
}
- private void checkTtl() {
+ /**
+ * Update TTL in two cases:
+ * 1) ttl > 0L: set or change a positive TTL
+ * 2) ttl == 0L and existing ttl > 0L: explicitly clear an existing TTL
+ * This allows removing TTL from a label that previously had TTL configured.
+ * Note: ttl == null means not set, so we skip the update.
+ */
+ private void updateTTL(EdgeLabel edgeLabel) {
+ if (this.ttl == null) {
+ return;
+ }
+ if (this.ttl > 0L) {
+ edgeLabel.ttl(this.ttl);
+ if (this.ttlStartTime != null) {
+ edgeLabel.ttlStartTime(this.graph().propertyKey(this.ttlStartTime).id());
+ }
+ } else if (this.ttl == 0L && edgeLabel.ttl() > 0L) {
+ // Clear TTL and ttlStartTime
+ edgeLabel.ttl(0L);
+ edgeLabel.ttlStartTime(IdGenerator.ZERO);
+ }
+ }
Review Comment:
The `updateTTL` method does not handle the case where a user wants to remove `ttlStartTime` while keeping a positive TTL. When `this.ttl > 0L` and `this.ttlStartTime == null`, the existing `ttlStartTime` on the label is preserved. Consider adding an else clause at line 685 to explicitly clear `ttlStartTime` when `this.ttlStartTime == null` and `this.ttl > 0L`, by calling `edgeLabel.ttlStartTime(IdGenerator.ZERO)`. This would allow users to remove ttlStartTime while maintaining TTL.
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/VertexLabelBuilder.java:
##########
@@ -454,22 +446,18 @@ private void checkNullableKeys(Action action) {
"must belong to the origin/new properties: %s/%s",
this.nullableKeys, originProps, appendProps);
- List<String> primaryKeys = vertexLabel == null ?
- this.primaryKeys :
- this.graph()
- .mapPkId2Name(vertexLabel.primaryKeys());
+ List<String> primaryKeys = vertexLabel == null ? this.primaryKeys :
+ this.graph().mapPkId2Name(vertexLabel.primaryKeys());
Review Comment:
Potentially confusing name: method [checkNullableKeys](1) also refers to field [primaryKeys](2) (as this.primaryKeys).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] refactor(server): support update TTL in labels & enhance configs [incubator-hugegraph]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #2938:
URL: https://github.com/apache/incubator-hugegraph/pull/2938#discussion_r2690058205
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/EdgeLabelBuilder.java:
##########
@@ -670,7 +667,33 @@ private void checkStableVars() {
}
}
- private void checkTtl() {
+ /**
+ * Update TTL in two cases:
+ * 1) ttl > 0L: set or change a positive TTL
+ * 2) ttl == 0L and existing ttl > 0L: explicitly clear an existing TTL
+ * This allows removing TTL from a label that previously had TTL configured.
+ * Note: ttl == null means not set, so we skip the update.
+ */
+ private void updateTTL(EdgeLabel edgeLabel) {
+ if (this.ttl == null) {
+ return;
+ }
+ if (this.ttl > 0L) {
+ edgeLabel.ttl(this.ttl);
+ if (this.ttlStartTime != null) {
+ edgeLabel.ttlStartTime(this.graph().propertyKey(this.ttlStartTime).id());
+ }
+ } else if (this.ttl == 0L && edgeLabel.ttl() > 0L) {
Review Comment:
The condition checks if `edgeLabel.ttl() > 0L` but `edgeLabel.ttl()` might be 0 on a new edge label created without TTL. In the `build()` method, the edgeLabel's TTL is only set through `updateTTL()`, which means if `this.ttl` is null, the edgeLabel's TTL will remain uninitialized/default. This could cause unexpected behavior when trying to clear TTL on labels that never had it set. Consider checking if the existing TTL was explicitly configured or verify the default TTL value for newly created labels.
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/schema/builder/VertexLabelBuilder.java:
##########
@@ -546,7 +533,33 @@ private void checkStableVars() {
}
}
- private void checkTtl() {
+ /**
+ * Update TTL in two cases:
+ * 1) ttl > 0L: set or change a positive TTL
+ * 2) ttl == 0L and existing ttl > 0L: explicitly clear an existing TTL
+ * This allows removing TTL from a label that previously had TTL configured.
+ * Note: ttl == null means not set, so we skip the update.
+ */
+ private void updateTTL(VertexLabel vertexLabel) {
+ if (this.ttl == null) {
+ return;
+ }
+ if (this.ttl > 0L) {
+ vertexLabel.ttl(this.ttl);
+ if (this.ttlStartTime != null) {
+ vertexLabel.ttlStartTime(this.graph().propertyKey(this.ttlStartTime).id());
+ }
+ } else if (this.ttl == 0L && vertexLabel.ttl() > 0L) {
Review Comment:
The condition checks if `vertexLabel.ttl() > 0L` but `vertexLabel.ttl()` might be 0 on a new vertex label created without TTL. In the `build()` method, the vertexLabel's TTL is only set through `updateTTL()`, which means if `this.ttl` is null, the vertexLabel's TTL will remain uninitialized/default. This could cause unexpected behavior when trying to clear TTL on labels that never had it set. Consider checking if the existing TTL was explicitly configured or verify the default TTL value for newly created labels.
##########
hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/VertexLabelCoreTest.java:
##########
@@ -633,6 +633,84 @@ public void testAddVertexLabelWithTtl() {
assertContainsPk(ImmutableSet.of(student.ttlStartTime()), "born");
}
+ @Test
+ public void testAppendVertexLabelWithTTL() {
+ super.initPropertyKeys();
+
+ SchemaManager schema = graph().schema();
+
+ schema.propertyKey("born").asDate().ifNotExist().create();
+
+ // Create a vertex label without TTL
+ VertexLabel person = schema.vertexLabel("person")
+ .properties("name", "age", "city", "born")
+ .create();
+
+ Assert.assertNotNull(person);
+ Assert.assertEquals("person", person.name());
+ Assert.assertEquals(0L, person.ttl());
+
+ // Update the vertex label with TTL via append
+ person = schema.vertexLabel("person")
+ .ttl(86400L)
+ .append();
+
+ Assert.assertNotNull(person);
+ Assert.assertEquals("person", person.name());
+ Assert.assertEquals(86400L, person.ttl());
+ }
+
+ @Test
+ public void testAppendVertexLabelResetTTL() {
+ super.initPropertyKeys();
+
+ SchemaManager schema = graph().schema();
+
+ // Create a vertex label with TTL
+ VertexLabel person = schema.vertexLabel("person")
+ .properties("name", "age", "city")
+ .ttl(86400L)
+ .create();
+
+ Assert.assertNotNull(person);
+ Assert.assertEquals("person", person.name());
+ Assert.assertEquals(86400L, person.ttl());
+
+ // Reset TTL to 0 via append
+ person = schema.vertexLabel("person")
+ .ttl(0L)
+ .append();
+
+ Assert.assertNotNull(person);
+ Assert.assertEquals("person", person.name());
+ Assert.assertEquals(0L, person.ttl());
+ }
+
+ @Test
+ public void testAppendVertexLabelWithoutTTLShouldNotClearExistingTTL() {
+ super.initPropertyKeys();
+
+ SchemaManager schema = graph().schema();
+
+ // Create label with TTL
+ VertexLabel person = schema.vertexLabel("person")
+ .properties("name", "age", "city")
+ .ttl(86400L)
+ .create();
+
+ Assert.assertNotNull(person);
+ Assert.assertEquals(86400L, person.ttl());
+
+ // Append property WITHOUT specifying ttl
+ person = schema.vertexLabel("person")
+ .nullableKeys("city")
+ .append();
+
+ // TTL should remain unchanged
+ Assert.assertNotNull(person);
+ Assert.assertEquals(86400L, person.ttl());
Review Comment:
The test verifies TTL is preserved during append, but doesn't verify that `ttlStartTime` is also preserved when the original label was created with a TTL start time. Consider adding a test case that creates a label with both TTL and TTL start time, then appends properties without specifying TTL, and verifies both TTL and TTL start time remain unchanged.
##########
hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeLabelCoreTest.java:
##########
@@ -561,6 +561,117 @@ public void testAddEdgeLabelWithTtl() {
assertContainsPk(ImmutableSet.of(write.ttlStartTime()), "date");
}
+ @Test
+ public void testAppendEdgeLabelWithTTL() {
+ super.initPropertyKeys();
+
+ SchemaManager schema = graph().schema();
+
+ schema.propertyKey("date").asDate().ifNotExist().create();
+
+ schema.vertexLabel("person")
+ .properties("name", "age", "city")
+ .primaryKeys("name")
+ .nullableKeys("city")
+ .create();
+
+ schema.vertexLabel("book")
+ .properties("name")
+ .primaryKeys("name")
+ .create();
+
+ // Create an edge label without TTL
+ EdgeLabel read = schema.edgeLabel("read").link("person", "book")
+ .properties("date", "weight")
+ .create();
+
+ Assert.assertNotNull(read);
+ Assert.assertEquals("read", read.name());
+ Assert.assertEquals(0L, read.ttl());
+
+ // Update the edge label with TTL via append
+ read = schema.edgeLabel("read")
+ .ttl(86400L)
+ .append();
+
+ Assert.assertNotNull(read);
+ Assert.assertEquals("read", read.name());
+ Assert.assertEquals(86400L, read.ttl());
+ }
+
+ @Test
+ public void testAppendEdgeLabelResetTTL() {
+ super.initPropertyKeys();
+
+ SchemaManager schema = graph().schema();
+
+ schema.vertexLabel("person")
+ .properties("name", "age", "city")
+ .primaryKeys("name")
+ .nullableKeys("city")
+ .create();
+
+ schema.vertexLabel("book")
+ .properties("name")
+ .primaryKeys("name")
+ .create();
+
+ // Create an edge label with TTL
+ EdgeLabel read = schema.edgeLabel("read").link("person", "book")
+ .properties("time", "weight")
+ .ttl(86400L)
+ .create();
+
+ Assert.assertNotNull(read);
+ Assert.assertEquals("read", read.name());
+ Assert.assertEquals(86400L, read.ttl());
+
+ // Reset TTL to 0 via append
+ read = schema.edgeLabel("read")
+ .ttl(0L)
+ .append();
+
+ Assert.assertNotNull(read);
+ Assert.assertEquals("read", read.name());
+ Assert.assertEquals(0L, read.ttl());
+ }
+
+ @Test
+ public void testAppendEdgeLabelWithoutTTLShouldNotClearExistingTTL() {
+ super.initPropertyKeys();
+
+ SchemaManager schema = graph().schema();
+
+ schema.vertexLabel("person")
+ .properties("name", "age", "city")
+ .primaryKeys("name")
+ .nullableKeys("city")
+ .create();
+
+ schema.vertexLabel("book")
+ .properties("name")
+ .primaryKeys("name")
+ .create();
+
+ // Create edge label with TTL
+ EdgeLabel read = schema.edgeLabel("read").link("person", "book")
+ .properties("time", "weight")
+ .ttl(86400L)
+ .create();
+
+ Assert.assertNotNull(read);
+ Assert.assertEquals(86400L, read.ttl());
+
+ // Append property WITHOUT specifying ttl
+ read = schema.edgeLabel("read")
+ .nullableKeys("weight")
+ .append();
+
+ // TTL should remain unchanged
+ Assert.assertNotNull(read);
+ Assert.assertEquals(86400L, read.ttl());
Review Comment:
The test verifies TTL is preserved during append, but doesn't verify that `ttlStartTime` is also preserved when the original label was created with a TTL start time. Consider adding a test case that creates a label with both TTL and TTL start time, then appends properties without specifying TTL, and verifies both TTL and TTL start time remain unchanged.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] refactor: fix update TTL failed & enhance server configs [incubator-hugegraph]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #2938:
URL: https://github.com/apache/incubator-hugegraph/pull/2938#issuecomment-3748992617
## [Codecov](https://app.codecov.io/gh/apache/incubator-hugegraph/pull/2938?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 93.25%. Comparing base ([`37be6cd`](https://app.codecov.io/gh/apache/incubator-hugegraph/commit/37be6cdde3a2ffb71091453b366f28ae446db882?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`3027bcf`](https://app.codecov.io/gh/apache/incubator-hugegraph/commit/3027bcf14bbfc34783e83499605afc3775e9d72d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #2938 +/- ##
=============================================
+ Coverage 39.38% 93.25% +53.87%
+ Complexity 456 65 -391
=============================================
Files 812 9 -803
Lines 68660 267 -68393
Branches 8968 22 -8946
=============================================
- Hits 27044 249 -26795
+ Misses 38824 8 -38816
+ Partials 2792 10 -2782
```
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/incubator-hugegraph/pull/2938?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org