Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6e4ddd9
TAJO-2069: Implement finding the total size of all objects in a bucke…
blrunner May 16, 2016
a0c7029
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo…
blrunner May 19, 2016
735c773
Use configurations of S3AFileSystem
blrunner May 20, 2016
fe61e40
Remove unnecessary modifications
blrunner May 20, 2016
83bcfca
Remove unnecessary unit tests
blrunner May 20, 2016
dedd49d
Clean up S3TableSpace
blrunner May 20, 2016
c15c000
Remove unused packages
blrunner May 20, 2016
30dd01b
Implement normal unit test cases
blrunner May 24, 2016
5c8d99a
Rmeove unused method
blrunner May 24, 2016
0e7da2c
Clean up pom files
blrunner May 24, 2016
3cd12ac
Remove unnecessary codes
blrunner May 24, 2016
8d47723
Clean up dependencies of s3 module
blrunner May 24, 2016
004d9b1
Remove unnecessary modification
blrunner May 24, 2016
2819df8
Remove unnecessary modifications
blrunner May 24, 2016
4de642a
Add more dependencies
blrunner May 24, 2016
f2c8c63
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo…
blrunner May 25, 2016
d20b1c8
Never use S3Tablespace less than hadoop 2.6.0
blrunner May 25, 2016
6615635
Add exception handling
blrunner May 25, 2016
158cc62
Add ClassNotFoundException handling
blrunner May 25, 2016
aa6375c
Remove NoClassDefFoundError handling codes for AmazonS3
blrunner May 29, 2016
0bbd297
Add NoClassDefFoundError handling codes to S3TableSpace
blrunner May 30, 2016
499a3f5
Add descriptions for FileTablespace::calculateSize
blrunner May 30, 2016
b00c7d7
Borrow credential provides from hadoop
blrunner May 30, 2016
17abec2
Add unit test cases for several prefixes
blrunner May 30, 2016
1258d4b
Add some descriptions for provides
blrunner May 30, 2016
660ca38
Add UnsupportedException to MockAmazonS3 and MockS3FileSystem
blrunner May 30, 2016
5346472
Clean up some codes of S3TableSpace
blrunner May 30, 2016
3728219
Remove httpclient dependency
blrunner May 30, 2016
15e4978
Add httpclient dependency again and remove exception throwing codes
blrunner May 30, 2016
c00332a
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo…
blrunner Aug 29, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tajo-project/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
<jetty.version>6.1.26</jetty.version>
<parquet.version>1.8.1</parquet.version>
<kafka.version>0.10.0.1</kafka.version>
<aws-java-sdk.version>1.7.4</aws-java-sdk.version>
<httpclient.version>4.5</httpclient.version>
<tajo.root>${project.parent.relativePath}/..</tajo.root>
<extra.source.path>src/main/hadoop-${hadoop.version}</extra.source.path>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@ protected void storageInit() throws IOException {
@Override
public long getTableVolume(TableDesc table, Optional<EvalNode> filter) {
Path path = new Path(table.getUri());
ContentSummary summary;
long totalVolume = 0L;
try {
summary = fs.getContentSummary(path);
totalVolume = calculateSize(path);
} catch (IOException e) {
throw new TajoInternalError(e);
}
return summary.getLength();
return totalVolume;
}

@Override
Expand Down Expand Up @@ -246,6 +246,13 @@ public static FileFragment[] splitNG(Configuration conf, String tableName, Table
return tablets;
}

/**
* Calculate the total size of all files in the indicated Path
*
* @param path to use
* @return calculated size
* @throws IOException
*/
public long calculateSize(Path tablePath) throws IOException {
FileSystem fs = tablePath.getFileSystem(conf);
long totalSize = 0;
Expand Down
88 changes: 17 additions & 71 deletions tajo-storage/tajo-storage-s3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,6 @@
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<configuration>
<excludes>
<exclude>src/test/resources/dataset/**</exclude>
<exclude>src/test/resources/queries/**</exclude>
<exclude>src/test/resources/results/**</exclude>
</excludes>
</configuration>
<executions>
<execution>
<phase>verify</phase>
Expand All @@ -89,13 +82,9 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
<artifactId>maven-surefire-report-plugin</artifactId>
</plugin>
</plugins>
</build>
Expand All @@ -116,83 +105,40 @@
<artifactId>tajo-storage-hdfs</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>zookeeper</artifactId>
<groupId>org.apache.zookeeper</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>jersey-json</artifactId>
<groupId>com.sun.jersey</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>commons-el</groupId>
<artifactId>commons-el</artifactId>
</exclusion>
<exclusion>
<groupId>tomcat</groupId>
<artifactId>jasper-runtime</artifactId>
</exclusion>
<exclusion>
<groupId>tomcat</groupId>
<artifactId>jasper-compiler</artifactId>
</exclusion>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-2.1-jetty</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-grizzly2</artifactId>
</exclusion>
<exclusion>
<artifactId>netty-all</artifactId>
<groupId>io.netty</groupId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>${aws-java-sdk.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

<profiles>
<profile>
<!-- Run unit tests in tajo-storage-s3, whereas it is disabled as by default. -->
<id>test-storage-s3</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration combine.self="override">
<systemProperties>
<tajo.test.enabled>TRUE</tajo.test.enabled>
</systemProperties>
<argLine>-Xms128m -Xmx1024m -Dfile.encoding=UTF-8</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>docs</id>
<activation>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.tajo.storage.s3;

import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.AnonymousAWSCredentials;
import com.amazonaws.auth.AWSCredentials;

/**
* Borrow from org.apache.hadoop.fs.s3a.AnonymousAWSCredentialsProvider.
*
*/
public class AnonymousAWSCredentialsProvider implements AWSCredentialsProvider {
public AWSCredentials getCredentials() {
return new AnonymousAWSCredentials();
}

public void refresh() {}

@Override
public String toString() {
return getClass().getSimpleName();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.tajo.storage.s3;

import com.amazonaws.AmazonClientException;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import org.apache.commons.lang.StringUtils;

/**
* Borrow from org.apache.hadoop.fs.s3a.BasicAWSCredentialsProvider.
*
*/
public class BasicAWSCredentialsProvider implements AWSCredentialsProvider {
private final String accessKey;
private final String secretKey;

public BasicAWSCredentialsProvider(String accessKey, String secretKey) {
this.accessKey = accessKey;
this.secretKey = secretKey;
}

public AWSCredentials getCredentials() {
if (!StringUtils.isEmpty(accessKey) && !StringUtils.isEmpty(secretKey)) {
return new BasicAWSCredentials(accessKey, secretKey);
}
throw new AmazonClientException(
"Access key or secret key is null");
}

public void refresh() {}

@Override
public String toString() {
return getClass().getSimpleName();
}

}
Loading