Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
2045713
legacy bucket code
xBis7 Aug 29, 2022
cffd42b
fix Test task with legacy buildOmKeyInfo parameters
xBis7 Aug 29, 2022
5ee5f71
getting only filename from NSSummary.dirname
xBis7 Aug 29, 2022
4b0d90b
trailing slash after dir name in robot test
xBis7 Aug 30, 2022
1605856
cleanup fixing issues
xBis7 Aug 31, 2022
8fe6629
cleanup
xBis7 Sep 1, 2022
e12587e
DirectoryEntityHandler findbugs error fix
xBis7 Sep 2, 2022
8954f5d
smoketest BUCKET_LAYOUT variable
xBis7 Sep 7, 2022
0f8fd74
smoketest bucket layout default value - get key without cache
xBis7 Sep 7, 2022
55a7464
clearing NSSummary table only once for the first NSSummaryTask that runs
xBis7 Sep 13, 2022
e7b1c8f
cleanup
xBis7 Sep 26, 2022
a991395
NSSummaryTask process, reprocess
xBis7 Sep 26, 2022
f064916
NSSummaryTaskUtils
xBis7 Sep 27, 2022
f21a1c4
cleanup
xBis7 Sep 27, 2022
e7721fc
cleanup
xBis7 Sep 30, 2022
a418bb7
NSSummaryTaskUtils -> NSSummaryTaskDbEventHandler
xBis7 Sep 30, 2022
faf145b
legacy reprocess skipping obs keys
xBis7 Sep 30, 2022
78e9817
robot test run with variable - filesystem paths set true
xBis7 Oct 3, 2022
1ff6c70
TestNSSummaryTask
xBis7 Oct 3, 2022
f358d05
NSSummaryTask cleanup
xBis7 Oct 3, 2022
1adac5a
checkstyle errors fixed
xBis7 Oct 3, 2022
ca09bfe
remove filesystem paths from ozonesecure
xBis7 Oct 4, 2022
23b1e45
docker directory for legacy smoketest
xBis7 Oct 4, 2022
2ab563c
simplifying TestNSSummaryTask - checking configuration for legacy tasks
xBis7 Oct 5, 2022
304b847
TestNSSummaryTask OBS bucket
xBis7 Oct 5, 2022
3a763ae
admin namespace summary message fixed
xBis7 Oct 6, 2022
387b1cc
NSSummaryTask reprocess executor service
xBis7 Oct 6, 2022
1f1a9bc
NSSummaryTask reprocess cleanup
xBis7 Oct 6, 2022
34e81f4
BucketHandler cleanup
xBis7 Oct 6, 2022
183bcb3
BucketHandler logic fix
xBis7 Oct 6, 2022
214682e
cleanup
xBis7 Oct 19, 2022
a7f3646
getBucketHandler LOG unsupported bucket layout
xBis7 Oct 20, 2022
9c7bff3
TestNSSummaryAdmin fix
xBis7 Oct 20, 2022
f71b672
enableFileSystemPaths call .getBoolean() instead of getting a string
xBis7 Oct 20, 2022
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 @@ -70,6 +70,19 @@ public boolean isLegacy() {
return this.equals(LEGACY);
}

public boolean isObjectStore(boolean enableFileSystemPaths) {
if (this.equals(OBJECT_STORE)) {
return true;
} else {
// If bucket layout is Legacy and FileSystemPaths
// are disabled, then the bucket operates as OBS.
if (this.equals(LEGACY) && !enableFileSystemPaths) {
return true;
}
return false;
}
}

