Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
c5116f8
Add internal ozones3 python client and sample config.
timmylicheng Dec 11, 2019
eff899a
[Tencent] Fix timeout threshold is too small to exit safemode when se…
runzhiwang Dec 29, 2019
5f5af8b
[Tencent] Stats for metadata.
timmylicheng Mar 6, 2020
116222d
change ip to 0.0.0.0
runzhiwang Apr 22, 2020
961d9ad
Revert 'change ip to 0.0.0.0'
May 15, 2020
043c4c1
fix Acceptance Tests in landun for branch master
May 14, 2020
31f1a7a
default width of docker-compose terminal output is too narrow (80)
May 18, 2020
ad65b7d
fix conflict in OzoneManager.java
Jun 8, 2020
453a885
Revert "[Tencent] Stats for metadata."
Jul 2, 2020
21d32f1
Merge branch 'github/master' at 57a8388
Jul 2, 2020
22ff24a
[tencent] make npm avoid proxy config in maven
Jul 2, 2020
e7f6d52
1) merge GitHub/master to Jun 15
Jul 2, 2020
91f5649
Merge branch github/master to f6e3ff at Jul 2
Jul 2, 2020
7a116ea
Merge branch github/master to f6e3ff at Jul 2
Jul 2, 2020
e1a68f2
Merge remote-tracking branch 'github/master'
runzhiwang Jul 3, 2020
d0b0b53
Merge remote-tracking branch 'github/master'
runzhiwang Jul 5, 2020
78bc9b2
Merge remote-tracking branch 'github/master'
runzhiwang Jul 7, 2020
7d179a7
Merge remote-tracking branch 'github/master'
runzhiwang Jul 8, 2020
6137b3f
Merge remote-tracking branch 'github/master'
runzhiwang Jul 9, 2020
1188e57
Merge remote-tracking branch 'github/master'
runzhiwang Jul 10, 2020
e0c390e
Merge remote-tracking branch 'github/master'
runzhiwang Jul 11, 2020
dac7631
Merge remote-tracking branch 'github/master'
runzhiwang Jul 14, 2020
7a124ce
Merge remote-tracking branch 'github/master'
runzhiwang Jul 15, 2020
8aa1486
Merge remote-tracking branch 'github/master'
runzhiwang Jul 17, 2020
6085517
HDDS-3995. Fix s3g met NPE exception while write file by multiPartUpl…
maobaolong Jul 21, 2020
ee9750e
merge github/master
runzhiwang Jul 27, 2020
267d88d
TENCENT. fix failed ci
runzhiwang Jul 27, 2020
84c5e5e
'merge-github-master' into 'master' (merge request !41)
runzhiwang Jul 28, 2020
d08b1c4
Merge remote-tracking branch 'github/master'
runzhiwang Aug 10, 2020
d1b5483
Merge remote-tracking branch 'github/master'
runzhiwang Aug 12, 2020
c3bd027
Merge remote-tracking branch 'github/master'
runzhiwang Aug 13, 2020
cb786b7
Merge remote-tracking branch 'github/master'
runzhiwang Aug 15, 2020
dbc85f5
Merge remote-tracking branch 'github/master'
runzhiwang Aug 21, 2020
f3107fa
Merge remote-tracking branch 'github/master'
runzhiwang Aug 31, 2020
ffa3807
Merge remote-tracking branch 'github/master'
runzhiwang Sep 2, 2020
dc415b4
Merge remote-tracking branch 'github/master'
runzhiwang Sep 3, 2020
fe2520d
Merge remote-tracking branch 'github/master'
runzhiwang Sep 29, 2020
2fec8c0
Merge remote-tracking branch 'github/master'
runzhiwang Sep 29, 2020
4114aad
Merge remote-tracking branch 'github/master'
runzhiwang Sep 30, 2020
310dd39
Merge remote-tracking branch 'github/master'
runzhiwang Oct 1, 2020
aa14d80
Merge remote-tracking branch 'github/master'
runzhiwang Oct 2, 2020
d278411
Merge remote-tracking branch 'github/master'
runzhiwang Oct 4, 2020
9211a97
Merge remote-tracking branch 'github/master'
runzhiwang Oct 9, 2020
efa0d7e
Merge remote-tracking branch 'github/master'
runzhiwang Oct 10, 2020
cbfa2d7
Merge remote-tracking branch 'github/master'
runzhiwang Oct 13, 2020
b28c68a
Merge remote-tracking branch 'github/master'
runzhiwang Oct 14, 2020
d4ef49e
replace close method to avoid swallow the exception
maobaolong Oct 14, 2020
e92c16e
Add the missing line
maobaolong Oct 14, 2020
7009722
Merge branch 'master' of git.code.oa.com:DataLake/hadoop-ozone into H…
maobaolong Oct 14, 2020
342d654
Merge branch 'HDDS-3995' of https://github.com/maobaolong/hadoop-ozon…
maobaolong Oct 14, 2020
a6fe6fa
fix findbugs issue.
maobaolong Oct 14, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@ JSVC_HOME=/usr/bin
SLEEP_SECONDS=5
KERBEROS_ENABLED=true

