Skip to content

Commit

Permalink
feat: 支持文件系统的xAttr
Browse files Browse the repository at this point in the history
1. 支持文件系统的xAttr;
2. 优化日志输出
  • Loading branch information
yuyang733 committed Sep 16, 2020
1 parent f27e604 commit faac162
Show file tree
Hide file tree
Showing 9 changed files with 481 additions and 181 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.qcloud.cos</groupId>
<artifactId>hadoop-cos</artifactId>
<version>3.1.0-5.8.4</version>
<version>3.1.0-5.8.5</version>
<packaging>jar</packaging>

<name>Apache Hadoop Tencent Qcloud COS Support</name>
Expand Down
363 changes: 235 additions & 128 deletions src/main/java/org/apache/hadoop/fs/CosFileSystem.java

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/main/java/org/apache/hadoop/fs/CosNConfigKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@InterfaceStability.Unstable
public class CosNConfigKeys extends CommonConfigurationKeys {
public static final String USER_AGENT = "fs.cosn.user.agent";
public static final String DEFAULT_USER_AGENT = "cos-hadoop-plugin-v5.8.4";
public static final String DEFAULT_USER_AGENT = "cos-hadoop-plugin-v5.8.5";

public static final String TENCENT_EMR_VERSION_KEY = "fs.emr.version";

Expand Down Expand Up @@ -43,7 +43,7 @@ public class CosNConfigKeys extends CommonConfigurationKeys {

public static final String COSN_UPLOAD_BUFFER_SIZE_KEY = "fs.cosn.upload.buffer.size";
public static final String COSN_UPLOAD_BUFFER_SIZE_PREV_KEY = "fs.cosn.buffer.size";
public static final int DEFAULT_UPLOAD_BUFFER_SIZE = -1; // default is 128MB
public static final int DEFAULT_UPLOAD_BUFFER_SIZE = -1;

public static final String COSN_BLOCK_SIZE_KEY = "fs.cosn.block.size";
public static final long DEFAULT_BLOCK_SIZE = 128 * Unit.MB;
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/apache/hadoop/fs/CosNCopyFileTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
import java.io.IOException;

public class CosNCopyFileTask implements Runnable {
private static Logger LOG = LoggerFactory.getLogger(CosNCopyFileTask.class);
private static final Logger LOG = LoggerFactory.getLogger(CosNCopyFileTask.class);

private NativeFileSystemStore store;
private final NativeFileSystemStore store;

private String srcKey;
private String dstKey;
private CosNCopyFileContext cosCopyFileContext;
private final String srcKey;
private final String dstKey;
private final CosNCopyFileContext cosCopyFileContext;

public CosNCopyFileTask(NativeFileSystemStore store, String srcKey,
String dstKey,
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/org/apache/hadoop/fs/CosNDeleteFileTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import java.io.IOException;

public class CosNDeleteFileTask implements Runnable {
private static Logger LOG = LoggerFactory.getLogger(CosNCopyFileTask.class);
private static final Logger LOG = LoggerFactory.getLogger(CosNCopyFileTask.class);

private NativeFileSystemStore store;
private final NativeFileSystemStore store;

private String srcKey;
private CosNDeleteFileContext cosDeleteFileContext;
private final String srcKey;
private final CosNDeleteFileContext cosDeleteFileContext;

public CosNDeleteFileTask(NativeFileSystemStore store, String srcKey,
CosNDeleteFileContext cosDeleteFileContext) {
Expand All @@ -24,10 +24,10 @@ public CosNDeleteFileTask(NativeFileSystemStore store, String srcKey,
public void run() {
boolean fail = false;
try {
LOG.debug("Delete the cos key: {}.", srcKey);
this.store.delete(srcKey);
} catch (IOException e) {
LOG.warn("Exception thrown when delete file{}, exception:{}"
, this.srcKey, e);
LOG.warn("Exception thrown when delete file [{}], exception: ", this.srcKey, e);
fail = true;
cosDeleteFileContext.setIOException(e);
} finally {
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/org/apache/hadoop/fs/CosNXAttr.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.apache.hadoop.fs;

import java.io.Serializable;

public class CosNXAttr implements Serializable {
private String name;
private String value;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getValue() {
return value;
}

public void setValue(String value) {
this.value = value;
}
}
Loading

0 comments on commit faac162

Please sign in to comment.