Hi,
I need to assign servers unique integer ids. So I created a vertex named Counter that has one attribute named uniqueId which is type INT. I then created a query named getServerId that prints the current uniqueId and then increments uniqueId by 1.
However, the issue I’m running into is that when 2 servers call at exactly the same time, they both get the same Id. Is there a way to process these calls serially so they get unique Ids? According to the docs a Write-Write scenario should result in sequential execution. I’m probably misunderstanding this.
https://docs.tigergraph.com/tigergraph-platform-overview/transaction-and-acid
Here is my simple code:
CREATE QUERY getServerId() FOR GRAPH Snowflake SYNTAX V2{
INT serverId;
result = SELECT c
FROM Counter:c
WHERE c.id == “counter”
POST-ACCUM serverId = c.uniqueId, c.uniqueId += 1
PRINT serverId AS data;
}
Any help would be much appreciated.
Alvin