From 7c822b1fe04d0a55ac838b1a8f5e6c56cfe5a54e Mon Sep 17 00:00:00 2001 From: Aman Mangal Date: Fri, 13 Dec 2024 17:58:59 +0530 Subject: [PATCH] cleanup the repo --- PUBLISHING.md | 2 +- README.md | 137 ++++++++++-------- build.gradle | 38 ++--- release.sh | 7 - samples/DgraphJavaSample/README.md | 7 +- samples/DgraphJavaSample/build.gradle | 4 +- .../README.md | 7 +- .../build.gradle | 2 +- .../README.md | 7 +- .../build.gradle | 2 +- samples/concurrent-modification/README.md | 46 ++++-- settings.gradle | 4 +- 12 files changed, 152 insertions(+), 111 deletions(-) delete mode 100755 release.sh diff --git a/PUBLISHING.md b/PUBLISHING.md index ef27b296..979d45c4 100644 --- a/PUBLISHING.md +++ b/PUBLISHING.md @@ -33,7 +33,7 @@ ossrhPassword=<…password…> - Update `dgraph4j version` in `grpc-netty` table in README. - Update CHANGELOG. - Raise a PR for the above changes. Put the changelog in PR description and merge it. -- Run `./gradlew uploadArchives`. +- Run `./gradlew publish`. - Release the deployment by following the steps on the page _Releasing the Deployment_ (link in references below). - Also cut a release tag on GitHub with the new version. diff --git a/README.md b/README.md index 2c832f12..3204316c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A minimal implementation for a Dgraph client for Java 11 and above, using [grpc]. -### IMP NOTE: +### IMP NOTE: v24.0.0 features an upgraded protobuf dependency which requires an upgrade to JDK 11. On account of this breaking change, all legacy applications built upon JDK 8 would be impacted. [grpc]: https://grpc.io/ @@ -22,28 +22,41 @@ and understand how to run and work with Dgraph. **Use [Discuss Issues](https://discuss.dgraph.io/c/issues/35/clients/46) for reporting issues about this repository.** ## Table of Contents -- [Download](#download) -- [Supported Versions](#supported-versions) -- [Quickstart](#quickstart) -- [Intro](#intro) -- [Using the Synchronous Client](#using-the-synchronous-client) - * [Creating a Client](#creating-a-client) - * [Creating a Client for Dgraph Cloud](#creating-a-client-for-dgraph-cloud) - * [Creating a Secure Client Using TLS](#creating-a-secure-client-using-tls) - * [Check Dgraph Version](#check-dgraph-version) - * [Login Using ACL](#login-using-acl) - * [Altering the Database](#altering-the-database) - * [Creating a Transaction](#creating-a-transaction) - * [Running a Mutation](#running-a-mutation) - * [Committing a Transaction](#committing-a-transaction) - * [Running a Query](#running-a-query) - * [Running a Query with RDF response](#running-a-query-with-rdf-response) - * [Running an Upsert: Query + Mutation](#running-an-upsert-query--mutation) - * [Running a Conditional Upsert](#running-a-conditional-upsert) - * [Setting Deadlines](#setting-deadlines) - * [Setting Metadata Headers](#setting-metadata-headers) - * [Helper Methods](#helper-methods) - * [Closing the DB Connection](#closing-the-db-connection) +- [Dgraph Client for Java](#dgraph-client-for-java) + - [IMP NOTE:](#imp-note) + - [Table of Contents](#table-of-contents) + - [Download](#download) + - [Supported Versions](#supported-versions) + - [Note regarding Java 1.8.x support:](#note-regarding-java-18x-support) + - [Quickstart](#quickstart) + - [Intro](#intro) + - [Using the Synchronous Client](#using-the-synchronous-client) + - [Creating a Client](#creating-a-client) + - [Creating a Client for Dgraph Cloud](#creating-a-client-for-dgraph-cloud) + - [Creating a Secure Client using TLS](#creating-a-secure-client-using-tls) + - [Check Dgraph version](#check-dgraph-version) + - [Login Using ACL](#login-using-acl) + - [Altering the Database](#altering-the-database) + - [Creating a Transaction](#creating-a-transaction) + - [Running a Mutation](#running-a-mutation) + - [Committing a Transaction](#committing-a-transaction) + - [Running a Query](#running-a-query) + - [Running a Query with RDF response](#running-a-query-with-rdf-response) + - [Running an Upsert: Query + Mutation](#running-an-upsert-query--mutation) + - [Running a Conditional Upsert](#running-a-conditional-upsert) + - [Setting Deadlines](#setting-deadlines) + - [Setting deadlines for all requests](#setting-deadlines-for-all-requests) + - [Setting deadlines for a single request](#setting-deadlines-for-a-single-request) + - [Setting Metadata Headers](#setting-metadata-headers) + - [Helper Methods](#helper-methods) + - [Delete multiple edges](#delete-multiple-edges) + - [Closing the DB Connection](#closing-the-db-connection) + - [Using the Asynchronous Client](#using-the-asynchronous-client) + - [Checking the request latency](#checking-the-request-latency) + - [Development](#development) + - [Building the source](#building-the-source) + - [Code Style](#code-style) + - [Running unit tests](#running-unit-tests) * [Using the Asynchronous Client](#using-the-asynchronous-client) * [Checking the request latency](#checking-the-request-latency) - [Development](#development) @@ -61,6 +74,7 @@ grab via Maven: 24.1.0 ``` + or Gradle: ```groovy compile 'io.dgraph:dgraph4j:24.1.0' @@ -71,29 +85,30 @@ compile 'io.dgraph:dgraph4j:24.1.0' Depending on the version of Dgraph that you are connecting to, you will have to use a different version of this client. -| Dgraph version | dgraph4j version | java version | -|:--------------:|:-----------------:|:------------:| -| 1.0.X | 1.X.X | 1.9.X | -| 1.1.0 - 2.X.X | 2.X.X | 1.9.X | -|20.03.X-20.07.X | 20.03.X | 1.9.X | -| 20.11.X | 20.11.X | 1.9.X | -| >= 21.XX.X | 21.XX.X | 1.9.X | -| >= 24.X.X | 24.X.X | 11 | +| Dgraph version | dgraph4j version | java version | +| :-------------: | :--------------: | :----------: | +| 1.0.X | 1.X.X | 1.9.X | +| 1.1.0 - 2.X.X | 2.X.X | 1.9.X | +| 20.03.X-20.07.X | 20.03.X | 1.9.X | +| 20.11.X | 20.11.X | 1.9.X | +| >= 21.XX.X | 21.XX.X | 1.9.X | +| >= 24.X.X | 24.X.X | 11 | #### Note regarding Java 1.8.x support: -v24.0.0 features an upgraded protoc-protobuf dependency that requires an upgrade to JDK 11. This version is incompatible with Java 1.8 and and requires an upgrade to Java 11. +v24.0.0 features an upgraded protoc-protobuf dependency that requires an upgrade to JDK 11. +This version is incompatible with Java 1.8 and and requires an upgrade to Java 11. -The following is only applicable to dgraph4j versions < v24.X.X. +The following is only applicable to dgraph4j versions < v24.X.X. * If you aren't using gRPC with TLS, then the above version table will work for you with Java 1.8.x too. * If you're using gRPC with TLS on Java 1.8.x, then you will need to follow gRPC docs [here ](https://github.com/grpc/grpc-java/blob/master/SECURITY.md#tls-on-non-android). Basically, it - will require you to add the following dependency in your app with correct version for the - corresponding `grpc-netty` version used by `dgraph4j`. You can find out the correct version of + will require you to add the following dependency in your app with correct version for the + corresponding `grpc-netty` version used by `dgraph4j`. You can find out the correct version of the dependency to use from the version combination table in [this section] in `grpc-netty` docs. - + For maven: - + ```xml io.netty @@ -101,28 +116,31 @@ The following is only applicable to dgraph4j versions < v24.X.X. ``` - + For Gradle: - + ```groovy compile 'io.netty:netty-tcnative-boringssl-static:' ``` - - The following table lists the `grpc-netty` versions used by different `dgraph4j` versions over time, along with the supported versions of `netty-tcnative-boringssl-static` for the corresponding `grpc-netty` version: - - | dgraph4j version | grpc-netty version | netty-tcnative-boringssl-static version | - |:-----------------:|:------------------:|:---------------------------------------:| - | 1.0.0-1.2.0 | 1.7.0 | 2.0.6.Final | - | 1.4.0-1.6.0 | 1.10.0 | 2.0.7.Final | - | 1.7.0 | 1.15.0 | 2.0.12.Final | - | 1.7.3-1.7.5 | 1.15.1 | 2.0.12.Final | - | 2.0.0-2.1.0 | 1.22.1 | 2.0.25.Final | - | 20.03.0-20.03.3 | 1.26.0 | 2.0.26.Final | - | >= 20.11.0 | 1.34.1 | 2.0.31.Final | - | >= 24.0.0 | 1.65.1 | 4.1.100.Final | - | >= 24.1.0 | 1.68.2 | 4.1.110.Final | - - For example, when using `dgraph4j v24.0.0`, the version of the `netty-tcnative-boringssl-static` dependency to be used is `4.1.100.Final`, as suggested by gRPC docs for `grpc-netty v1.65.1`. + + The following table lists the `grpc-netty` versions used by different `dgraph4j` versions + over time, along with the supported versions of `netty-tcnative-boringssl-static` + for the corresponding `grpc-netty` version: + + | dgraph4j version | grpc-netty version | netty-tcnative-boringssl-static version | + | :--------------: | :----------------: | :-------------------------------------: | + | 1.0.0-1.2.0 | 1.7.0 | 2.0.6.Final | + | 1.4.0-1.6.0 | 1.10.0 | 2.0.7.Final | + | 1.7.0 | 1.15.0 | 2.0.12.Final | + | 1.7.3-1.7.5 | 1.15.1 | 2.0.12.Final | + | 2.0.0-2.1.0 | 1.22.1 | 2.0.25.Final | + | 20.03.0-20.03.3 | 1.26.0 | 2.0.26.Final | + | >= 20.11.0 | 1.34.1 | 2.0.31.Final | + | >= 24.0.0 | 1.65.1 | 4.1.100.Final | + | >= 24.1.0 | 1.68.2 | 4.1.110.Final | + + For example, when using `dgraph4j v24.0.0`, the version of the `netty-tcnative-boringssl-static` + dependency to be used is `4.1.100.Final`, as suggested by gRPC docs for `grpc-netty v1.65.1`. [this section]: https://github.com/grpc/grpc-java/blob/master/SECURITY.md#netty @@ -457,7 +475,7 @@ txn.doRequest(request); ### Running a Query with RDF response -You can get query results as an RDF response by calling either `queryRDF()` or `queryRDFWithVars()`. +You can get query results as an RDF response by calling either `queryRDF()` or `queryRDFWithVars()`. The response contains the `getRdf()` method, which will provide the RDF encoded output. **Note**: If you are querying for `uid` values only, use a JSON format response @@ -505,8 +523,9 @@ txn.doRequest(request); ### Running a Conditional Upsert -The upsert block also allows specifying a conditional mutation block using an `@if` directive. The mutation is executed -only when the specified condition is true. If the condition is false, the mutation is silently ignored. +The upsert block also allows specifying a conditional mutation block using an `@if` directive. +The mutation is executed only when the specified condition is true. If the condition is false, +the mutation is silently ignored. See more about Conditional Upsert [Here](https://docs.dgraph.io/mutations/#conditional-upsert). @@ -625,7 +644,7 @@ Here is the asynchronous version of the code above, which runs a query. ```java // Query -String query = +String query = "query all($a: string){\n" + " all(func: eq(name, $a)) {\n" + " name\n" + diff --git a/build.gradle b/build.gradle index eea75006..5c70aaaf 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ /* - * Copyright 2016 DGraph Labs, Inc. + * Copyright 2016 Dgraph Labs, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar buildscript { repositories { maven { - url "https://plugins.gradle.org/m2/" + url 'https://plugins.gradle.org/m2/' } } dependencies { @@ -50,7 +50,7 @@ base { archivesName = 'dgraph4j' } -// Upgrade to Java SE 11 to match updated protobuf-protoc version. +// Upgrade to Java SE 11 to match updated protobuf-protoc version. // WARNING: Needs local toolchain upgrade from Java 8 to Java 11. java { sourceCompatibility = JavaVersion.VERSION_11 @@ -66,7 +66,7 @@ protobuf { // The version of protoc must match protobuf-java. If you don't depend on // protobuf-java directly, you will be transitively depending on the // protobuf-java version that grpc depends on. - artifact = "com.google.protobuf:protoc:4.29.1" + artifact = 'com.google.protobuf:protoc:4.29.1' } plugins { grpc { @@ -81,9 +81,9 @@ protobuf { option 'annotate_code' } } - } + } all()*.plugins { - grpc {} + grpc { } } } generatedFilesBaseDir = "$projectDir/src/generated" @@ -113,29 +113,29 @@ configurations { // In this section you declare the dependencies for your production and test code dependencies { // The production code uses the SLF4J logging API at compile time - implementation "org.slf4j:slf4j-api:2.0.16" + implementation 'org.slf4j:slf4j-api:2.0.16' // Specific slf4j bindings should not be included in the default (compile) scope. // See http://www.slf4j.org/faq.html#maven2. - testImplementation "org.slf4j:slf4j-simple:2.0.16" + testImplementation 'org.slf4j:slf4j-simple:2.0.16' implementation "io.grpc:grpc-protobuf:${grpcVersion}" implementation "io.grpc:grpc-netty:${grpcVersion}" implementation "io.grpc:grpc-stub:${grpcVersion}" - implementation "com.google.guava:guava:33.3.1-jre" + implementation 'com.google.guava:guava:33.3.1-jre' // Explicit matching of protobuf-java and protoc versions to address - // compilation errors arising due to transitive dependency on the version of - // protobuf-java that grpc depends on. - implementation "com.google.protobuf:protobuf-java:4.29.1" + // compilation errors arising due to transitive dependency on the version of + // protobuf-java that grpc depends on. + implementation 'com.google.protobuf:protobuf-java:4.29.1' testImplementation "io.opencensus:opencensus-api:${openCensusVersion}" testImplementation "io.opencensus:opencensus-exporter-trace-jaeger:${openCensusVersion}" testRuntimeOnly "io.opencensus:opencensus-impl:${openCensusVersion}" // Used for unmarshalling a JSON GraphQL response - testImplementation "com.google.code.gson:gson:2.11.0" + testImplementation 'com.google.code.gson:gson:2.11.0' // Declare the dependency for your favourite test framework you want to use in your tests. testImplementation 'org.testng:testng:6.8.8' @@ -146,14 +146,14 @@ dependencies { googleJavaFormat { toolVersion = '1.5' - exclude "src/generated/**/*.java" + exclude 'src/generated/**/*.java' } compileJava.dependsOn 'googleJavaFormat' idea { module { - sourceDirs += file("${projectDir}/src/generated/main/java"); - sourceDirs += file("${projectDir}/src/generated/main/grpc"); + sourceDirs += file("${projectDir}/src/generated/main/java") + sourceDirs += file("${projectDir}/src/generated/main/grpc") } } @@ -176,9 +176,9 @@ task fatJar(type: Jar) { tasks.named('shadowJar', ShadowJar) { enableRelocation true - relocationPrefix "io.dgraph.dgraph4j.shaded" + relocationPrefix 'io.dgraph.dgraph4j.shaded' relocate 'google', 'io.dgraph.dgraph4j.shaded.google' - archiveClassifier.set("shaded") + archiveClassifier.set('shaded') mergeServiceFiles() } @@ -223,7 +223,7 @@ jacocoTestReport { } } -task version() { +task version { doLast { println dgraph4jVersion } diff --git a/release.sh b/release.sh deleted file mode 100755 index 7d5c1609..00000000 --- a/release.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -version=$(./gradlew -q version) - -./gradlew publish && \ -git tag "v${version}" master && \ -git push origin --tags - diff --git a/samples/DgraphJavaSample/README.md b/samples/DgraphJavaSample/README.md index b92c2238..e4c33185 100644 --- a/samples/DgraphJavaSample/README.md +++ b/samples/DgraphJavaSample/README.md @@ -1,15 +1,16 @@ Sample project demonstrating the use of [dgraph4j], the official Java client for Dgraph. -[dgraph4j]:https://github.com/dgraph-io/dgraph4 +[dgraph4j]: https://github.com/dgraph-io/dgraph4 ## Running + ### Start Dgraph Server + You will need to install [Dgraph v1.1.0 or above][releases] and run it. [releases]: https://github.com/dgraph-io/dgraph/releases - You can run the commands below to start a clean dgraph server everytime, for testing and exploration. @@ -41,7 +42,7 @@ For more configuration options, and other details, refer to [docs.dgraph.io](htt ## Run the sample code -**Warning**: The sample code, when run, will remove all data from your locally running Dgraph instance. +**Warning**: The sample code, when run, will remove all data from your locally running Dgraph instance. So make sure that you don't have any important data on your Dgraph instance. ``` diff --git a/samples/DgraphJavaSample/build.gradle b/samples/DgraphJavaSample/build.gradle index 46f3cca3..2e9b6601 100644 --- a/samples/DgraphJavaSample/build.gradle +++ b/samples/DgraphJavaSample/build.gradle @@ -16,8 +16,8 @@ repositories { } dependencies { - // Use Dgraph Java client - implementation 'io.dgraph:dgraph4j:24.0.0' + // Use Dgraph Java client + implementation 'io.dgraph:dgraph4j:24.1.0' // Use JUnit test framework testImplementation 'junit:junit:4.13.2' diff --git a/samples/DgraphJavaSampleDeadlineInterceptors/README.md b/samples/DgraphJavaSampleDeadlineInterceptors/README.md index 08b65984..d800e4a7 100644 --- a/samples/DgraphJavaSampleDeadlineInterceptors/README.md +++ b/samples/DgraphJavaSampleDeadlineInterceptors/README.md @@ -1,15 +1,16 @@ Sample project demonstrating the use of [dgraph4j], the official Java client for Dgraph. -[dgraph4j]:https://github.com/dgraph-io/dgraph4 +[dgraph4j]: https://github.com/dgraph-io/dgraph4 ## Running + ### Start Dgraph Server + You will need to install [Dgraph v21.3.0 or above][releases] and start a local cluster as shown below. [releases]: https://github.com/dgraph-io/dgraph/releases - First, create two separate directories for `dgraph zero` and `dgraph server`. ``` @@ -38,7 +39,7 @@ For more configuration options, and other details, refer to [docs.dgraph.io](htt ## Run the sample code -**Warning**: The sample code, when run, will remove all data from your locally running Dgraph instance. +**Warning**: The sample code, when run, will remove all data from your locally running Dgraph instance. So make sure that you don't have any important data on your Dgraph instance. This example in [App.java:39](./src/main/java/App.java#L39-L47) creates the diff --git a/samples/DgraphJavaSampleDeadlineInterceptors/build.gradle b/samples/DgraphJavaSampleDeadlineInterceptors/build.gradle index 713ca3ff..2e9b6601 100644 --- a/samples/DgraphJavaSampleDeadlineInterceptors/build.gradle +++ b/samples/DgraphJavaSampleDeadlineInterceptors/build.gradle @@ -16,7 +16,7 @@ repositories { } dependencies { - // Use Dgraph Java client + // Use Dgraph Java client implementation 'io.dgraph:dgraph4j:24.1.0' // Use JUnit test framework diff --git a/samples/DgraphJavaSampleWithDeadlineAfter/README.md b/samples/DgraphJavaSampleWithDeadlineAfter/README.md index 3bc96163..03499f14 100644 --- a/samples/DgraphJavaSampleWithDeadlineAfter/README.md +++ b/samples/DgraphJavaSampleWithDeadlineAfter/README.md @@ -1,15 +1,16 @@ Sample project demonstrating the use of [dgraph4j], the official Java client for Dgraph. -[dgraph4j]:https://github.com/dgraph-io/dgraph4 +[dgraph4j]: https://github.com/dgraph-io/dgraph4 ## Running + ### Start Dgraph Server + You will need to install [Dgraph v21.03.0 or above][releases] and run it. [releases]: https://github.com/dgraph-io/dgraph/releases - You can run the commands below to start a clean dgraph server everytime, for testing and exploration. @@ -41,7 +42,7 @@ For more configuration options, and other details, refer to [docs.dgraph.io](htt ## Run the sample code -**Warning**: The sample code, when run, will remove all data from your locally running Dgraph instance. +**Warning**: The sample code, when run, will remove all data from your locally running Dgraph instance. So make sure that you don't have any important data on your Dgraph instance. This example in [App.java:34](./src/main/java/App.java#L34) creates the diff --git a/samples/DgraphJavaSampleWithDeadlineAfter/build.gradle b/samples/DgraphJavaSampleWithDeadlineAfter/build.gradle index cd4c1f4e..63400baf 100644 --- a/samples/DgraphJavaSampleWithDeadlineAfter/build.gradle +++ b/samples/DgraphJavaSampleWithDeadlineAfter/build.gradle @@ -16,7 +16,7 @@ repositories { } dependencies { - // Use Dgraph Java client + // Use Dgraph Java client implementation 'io.dgraph:dgraph4j:24.1.0' // Use JUnit test framework diff --git a/samples/concurrent-modification/README.md b/samples/concurrent-modification/README.md index 000da271..b0ba3c99 100644 --- a/samples/concurrent-modification/README.md +++ b/samples/concurrent-modification/README.md @@ -1,29 +1,48 @@ -This example shows how to handle concurrent modifications using a multi-threaded Java Program. The example demonstrates [transaction](https://dgraph.io/docs/clients/overview/#transactions) conflicts in Dgraph. +This example shows how to handle concurrent modifications using a multi-threaded Java Program. +The example demonstrates [transaction](https://dgraph.io/docs/clients/overview/#transactions) +conflicts in Dgraph. -[dgraph4j]:https://github.com/dgraph-io/dgraph4j +[dgraph4j]: https://github.com/dgraph-io/dgraph4j ## Steps to run this example + Step 1: Start a new terminal and launch Dgraph with the following command line. + ```sh docker run -it -p 8080:8080 -p 9080:9080 dgraph/standalone:master ``` -Step 2: Checkout the source code from the 'samples' directory in dgraph4j repository. This particular example can be found at the path "samples/concurrent-modification". In order to run this example, execute the following maven command from the 'concurrent-modification' folder. -**Warning**: The sample code, when run, will remove all data from your locally running Dgraph instance. -So make sure that you don't have any important data on your Dgraph instance. +Step 2: Checkout the source code from the 'samples' directory in dgraph4j repository. +This particular example can be found at the path "samples/concurrent-modification". +In order to run this example, execute the following maven command from the +'concurrent-modification' folder. + +**Warning**: The sample code, when run, will remove all data from your locally running Dgraph +instance. So make sure that you don't have any important data on your Dgraph instance. ```sh mvn clean install exec:java ``` + Step 3: On running the example, the program initializes Dgraph with the following schema. + ```sh : int @index(int) . : string @index(exact) . ``` -Step 4: The program also initializes user "Alice" with a 'clickCount' of value '1', and then proceeds to increment 'clickCount' concurrently in two threads. Dgraph throws an exception if a transaction is updating a given predicate that is being concurrently modified. As part of the exception handling logic, the program sleeps for 1 second on receiving a concurrent modification exception (“TxnConflictException”), and then retries. -
The logs below show that two threads are increasing clickCount for the same user named Alice (note the same uid). Thread #1 succeeds immediately, and Dgraph throws a concurrent modification conflict on Thread 2. Thread 2 sleeps for 1 second and retries, and this time succeeds. + +Step 4: The program also initializes user "Alice" with a 'clickCount' of value '1', and then +proceeds to increment 'clickCount' concurrently in two threads. Dgraph throws an exception if +a transaction is updating a given predicate that is being concurrently modified. As part of the +exception handling logic, the program sleeps for 1 second on receiving a concurrent modification +exception (“TxnConflictException”), and then retries. + +
The logs below show that two threads are increasing clickCount for the same user named +Alice (note the same uid). Thread #1 succeeds immediately, and Dgraph throws a concurrent +modification conflict on Thread 2. Thread 2 sleeps for 1 second and retries, and this time succeeds. <-timestamp-> <-log-> + ```sh 1599628015260 Thread #2 increasing clickCount for uid 0xe, Name: Alice 1599628015260 Thread #1 increasing clickCount for uid 0xe, Name: Alice @@ -33,18 +52,22 @@ Step 4: The program also initializes user "Alice" with a 'clickCount' of value ' 1599628016310 Thread #2 increasing clickCount for uid 0xe, Name: Alice 1599628016333 Thread #2 succeeded after 1 retries ``` -Step 5: Please note that the final value of clickCount is 3 (initial value was 1), which is correct. + +Step 5: Please note that the final value of clickCount is 3 (initial value was 1), which is correct. Query: + ``` { - Alice(func: has()) @filter(eq(name,"Alice" )) { + Alice(func: has()) @filter(eq(name,"Alice" )) { uid name clickCount } } ``` + Response: + ```json { "data": { @@ -61,4 +84,7 @@ Response: **Summary** -Concurrent modifications to the same predicate causes the TxnConflictException. When several transactions hit the same node's predicate at the same time, the first one succeeds, while the other will get the “io.dgraph.TxnConflictException”. Upon constantly retrying, the transactions begin to succeed one after another, and given enough retries, correctly completes its work. +Concurrent modifications to the same predicate causes the TxnConflictException. When several +transactions hit the same node's predicate at the same time, the first one succeeds, while the +other will get the “io.dgraph.TxnConflictException”. Upon constantly retrying, the transactions +begin to succeed one after another, and given enough retries, correctly completes its work. diff --git a/settings.gradle b/settings.gradle index 81c1dc15..a7a532f9 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,11 +1,11 @@ /* - * Copyright 2016 DGraph Labs, Inc. + * Copyright 2016 Dgraph Labs, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS,