server is dead…
client in other machine different from server’s machine…
2017/11/20 14:52:05 mutation.go:148: Done schema update predicate:“predicate” value_type:STRING list:true
2017/11/20 14:52:09 groups.go:291: Asking if I can serve tablet for: name
2017/11/20 14:56:17 node.go:400: WARN: A tick missed to fire. Node blocks too long!
已杀死
Like @manishrjain pointed out, you are not committing your transaction. Did you try my suggestion to modify your code in #25? Please post your final code here just to confirm.
Your code looks alright. It looks like there is a problem in the server, but it may be caused when using the Java client specifically. It is hard to tell from the information you have given us so far.
I am writing some integration tests for the client right now, to ensure the behavior is exactly like Go client. I will do some load testing in EC2 and try and replicate your scenario.
I have setup two EC2 instances - one as client, and another as server, and I am running the following code. It is still running, and upto about 100000 mutations so far. Will wait for it to complete and see whether i can replicate the problem.
for(int i=1;i<100000000L;i++) {
Transaction txn = dgraphClient.newTransaction();
try {
// Create data
Person p = new Person();
p.name = "Alice"+i;
// Serialize it
String json = gson.toJson(p);
// Run mutation
Mutation mu =
Mutation.newBuilder().setSetJson(ByteString.copyFromUtf8(json.toString())).build();
txn.mutate(mu);
txn.commit();
if ((i % 10000) == 0) {
System.out.printf("%s: %d", LocalTime.now(),i);
}
} finally {
txn.discard();
}
}
I have run the code for about 40min, and 550000 mutations have completed successfully. I am yet to see any error.
I just want to point out that for bulk loading, there are better ways to insert the data than inserting it one by one in a single thread, like the code above.
You can use the live loader (dgraph live --help) or the bulk loader (dgraph bulk --help). You could also make sure you make mutations concurrently in multiple threads.
You have to be a bit careful if you have a schema defined. You might encounter aborts if you try to update the same entities simultaneously, and you will need to handle them by retrying or something.
This code is a modified version of DgraphJavaSample project that can be found in this repo. It effectively does the same thing as what your code is doing. I don’t see any difference between running the code as above, and what you have. If the problem cannot be replicated that way, then the cause lies elsewhere.
restart ,contuine insert
I have run the code for about 20min
a lot of error
goroutine 566921 [chan receive, 6 minutes]: github.com/dgraph-io/dgraph/worker.(*node).ProposeAndWait(0xc42015bab0, 0x19120c0, 0xc4200140c8, 0xc57309afa0, 0x0, 0x0)
/home/travis/gopath/src/github.com/dgraph-io/dgraph/worker/draft.go:255 +0x591
created by github.com/dgraph-io/dgraph/worker.(*groupi).proposeDelta
/home/travis/gopath/src/github.com/dgraph-io/dgraph/worker/groups.go:595 +0x19a