public boolean shouldNormalizePaths(boolean enableFileSystemPaths) {
switch (this) {
case OBJECT_STORE:
Expand Down
20 changes: 20 additions & 0 deletions hadoop-ozone/dist/src/main/compose/ozone-legacy-bucket/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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.

HDDS_VERSION=${hdds.version}
OZONE_RUNNER_VERSION=${docker.ozone-runner.version}
OZONE_RUNNER_IMAGE=apache/ozone-runner
OZONE_OPTS=
21 changes: 21 additions & 0 deletions hadoop-ozone/dist/src/main/compose/ozone-legacy-bucket/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!---
Licensed 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. See accompanying LICENSE file.
-->

# For Legacy Bucket Operations

For Legacy buckets, set `ozone.om.enable.filesystem.paths` to `true` for them to behave like FSO buckets,
otherwise Legacy buckets act like OBS buckets.

This is the same as `compose/ozone` but for testing operations that need `ozone.om.enable.filesystem.paths`
flag enabled.
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# 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.

version: "3.4"

# reusable fragments (see https://docs.docker.com/compose/compose-file/#extension-fields)
x-common-config:
&common-config
image: ${OZONE_RUNNER_IMAGE}:${OZONE_RUNNER_VERSION}
volumes:
- ../..:/opt/hadoop
env_file:
- docker-config

x-replication:
&replication
OZONE-SITE.XML_ozone.replication: ${OZONE_REPLICATION_FACTOR:-1}

services:
datanode:
<<: *common-config
ports:
- 9864
- 9882
environment:
<<: *replication
OZONE_OPTS:
command: ["ozone","datanode"]
om:
<<: *common-config
environment:
ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION
OZONE_OPTS:
<<: *replication
ports:
- 9874:9874
- 9862:9862
command: ["ozone","om"]
scm:
<<: *common-config
ports:
- 9876:9876
- 9860:9860
environment:
ENSURE_SCM_INITIALIZED: /data/metadata/scm/current/VERSION
OZONE-SITE.XML_hdds.scm.safemode.min.datanode: ${OZONE_SAFEMODE_MIN_DATANODES:-1}
OZONE_OPTS:
<<: *replication
command: ["ozone","scm"]
s3g:
<<: *common-config
environment:
OZONE_OPTS:
<<: *replication
ports:
- 9878:9878
command: ["ozone","s3g"]
recon:
<<: *common-config
ports:
- 9888:9888
environment:
OZONE_OPTS:
<<: *replication
command: ["ozone","recon"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 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.

CORE-SITE.XML_fs.defaultFS=ofs://om
CORE-SITE.XML_fs.trash.interval=1

OZONE-SITE.XML_ozone.om.address=om
OZONE-SITE.XML_ozone.om.enable.filesystem.paths=true
OZONE-SITE.XML_ozone.default.bucket.layout=LEGACY
OZONE-SITE.XML_ozone.om.http-address=om:9874
OZONE-SITE.XML_ozone.scm.http-address=scm:9876
OZONE-SITE.XML_ozone.scm.container.size=1GB
OZONE-SITE.XML_ozone.scm.block.size=1MB
OZONE-SITE.XML_ozone.scm.datanode.ratis.volume.free-space.min=10MB
OZONE-SITE.XML_ozone.scm.pipeline.creation.interval=30s
OZONE-SITE.XML_ozone.scm.pipeline.owner.container.count=1
OZONE-SITE.XML_ozone.scm.names=scm
OZONE-SITE.XML_ozone.scm.datanode.id.dir=/data
OZONE-SITE.XML_ozone.scm.block.client.address=scm
OZONE-SITE.XML_ozone.metadata.dirs=/data/metadata
OZONE-SITE.XML_ozone.recon.db.dir=/data/metadata/recon
OZONE-SITE.XML_ozone.scm.client.address=scm
OZONE-SITE.XML_hdds.datanode.dir=/data/hdds
OZONE-SITE.XML_ozone.recon.address=recon:9891
OZONE-SITE.XML_ozone.recon.http-address=0.0.0.0:9888
OZONE-SITE.XML_ozone.recon.https-address=0.0.0.0:9889
OZONE-SITE.XML_ozone.recon.om.snapshot.task.interval.delay=1m
OZONE-SITE.XML_ozone.datanode.pipeline.limit=1
OZONE-SITE.XML_hdds.scmclient.max.retry.timeout=30s
OZONE-SITE.XML_hdds.container.report.interval=60s
OZONE-SITE.XML_ozone.om.s3.grpc.server_enabled=true
OZONE-SITE.XML_ozone.scm.stale.node.interval=30s
OZONE-SITE.XML_ozone.scm.dead.node.interval=45s
OZONE-SITE.XML_hdds.heartbeat.interval=5s

OZONE_CONF_DIR=/etc/hadoop
OZONE_LOG_DIR=/var/log/hadoop

no_proxy=om,scm,s3g,recon,kdc,localhost,127.0.0.1
35 changes: 35 additions & 0 deletions hadoop-ozone/dist/src/main/compose/ozone-legacy-bucket/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
# 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.

#suite:unsecure

COMPOSE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
export COMPOSE_DIR

export SECURITY_ENABLED=false
export OZONE_REPLICATION_FACTOR=3

# shellcheck source=/dev/null
source "$COMPOSE_DIR/../testlib.sh"

start_docker_env 5

execute_robot_test scm -v BUCKET_LAYOUT:LEGACY recon/recon-nssummary.robot

stop_docker_env

generate_report
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.

*** Settings ***
Documentation Smoke test for Recon Namespace Summary Endpoint for FSO buckets.
Documentation Smoke test for Recon Namespace Summary Endpoint for ${BUCKET_LAYOUT} buckets.
Library OperatingSystem
Library String
Library BuiltIn
Expand All @@ -29,6 +29,7 @@ ${SUMMARY_URL} ${ADMIN_NAMESPACE_URL}/summary
${DISK_USAGE_URL} ${ADMIN_NAMESPACE_URL}/du
${QUOTA_USAGE_URL} ${ADMIN_NAMESPACE_URL}/quota
${FILE_SIZE_DIST_URL} ${ADMIN_NAMESPACE_URL}/dist
${BUCKET_LAYOUT} FILE_SYSTEM_OPTIMIZED
${VOLUME}
${BUCKET}

Expand All @@ -42,7 +43,7 @@ Create volume
Create bucket
${random} = Generate Random String 5 [LOWER]
Set Suite Variable ${BUCKET} buc-${random}
${result} = Execute ozone sh bucket create -l FILE_SYSTEM_OPTIMIZED /${VOLUME}/${BUCKET}
${result} = Execute ozone sh bucket create -l ${BUCKET_LAYOUT} /${VOLUME}/${BUCKET}
Should not contain ${result} Failed

Create keys
Expand Down Expand Up @@ -83,7 +84,7 @@ Check Access
kinit as recon admin
Check http return code ${url} 200

Test Summary
Test Summary
[Arguments] ${url} ${expected}
${result} = Execute curl --negotiate -u : -LSs ${url}
Should contain ${result} \"status\":\"OK\"
Expand Down Expand Up @@ -131,7 +132,8 @@ Check Recon Namespace Summary Key
Wait For Summary ${SUMMARY_URL}?path=/${VOLUME}/${BUCKET}/file1 KEY

Check Recon Namespace Summary Directory
Wait For Summary ${SUMMARY_URL}?path=/${VOLUME}/${BUCKET}/dir1/dir2 DIRECTORY
Run Keyword If '${BUCKET_LAYOUT}' == 'LEGACY' Wait For Summary ${SUMMARY_URL}?path=/${VOLUME}/${BUCKET}/dir1/dir2/ DIRECTORY
Run Keyword If '${BUCKET_LAYOUT}' == 'FILE_SYSTEM_OPTIMIZED' Wait For Summary ${SUMMARY_URL}?path=/${VOLUME}/${BUCKET}/dir1/dir2 DIRECTORY

Check Recon Namespace Disk Usage
Wait For Summary ${DISK_USAGE_URL}?path=/${VOLUME}/${BUCKET}&files=true&replica=true \"sizeWithReplica\"
Expand All @@ -143,4 +145,4 @@ Check Recon Namespace Bucket Quota Usage
Wait For Summary ${QUOTA_USAGE_URL}?path=/${VOLUME}/${BUCKET} \"used\"

Check Recon Namespace File Size Distribution Root
Wait For Summary ${FILE_SIZE_DIST_URL}?path=/ \"dist\"
Wait For Summary ${FILE_SIZE_DIST_URL}?path=/ \"dist\"
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void testNSSummaryCLIRoot() throws UnsupportedEncodingException {
// Should throw warning - only buckets can have bucket layout.
Assert.assertTrue(
getOutContentString().contains(
"[Warning] Namespace CLI is only designed for FSO mode."));
"[Warning] Namespace CLI is not designed for OBS bucket layout."));
Assert.assertTrue(getOutContentString()
.contains("Put more files into it to visualize DU"));
Assert.assertTrue(getOutContentString().contains(
Expand All @@ -128,7 +128,7 @@ public void testNSSummaryCLIFSO() throws UnsupportedEncodingException {
// Should not throw warning, since bucket is in FSO bucket layout.
Assert.assertFalse(
getOutContentString().contains(
"[Warning] Namespace CLI is only designed for FSO mode."));
"[Warning] Namespace CLI is not designed for OBS bucket layout."));
Assert.assertTrue(getOutContentString()
.contains("Put more files into it to visualize DU"));
Assert.assertTrue(getOutContentString().contains(
Expand All @@ -146,7 +146,7 @@ public void testNSSummaryCLIOBS() throws UnsupportedEncodingException {
// Should throw warning, since bucket is in OBS bucket layout.
Assert.assertTrue(
getOutContentString().contains(
"[Warning] Namespace CLI is only designed for FSO mode."));
"[Warning] Namespace CLI is not designed for OBS bucket layout."));
Assert.assertTrue(getOutContentString()
.contains("Put more files into it to visualize DU"));
Assert.assertTrue(getOutContentString().contains(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import org.apache.hadoop.ozone.recon.spi.impl.ReconDBProvider;
import org.apache.hadoop.ozone.recon.spi.impl.ReconNamespaceSummaryManagerImpl;
import org.apache.hadoop.ozone.recon.spi.impl.StorageContainerServiceProviderImpl;
import org.apache.hadoop.ozone.recon.tasks.NSSummaryTaskWithFSO;
import org.apache.hadoop.ozone.recon.tasks.NSSummaryTask;
import org.apache.hadoop.ozone.recon.tasks.ContainerKeyMapperTask;
import org.apache.hadoop.ozone.recon.tasks.FileSizeCountTask;
import org.apache.hadoop.ozone.recon.tasks.TableCountTask;
Expand Down Expand Up @@ -126,7 +126,7 @@ protected void configure() {
taskBinder.addBinding().to(ContainerKeyMapperTask.class);
taskBinder.addBinding().to(FileSizeCountTask.class);
taskBinder.addBinding().to(TableCountTask.class);
taskBinder.addBinding().to(NSSummaryTaskWithFSO.class);
taskBinder.addBinding().to(NSSummaryTask.class);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

import static org.apache.hadoop.ozone.OzoneConsts.OM_KEY_PREFIX;
import static org.apache.hadoop.ozone.om.helpers.OzoneFSUtils.removeTrailingSlashIfNeeded;

Expand Down Expand Up @@ -183,8 +185,24 @@ public static BucketHandler getBucketHandler(
OzoneStorageContainerManager reconSCM,
OmBucketInfo bucketInfo) throws IOException {

return new FSOBucketHandler(reconNamespaceSummaryManager,
omMetadataManager, reconSCM, bucketInfo);
// If bucketInfo is null then entity type is UNKNOWN
if (Objects.isNull(bucketInfo)) {
return null;
} else {
if (bucketInfo.getBucketLayout()
.equals(BucketLayout.FILE_SYSTEM_OPTIMIZED)) {
return new FSOBucketHandler(reconNamespaceSummaryManager,
omMetadataManager, reconSCM, bucketInfo);
} else if (bucketInfo.getBucketLayout()
.equals(BucketLayout.LEGACY)) {
return new LegacyBucketHandler(reconNamespaceSummaryManager,
omMetadataManager, reconSCM, bucketInfo);
} else {
LOG.error("Unsupported bucket layout: " +
bucketInfo.getBucketLayout());
return null;
}
}
}

public static BucketHandler getBucketHandler(
Expand All @@ -197,11 +215,7 @@ public static BucketHandler getBucketHandler(
OmBucketInfo bucketInfo = omMetadataManager
.getBucketTable().getSkipCache(bucketKey);

if (bucketInfo == null) {
return null;
} else {
return getBucketHandler(reconNamespaceSummaryManager,
omMetadataManager, reconSCM, bucketInfo);
}
return getBucketHandler(reconNamespaceSummaryManager,
omMetadataManager, reconSCM, bucketInfo);
}
}
Loading