no_proxy=om,scm,recon,s3g,kdc,localhost,127.0.0.1
no_proxy=om,scm,recon,s3g,recon,kdc,localhost,127.0.0.1
11 changes: 9 additions & 2 deletions hadoop-ozone/dist/src/main/compose/testlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,14 @@ wait_for_safemode_exit(){

#Reset the timer
SECONDS=0
timeout_threshold=240
if [[ "${SECURITY_ENABLED}" == 'true' ]]; then
timeout_threshold=600
fi

#Don't give it up until timeout
while [[ $SECONDS -lt $timeout_threshold ]]; do

#Don't give it up until 240 seconds
while [[ $SECONDS -lt 240 ]]; do

#This line checks the safemode status in scm
local command="${OZONE_SAFEMODE_STATUS_COMMAND}"
Expand Down Expand Up @@ -141,6 +146,8 @@ execute_robot_test(){
&& docker-compose exec -T "$CONTAINER" robot -v OM_SERVICE_ID:"${OM_SERVICE_ID}" -v SECURITY_ENABLED:"${SECURITY_ENABLED}" -v OM_HA_PARAM:"${OM_HA_PARAM}" -v KEY_NAME:"${OZONE_BUCKET_KEY_NAME}" ${ARGUMENTS[@]} --log NONE --report NONE "${OZONE_ROBOT_OPTS[@]}" --output "$OUTPUT_PATH" "$SMOKETEST_DIR_INSIDE/$TEST"
local -i rc=$?


export COLUMNS=500 #defaul width of docker-compose terminal output is too narrow(80)
FULL_CONTAINER_NAME=$(docker-compose ps | grep "_${CONTAINER}_" | head -n 1 | awk '{print $1}')
docker cp "$FULL_CONTAINER_NAME:$OUTPUT_PATH" "$RESULT_DIR/"

Expand Down
2 changes: 2 additions & 0 deletions hadoop-ozone/dist/src/main/compose/upgrade/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export COMPOSE_DIR
export OZONE_VOLUME

mkdir -p "${OZONE_VOLUME}"/{dn1,dn2,dn3,om,recon,s3g,scm}
mkdir -p "${OZONE_VOLUME}/debug"
chmod -R 777 "${OZONE_VOLUME}"/{dn1,dn2,dn3,om,recon,s3g,scm,debug}

if [[ -n "${OZONE_VOLUME_OWNER}" ]]; then
current_user=$(whoami)
Expand Down
3 changes: 3 additions & 0 deletions hadoop-ozone/recon/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
</goals>
<configuration>
<arguments>pnpm config set store-dir ~/.pnpm-store</arguments>
<npmInheritsProxyConfigFromMaven>false</npmInheritsProxyConfigFromMaven>
</configuration>
</execution>
<execution>
Expand All @@ -119,6 +120,7 @@
</goals>
<configuration>
<arguments>pnpm install</arguments>
<npmInheritsProxyConfigFromMaven>false</npmInheritsProxyConfigFromMaven>
</configuration>
</execution>
<execution>
Expand All @@ -128,6 +130,7 @@
</goals>
<configuration>
<arguments>pnpm run build</arguments>
<npmInheritsProxyConfigFromMaven>false</npmInheritsProxyConfigFromMaven>
</configuration>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,11 @@ private Response createMultipartKey(String bucket, String key, long length,
IOUtils.copy(body, ozoneOutputStream);
}
} finally {
IOUtils.closeQuietly(ozoneOutputStream);
if (ozoneOutputStream != null) {
ozoneOutputStream.close();
} else {
throw S3ErrorTable.newError(NO_SUCH_UPLOAD, uploadID);
}
}

OmMultipartCommitUploadPartInfo omMultipartCommitUploadPartInfo =
Expand All @@ -611,7 +615,6 @@ private Response createMultipartKey(String bucket, String key, long length,
return Response.ok().header("ETag",
eTag).build();
}

} catch (OMException ex) {
if (ex.getResult() == ResultCodes.NO_SUCH_MULTIPART_UPLOAD_ERROR) {
throw S3ErrorTable.newError(NO_SUCH_UPLOAD,
Expand Down
89 changes: 89 additions & 0 deletions tencent/python-client/OzoneS3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import boto3
from botocore.config import Config
from botocore.exceptions import ClientError
import xml.etree.ElementTree as ET
from itertools import izip_longest
from random import randrange

# Ozone doesn't care access key and secret key in non-SafeMode
AWS_ACCESS_KEY_ID = '12345678'
AWS_SECRET_ACCESS_KEY = '12345678'

# Ozone S3 gateway endpoints
root = ET.parse('ozone_idex_config.xml').getroot()
endpoints = root.findall('property/entry')
SERVER_LIST = []
for endpoint in endpoints:
SERVER_LIST.append(endpoint.get('ozone.s3g.endpoint'))
#endpoint = 'http://localhost:9878'

# Ozone S3 bucket name
bucket_name = 'idex_bucket'

def round_robin(cur = [0]):
length = len(SERVER_LIST)
ret = SERVER_LIST[cur[0] % length]
cur[0] = (cur[0] + 1) % length
return ret

def s3_resource():
session = boto3.session.Session(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
endpoint = round_robin([randrange(len(SERVER_LIST))])
s3 = session.resource(service_name='s3', endpoint_url=endpoint)
print("current endpoint: " + endpoint)
return s3

class OzoneS3:
@staticmethod
def upload_file(file_path):
try:
s3_resource().Bucket(bucket_name).upload_file(file_path, file_path)
except Exception as e:
print("retry one time. exception: " + str(e))
s3_resource().Bucket(bucket_name).upload_file(file_path, file_path)


@staticmethod
def upload_stream(key, byte_stream):
try:
s3_resource().Object(bucket_name, key).put(Body=byte_stream)
except Exception as e:
s3_resource().Object(bucket_name, key).put(Body=byte_stream)

@staticmethod
def download_file(key, output_file_path):
try:
s3_resource().Bucket(bucket_name).download_file(key, output_file_path)
except Exception as e:
s3_resource().Bucket(bucket_name).download_file(key, output_file_path)

@staticmethod
def download_stream(key):
try:
obj = s3_resource().Object(bucket_name, key)
return obj.get()['Body'].read()
except Exception as e:
obj = s3_resource().Object(bucket_name, key)
return obj.get()['Body'].read()

@staticmethod
def iter_n(iterable, n, fillvalue=None):
args = [iter(iterable)] * n
Copy link
Contributor

@bharatviswa504 bharatviswa504 Oct 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these changes related to this PR? It has files named under directory Tencent.

return izip_longest(*args, fillvalue=fillvalue)

@staticmethod
def download_stream_iter(key):
try:
obj = s3_resource().Object(bucket_name, key)
return obj.get()['Body']
except Exception as e:
obj = s3_resource().Object(bucket_name, key)
return obj.get()['Body']

@staticmethod
def delete(key):
try:
s3_resource().Object(bucket_name, key).delete()
except Exception as e:
s3_resource().Object(bucket_name, key).delete()

6 changes: 6 additions & 0 deletions tencent/python-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Python interface for ozone thru s3 gateway.

In order to use this OzoneS3.py, make sure python3 is installed in your env. Then put s3 gateway endpoint in ozone_client_confg.xml.
If you have multiple s3 gateway endpoint, put separate entries in ozone_client_config.xml. OzoneS3.py will randomly pick one.

Bucket is hardcoded in OzoneS3.py. In terms of s3 gateway of Ozone, please refer to https://hadoop.apache.org/ozone/docs/0.4.0-alpha/s3.html .
7 changes: 7 additions & 0 deletions tencent/python-client/ozone_client_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ozone_config>
<property>
<entry ozone.s3g.endpoint='http://localhost:9878'/>
<entry ozone.s3g.endpoint='http://127.0.0.1:9878'/>
</property>
</ozone_config>