You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hugegraph.apache.org by "GeRenlog (via GitHub)" <gi...@apache.org> on 2024/08/06 09:03:33 UTC

[I] Vertex.property后,通过g.V().out()或g.V().outE().has('', ).inV().limit(10000)查询多次返回数据不一致 [incubator-hugegraph]

GeRenlog opened a new issue, #2621:
URL: https://github.com/apache/incubator-hugegraph/issues/2621

   ### Problem Type (问题类型)
   
   gremlin (结果不合预期)
   
   ### Before submit
   
   - [X] 我已经确认现有的 [Issues](https://github.com/apache/hugegraph/issues) 与 [FAQ](https://hugegraph.apache.org/docs/guides/faq/) 中没有相同 / 重复问题 (I have confirmed and searched that there are no similar problems in the historical issue and documents)
   
   ### Environment (环境信息)
   
   无
   
   
   ### Your Question (问题描述)
   
   当我在一个接口执行这个sourceVertex.property("balancer", blancer)方法后,如图:
   ![image](https://github.com/user-attachments/assets/a65ecbf0-ed0a-4dcc-8474-f4700a5e3a3a)
   我想在查询接口查询出来,但是有时候会偶尔出现还是原来的值或者直接没有有这个balancer属性:
   ![image](https://github.com/user-attachments/assets/512953e7-b9df-4cad-a351-fdb171cd959c)
   
   
   ### Vertex/Edge example (问题点 / 边数据举例)
   
   _No response_
   
   ### Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
   
   _No response_


-- 
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: dev-unsubscribe@hugegraph.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Vertex.property后,通过g.V().out()或g.V().outE().has('', ).inV().limit(10000)查询多次返回数据不一致 [incubator-hugegraph]

Posted by "haohao0103 (via GitHub)" <gi...@apache.org>.
haohao0103 commented on issue #2621:
URL: https://github.com/apache/incubator-hugegraph/issues/2621#issuecomment-2274796503

   > 如何禁止,我看不到您的图片
   
   you can refer to #2626  https://github.com/apache/incubator-hugegraph/issues/2626


-- 
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: [I] Vertex.property后,通过g.V().out()或g.V().outE().has('', ).inV().limit(10000)查询多次返回数据不一致 [incubator-hugegraph]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #2621:
URL: https://github.com/apache/incubator-hugegraph/issues/2621#issuecomment-2270772392

   <!-- Answer -->
   The inconsistency in the property updates on a vertex using `sourceVertex.property("balancer", balancer)` and subsequent Gremlin queries can be due to the caching mechanism and the way properties are loaded and updated in HugeGraph. To ensure that the "balancer" property is reliably updated and queried, follow these steps:
   
   1. **Update the Property within a Transaction Context**:
      Ensure that the property update is committed within a transaction.
   
      ```java
      GraphTransaction tx = graph.tx();
      try {
          sourceVertex.property("balancer", balancer);
          tx.commit();
      } catch (Exception e) {
          tx.rollback();
          throw e;
      }
      ```
   
   2. **Ensure Properties are Properly Loaded Before Querying**:
      Make sure the properties are loaded before performing the query.
   
      ```java
      sourceVertex.ensureFilledProperties(true);
      Iterator<VertexProperty<Object>> properties = sourceVertex.properties("balancer");
      while (properties.hasNext()) {
          VertexProperty<Object> property = properties.next();
          System.out.println("Balancer: " + property.value());
      }
      ```
   
   By following these steps, you can ensure that the "balancer" property is reliably updated and queried in HugeGraph <sup>[[1]](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java)</sup><sup>[[2]](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertex.java)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
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: [I] Vertex.property后,通过g.V().out()或g.V().outE().has('', ).inV().limit(10000)查询多次返回数据不一致 [incubator-hugegraph]

Posted by "haohao0103 (via GitHub)" <gi...@apache.org>.
haohao0103 commented on issue #2621:
URL: https://github.com/apache/incubator-hugegraph/issues/2621#issuecomment-2295585187

   @GeRenlog  Hello, do you have any results yet


-- 
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: [I] Vertex.property后,通过g.V().out()或g.V().outE().has('', ).inV().limit(10000)查询多次返回数据不一致 [incubator-hugegraph]

Posted by "GeRenlog (via GitHub)" <gi...@apache.org>.
GeRenlog commented on issue #2621:
URL: https://github.com/apache/incubator-hugegraph/issues/2621#issuecomment-2274780295

   如何禁止,我看不到您的图片


-- 
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: [I] Vertex.property后,通过g.V().out()或g.V().outE().has('', ).inV().limit(10000)查询多次返回数据不一致 [incubator-hugegraph]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #2621:
URL: https://github.com/apache/incubator-hugegraph/issues/2621#issuecomment-2270849414

   <!-- Answer -->
   HugeGraph从引入`GraphTransaction`类的版本开始支持事务。要正确管理事务并确保属性更新的一致性,可以使用`GraphTransaction`类中的`prepareUpdates`方法。这个方法处理属性的添加和删除,确保索引相应地更新。
   
   以下是如何管理属性更新事务的示例:
   
   ```java
   protected void prepareUpdates(Set<HugeProperty<?>> addedProps,
                                 Set<HugeProperty<?>> removedProps) {
       for (HugeProperty<?> p : removedProps) {
           this.checkAggregateProperty(p);
           if (p.element().type().isVertex()) {
               HugeVertexProperty<?> prop = (HugeVertexProperty<?>) p;
               if (this.store().features().supportsUpdateVertexProperty()) {
                   // Update vertex index without removed property
                   this.indexTx.updateVertexIndex(prop.element(), false);
                   // Eliminate the property (OUT and IN owner edge)
                   this.doEliminate(this.serializer.writeVertexProperty(prop));
               } else {
                   // Override vertex
                   this.addVertex(prop.element());
               }
           } else {
               assert p.element().type().isEdge();
               HugeEdgeProperty<?> prop = (HugeEdgeProperty<?>) p;
               if (this.store().features().supportsUpdateEdgeProperty()) {
                   // Update edge index without removed property
                   this.indexTx.updateEdgeIndex(prop.element(), false);
                   // Eliminate the property (OUT and IN owner edge)
                   this.doEliminate(this.serializer.writeEdgeProperty(prop));
                   this.doEliminate(this.serializer.writeEdgeProperty(
                           prop.switchEdgeOwner()));
               } else {
                   // Override edge (it will be in addedEdges & updatedEdges)
                   this.addEdge(prop.element());
               }
           }
       }
       for (HugeProperty<?> p : addedProps) {
           this.checkAggregateProperty(p);
           if (p.element().type().isVertex()) {
               HugeVertexProperty<?> prop = (HugeVertexProperty<?>) p;
               if (this.store().features().supportsUpdateVertexProperty()) {
                   // Update vertex index with new added property
                   this.indexTx.updateVertexIndex(prop.element(), false);
                   // Append new property (OUT and IN owner edge)
                   this.doAppend(this.serializer.writeVertexProperty(prop));
               } else {
                   // Override vertex
                   this.addVertex(prop.element());
               }
           } else {
               assert p.element().type().isEdge();
               HugeEdgeProperty<?> prop = (HugeEdgeProperty<?>) p;
               if (this.store().features().supportsUpdateEdgeProperty()) {
                   // Update edge index with new added property
                   this.indexTx.updateEdgeIndex(prop.element(), false);
                   // Append new property (OUT and IN owner edge)
                   this.doAppend(this.serializer.writeEdgeProperty(prop));
                   this.doAppend(this.serializer.writeEdgeProperty(
                           prop.switchEdgeOwner()));
               } else {
                   // Override edge (it will be in addedEdges & updatedEdges)
                   this.addEdge(prop.element());
               }
           }
       }
   }
   ```
   
   这个方法确保属性更新在事务内正确处理,保持图数据的一致性和完整性 <sup>[[1]](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java)</sup>.
   
   此外,HugeGraph的事务支持是默认启用的,不需要额外的配置或前提条件 <sup>[[2]](https://github.com/apache/incubator-hugegraph-doc/blob/master/content/en/docs/language/hugegraph-gremlin.md)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
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: [I] Vertex.property后,通过g.V().out()或g.V().outE().has('', ).inV().limit(10000)查询多次返回数据不一致 [incubator-hugegraph]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #2621:
URL: https://github.com/apache/incubator-hugegraph/issues/2621#issuecomment-2327434274

   Due to the lack of activity, the current issue is marked as stale and will be closed after 20 days, any update will remove the stale label


-- 
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: [I] Vertex.property后,通过g.V().out()或g.V().outE().has('', ).inV().limit(10000)查询多次返回数据不一致 [incubator-hugegraph]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #2621:  Vertex.property后,通过g.V().out()或g.V().outE().has('', ).inV().limit(10000)查询多次返回数据不一致
URL: https://github.com/apache/incubator-hugegraph/issues/2621


-- 
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: dev-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Vertex.property后,通过g.V().out()或g.V().outE().has('', ).inV().limit(10000)查询多次返回数据不一致 [incubator-hugegraph]

Posted by "GeRenlog (via GitHub)" <gi...@apache.org>.
GeRenlog commented on issue #2621:
URL: https://github.com/apache/incubator-hugegraph/issues/2621#issuecomment-2272490492

   我们是调用多个的graphManager
   这是拖拽节点的那个接口
   ![image](https://github.com/user-attachments/assets/488294f5-ebf2-474f-949a-2fd576f2a8bf)
   
   这是获取拖拽后的接口
   ![image](https://github.com/user-attachments/assets/8f95f80f-0dbf-4725-b435-1176d1116f24)
   
   


-- 
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: [I] Vertex.property后,通过g.V().out()或g.V().outE().has('', ).inV().limit(10000)查询多次返回数据不一致 [incubator-hugegraph]

Posted by "haohao0103 (via GitHub)" <gi...@apache.org>.
haohao0103 commented on issue #2621:
URL: https://github.com/apache/incubator-hugegraph/issues/2621#issuecomment-2270962575

   @GeRenlog hello , you using a single or multiple GraphServer?


-- 
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: [I] Vertex.property后,通过g.V().out()或g.V().outE().has('', ).inV().limit(10000)查询多次返回数据不一致 [incubator-hugegraph]

Posted by "GeRenlog (via GitHub)" <gi...@apache.org>.
GeRenlog commented on issue #2621:
URL: https://github.com/apache/incubator-hugegraph/issues/2621#issuecomment-2270838543

   我为什么没有GraphTransaction这个类,你们是从什么版本支持事务的?
   


-- 
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: [I] Vertex.property后,通过g.V().out()或g.V().outE().has('', ).inV().limit(10000)查询多次返回数据不一致 [incubator-hugegraph]

Posted by "haohao0103 (via GitHub)" <gi...@apache.org>.
haohao0103 commented on issue #2621:
URL: https://github.com/apache/incubator-hugegraph/issues/2621#issuecomment-2274776229

   > 我们是调用多个的graphManager 这是拖拽节点的那个接口 ![image](https://private-user-images.githubusercontent.com/134604729/355651429-488294f5-ebf2-474f-949a-2fd576f2a8bf.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwODE1ODgsIm5iZiI6MTcyMzA4MTI4OCwicGF0aCI6Ii8xMzQ2MDQ3MjkvMzU1NjUxNDI5LTQ4ODI5NGY1LWViZjItNDc0Zi05NDlhLTJmZDU3NmYyYThiZi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODA4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgwOFQwMTQxMjhaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mZGFkMmYxMDU3ZjNiMmFmNGQ3NDNjMWMxMTE4ODkyOTBiOWZjOWJhNDY0YmZjOGRkNmUxM2E4YWI4NTgxZTQyJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.KlMUbH_s2EVZyjozZI2OL7PzQMeer-6H7zkYNgWpw30)
   > 
   > 这是获取拖拽后的接口 ![image](https://private-user-images.githubusercontent.com/134604729/355652090-8f95f80f-0dbf-4725-b435-1176d1116f24.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwODE1ODgsIm5iZiI6MTcyMzA4MTI4OCwicGF0aCI6Ii8xMzQ2MDQ3MjkvMzU1NjUyMDkwLThmOTVmODBmLTBkYmYtNDcyNS1iNDM1LTExNzZkMTExNmYyNC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODA4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgwOFQwMTQxMjhaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00YjJhMjEzMjU4MDU0MDRkMTkxMGNjZGQzNmQ2Yzg1YjcxNDUzNWQ2ZmVmYThhZTY4YTQ5M2NiYWQyNDQ1NTEzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.9Wf-2nUolVkG1pzKRHDJCVB0L-RSSL4hcrW3V9SZMvQ)
    there are multiple GraphManager objects?  multiple graph servers behind it, right?
   i think you can try disable the cache of vertexs and edges on the graph server to quickly verify if it is caused by inconsistent cache .


-- 
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