Skip to content

Commit

Permalink
fix gateway mode to process posix bucket (#62)
Browse files Browse the repository at this point in the history
Co-authored-by: alantong(佟明达) <[email protected]>
  • Loading branch information
vintmd and vintmd authored Jun 14, 2022
1 parent 856800d commit 1fcb761
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 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>8.1.2</version>
<version>8.1.3</version>
<packaging>jar</packaging>

<name>Apache Hadoop Tencent Cloud COS Support</name>
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/apache/hadoop/fs/CosFileSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public void initialize(URI uri, Configuration conf) throws IOException {
this.nativeStore.close();
this.nativeStore = null;
} else if (this.actualImplFS instanceof CosNFileSystem) {
this.nativeStore.isPosixBucket(true);
((CosNFileSystem) this.actualImplFS).withStore(this.nativeStore).withBucket(bucket)
.withPosixBucket(isPosixFSStore).withRangerCredentialsClient(rangerCredentialsClient);
} else {
Expand All @@ -132,6 +133,7 @@ public void initialize(URI uri, Configuration conf) throws IOException {
}
} else { // normal cos hadoop file system implements
this.actualImplFS = getActualFileSystemByClassName("org.apache.hadoop.fs.CosNFileSystem");
this.nativeStore.isPosixBucket(false);
((CosNFileSystem) this.actualImplFS).withStore(this.nativeStore).withBucket(bucket)
.withPosixBucket(this.isPosixFSStore).withRangerCredentialsClient(rangerCredentialsClient);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/hadoop/fs/CosNConfigKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,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-v8.1.2";
public static final String DEFAULT_USER_AGENT = "cos-hadoop-plugin-v8.1.3";

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,11 @@ public void close() {
this.cosClient = null;
}

@Override
public void isPosixBucket(boolean isPosixBucket) {
this.isPosixBucket = isPosixBucket;
}

// process Exception and print detail
private void handleException(Exception e, String key) throws IOException {
String cosPath = "cosn://" + bucketName + key;
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/org/apache/hadoop/fs/NativeFileSystemStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,12 @@ CosNPartialListing list(String prefix, int maxListingLength,
*/
void dump() throws IOException;

/**
* Used for outer to decide inner process.
* if you use the CosNFileSystem gateway mode,
* must set native store to posix process
*/
void isPosixBucket(boolean isPosixBucket);

void close();
}

0 comments on commit 1fcb761

Please sign in to comment.