Browse Source

Hadoop: printout the entry creation error message

pull/1524/head
Chris Lu 4 years ago
parent
commit
d5fcb0f474
  1. 8
      other/java/client/src/main/java/seaweedfs/client/FilerClient.java

8
other/java/client/src/main/java/seaweedfs/client/FilerClient.java

@ -1,5 +1,6 @@
package seaweedfs.client; package seaweedfs.client;
import com.google.common.base.Strings;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -272,15 +273,20 @@ public class FilerClient {
public boolean createEntry(String parent, FilerProto.Entry entry) { public boolean createEntry(String parent, FilerProto.Entry entry) {
try { try {
FilerProto.CreateEntryResponse createEntryResponse =
filerGrpcClient.getBlockingStub().createEntry(FilerProto.CreateEntryRequest.newBuilder() filerGrpcClient.getBlockingStub().createEntry(FilerProto.CreateEntryRequest.newBuilder()
.setDirectory(parent) .setDirectory(parent)
.setEntry(entry) .setEntry(entry)
.build()); .build());
if (Strings.isNullOrEmpty(createEntryResponse.getError())) {
return true;
}
LOG.warn("createEntry {}/{} error: {}", parent, entry.getName(), createEntryResponse.getError());
return false;
} catch (Exception e) { } catch (Exception e) {
LOG.warn("createEntry {}/{}: {}", parent, entry.getName(), e); LOG.warn("createEntry {}/{}: {}", parent, entry.getName(), e);
return false; return false;
} }
return true;
} }
public boolean updateEntry(String parent, FilerProto.Entry entry) { public boolean updateEntry(String parent, FilerProto.Entry entry) {

Loading…
Cancel
Save