Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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 @@ -95,11 +95,14 @@ private ReconConstants() {
// For file-size count reprocessing: ensure only one task truncates the table.
public static final AtomicBoolean FILE_SIZE_COUNT_TABLE_TRUNCATED = new AtomicBoolean(false);

public static final AtomicBoolean CONTAINER_KEY_TABLES_TRUNCATED = new AtomicBoolean(false);

/**
* Resets the table-truncated flag for the given tables. This should be called once per reprocess cycle,
* for example by the OM task controller, before the tasks run.
*/
public static void resetTableTruncatedFlags() {
FILE_SIZE_COUNT_TABLE_TRUNCATED.set(false);
CONTAINER_KEY_TABLES_TRUNCATED.set(false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
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.ContainerKeyMapperTask;
import org.apache.hadoop.ozone.recon.tasks.FileSizeCountTaskFSO;
import org.apache.hadoop.ozone.recon.tasks.FileSizeCountTaskOBS;
import org.apache.hadoop.ozone.recon.tasks.NSSummaryTask;
Expand Down Expand Up @@ -131,7 +130,6 @@ static class ReconOmTaskBindingModule extends AbstractModule {
protected void configure() {
Multibinder<ReconOmTask> taskBinder =
Multibinder.newSetBinder(binder(), ReconOmTask.class);
taskBinder.addBinding().to(ContainerKeyMapperTask.class);
taskBinder.addBinding().to(FileSizeCountTaskFSO.class);
taskBinder.addBinding().to(FileSizeCountTaskOBS.class);
taskBinder.addBinding().to(OmTableInsightTask.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public final class ReconServerConfigKeys {

public static final String OZONE_RECON_TASK_THREAD_COUNT_KEY =
"ozone.recon.task.thread.count";
public static final int OZONE_RECON_TASK_THREAD_COUNT_DEFAULT = 5;
public static final int OZONE_RECON_TASK_THREAD_COUNT_DEFAULT = 8;

public static final String OZONE_RECON_HTTP_AUTH_CONFIG_PREFIX =
"ozone.recon.http.auth.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static void truncateTable(Table table) throws IOException {
return;
}
try (TableIterator<Object, ? extends KeyValue<Object, Object>>
tableIterator = table.iterator()) {
tableIterator = table.iterator()) {
while (tableIterator.hasNext()) {
KeyValue<Object, Object> entry = tableIterator.next();
table.delete(entry.getKey());
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* 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.hadoop.ozone.recon.tasks;

import com.google.inject.Inject;
import java.util.Map;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.ozone.om.OMMetadataManager;
import org.apache.hadoop.ozone.om.helpers.BucketLayout;
import org.apache.hadoop.ozone.recon.ReconServerConfigKeys;
import org.apache.hadoop.ozone.recon.spi.ReconContainerMetadataManager;

/**
* Task for processing ContainerKey mapping specifically for FSO buckets.
*/
public class ContainerKeyMapperTaskFSO implements ReconOmTask {

private final ReconContainerMetadataManager reconContainerMetadataManager;
private final OzoneConfiguration ozoneConfiguration;

@Inject
public ContainerKeyMapperTaskFSO(ReconContainerMetadataManager reconContainerMetadataManager,
OzoneConfiguration configuration) {
this.reconContainerMetadataManager = reconContainerMetadataManager;
this.ozoneConfiguration = configuration;
}

@Override
public TaskResult reprocess(OMMetadataManager omMetadataManager) {
long containerKeyFlushToDBMaxThreshold = ozoneConfiguration.getLong(
ReconServerConfigKeys.OZONE_RECON_CONTAINER_KEY_FLUSH_TO_DB_MAX_THRESHOLD,
ReconServerConfigKeys.OZONE_RECON_CONTAINER_KEY_FLUSH_TO_DB_MAX_THRESHOLD_DEFAULT);
boolean result = ContainerKeyMapperHelper.reprocess(
omMetadataManager, reconContainerMetadataManager,
BucketLayout.FILE_SYSTEM_OPTIMIZED, getTaskName(), containerKeyFlushToDBMaxThreshold);
return buildTaskResult(result);
}

@Override
public String getTaskName() {
return "ContainerKeyMapperTaskFSO";
}

@Override
public TaskResult process(OMUpdateEventBatch events, Map<String, Integer> subTaskSeekPosMap) {
boolean result =
ContainerKeyMapperHelper.process(events, "fileTable", reconContainerMetadataManager, getTaskName());
return buildTaskResult(result);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* 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.hadoop.ozone.recon.tasks;

import com.google.inject.Inject;
import java.util.Map;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.ozone.om.OMMetadataManager;
import org.apache.hadoop.ozone.om.helpers.BucketLayout;
import org.apache.hadoop.ozone.recon.ReconServerConfigKeys;
import org.apache.hadoop.ozone.recon.spi.ReconContainerMetadataManager;

/**
* Task for processing ContainerKey mapping specifically for OBS buckets.
*/
public class ContainerKeyMapperTaskOBS implements ReconOmTask {

private final ReconContainerMetadataManager reconContainerMetadataManager;
private final OzoneConfiguration ozoneConfiguration;

@Inject
public ContainerKeyMapperTaskOBS(ReconContainerMetadataManager reconContainerMetadataManager,
OzoneConfiguration configuration) {
this.reconContainerMetadataManager = reconContainerMetadataManager;
this.ozoneConfiguration = configuration;
}

@Override
public TaskResult reprocess(OMMetadataManager omMetadataManager) {
long containerKeyFlushToDBMaxThreshold = ozoneConfiguration.getLong(
ReconServerConfigKeys.OZONE_RECON_CONTAINER_KEY_FLUSH_TO_DB_MAX_THRESHOLD,
ReconServerConfigKeys.OZONE_RECON_CONTAINER_KEY_FLUSH_TO_DB_MAX_THRESHOLD_DEFAULT);
boolean result = ContainerKeyMapperHelper.reprocess(
omMetadataManager, reconContainerMetadataManager, BucketLayout.OBJECT_STORE, getTaskName(),
containerKeyFlushToDBMaxThreshold);
return buildTaskResult(result);
}

@Override
public String getTaskName() {
return "ContainerKeyMapperTaskOBS";
}

@Override
public TaskResult process(OMUpdateEventBatch events, Map<String, Integer> subTaskSeekPosMap) {
boolean result = ContainerKeyMapperHelper.process(events, "keyTable", reconContainerMetadataManager, getTaskName());
return buildTaskResult(result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@
import org.apache.hadoop.ozone.recon.spi.StorageContainerServiceProvider;
import org.apache.hadoop.ozone.recon.spi.impl.OzoneManagerServiceProviderImpl;
import org.apache.hadoop.ozone.recon.spi.impl.StorageContainerServiceProviderImpl;
import org.apache.hadoop.ozone.recon.tasks.ContainerKeyMapperTask;
import org.apache.hadoop.ozone.recon.tasks.ContainerKeyMapperTaskFSO;
import org.apache.hadoop.ozone.recon.tasks.ContainerKeyMapperTaskOBS;
import org.apache.hadoop.ozone.recon.tasks.NSSummaryTaskWithFSO;
import org.apache.ozone.recon.schema.ContainerSchemaDefinition.UnHealthyContainerStates;
import org.apache.ozone.recon.schema.generated.tables.pojos.UnhealthyContainers;
Expand Down Expand Up @@ -297,10 +298,13 @@ public void setUp() throws Exception {
}

private void reprocessContainerKeyMapper() {
ContainerKeyMapperTask containerKeyMapperTask =
new ContainerKeyMapperTask(reconContainerMetadataManager,
omConfiguration);
containerKeyMapperTask.reprocess(reconOMMetadataManager);
ContainerKeyMapperTaskOBS containerKeyMapperTaskOBS =
new ContainerKeyMapperTaskOBS(reconContainerMetadataManager, omConfiguration);
containerKeyMapperTaskOBS.reprocess(reconOMMetadataManager);

ContainerKeyMapperTaskFSO containerKeyMapperTaskFSO =
new ContainerKeyMapperTaskFSO(reconContainerMetadataManager, omConfiguration);
containerKeyMapperTaskFSO.reprocess(reconOMMetadataManager);
}

private void setUpFSOData() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
import org.apache.hadoop.ozone.recon.spi.StorageContainerServiceProvider;
import org.apache.hadoop.ozone.recon.spi.impl.OzoneManagerServiceProviderImpl;
import org.apache.hadoop.ozone.recon.spi.impl.StorageContainerServiceProviderImpl;
import org.apache.hadoop.ozone.recon.tasks.ContainerKeyMapperTask;
import org.apache.hadoop.ozone.recon.tasks.ContainerKeyMapperTaskOBS;
import org.apache.hadoop.ozone.recon.tasks.NSSummaryTaskWithFSO;
import org.apache.hadoop.ozone.recon.tasks.NSSummaryTaskWithLegacy;
import org.apache.hadoop.ozone.recon.tasks.NSSummaryTaskWithOBS;
Expand Down Expand Up @@ -387,8 +387,8 @@ private void setUpOmData() throws Exception {
when(tableMock.getName()).thenReturn("KeyTable");
when(omMetadataManagerMock.getKeyTable(getBucketLayout()))
.thenReturn(tableMock);
ContainerKeyMapperTask containerKeyMapperTask =
new ContainerKeyMapperTask(reconContainerMetadataManager,
ContainerKeyMapperTaskOBS containerKeyMapperTask =
new ContainerKeyMapperTaskOBS(reconContainerMetadataManager,
ozoneConfiguration);
containerKeyMapperTask.reprocess(reconOMMetadataManager);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ public void testKeyTableReprocess() throws Exception {
VOLUME_NAME,
Collections.singletonList(omKeyLocationInfoGroup));

ContainerKeyMapperTask containerKeyMapperTask =
new ContainerKeyMapperTask(reconContainerMetadataManager,
ContainerKeyMapperTaskOBS containerKeyMapperTaskOBS =
new ContainerKeyMapperTaskOBS(reconContainerMetadataManager,
omConfiguration);
containerKeyMapperTask.reprocess(reconOMMetadataManager);
containerKeyMapperTaskOBS.reprocess(reconOMMetadataManager);

keyPrefixesForContainer =
reconContainerMetadataManager.getKeyPrefixesForContainer(1);
Expand Down Expand Up @@ -205,10 +205,10 @@ public void testFileTableReprocess() throws Exception {
KEY_ONE_SIZE);

// Reprocess container key mappings
ContainerKeyMapperTask containerKeyMapperTask =
new ContainerKeyMapperTask(reconContainerMetadataManager,
ContainerKeyMapperTaskFSO containerKeyMapperTaskFSO =
new ContainerKeyMapperTaskFSO(reconContainerMetadataManager,
omConfiguration);
containerKeyMapperTask.reprocess(reconOMMetadataManager);
containerKeyMapperTaskFSO.reprocess(reconOMMetadataManager);

// Check the key prefixes for container 1
keyPrefixesForContainer =
Expand Down Expand Up @@ -314,10 +314,10 @@ public void testKeyTableProcess() throws IOException {
add(keyEvent2);
}}, 0L);

ContainerKeyMapperTask containerKeyMapperTask =
new ContainerKeyMapperTask(reconContainerMetadataManager,
ContainerKeyMapperTaskOBS containerKeyMapperTaskOBS =
new ContainerKeyMapperTaskOBS(reconContainerMetadataManager,
omConfiguration);
containerKeyMapperTask.reprocess(reconOMMetadataManager);
containerKeyMapperTaskOBS.reprocess(reconOMMetadataManager);

keyPrefixesForContainer = reconContainerMetadataManager
.getKeyPrefixesForContainer(1);
Expand All @@ -336,7 +336,7 @@ public void testKeyTableProcess() throws IOException {
assertEquals(1, reconContainerMetadataManager.getKeyCountForContainer(3L));

// Process PUT & DELETE event.
containerKeyMapperTask.process(omUpdateEventBatch, Collections.emptyMap());
containerKeyMapperTaskOBS.process(omUpdateEventBatch, Collections.emptyMap());

keyPrefixesForContainer = reconContainerMetadataManager
.getKeyPrefixesForContainer(1);
Expand Down Expand Up @@ -384,8 +384,8 @@ public void testFileTableProcess() throws Exception {
new OmKeyLocationInfoGroup(0L, omKeyLocationInfoList);

// Reprocess container key mappings
ContainerKeyMapperTask containerKeyMapperTask =
new ContainerKeyMapperTask(reconContainerMetadataManager,
ContainerKeyMapperTaskFSO containerKeyMapperTaskFSO =
new ContainerKeyMapperTaskFSO(reconContainerMetadataManager,
omConfiguration);

String bucket = BUCKET_NAME;
Expand Down Expand Up @@ -427,7 +427,7 @@ public void testFileTableProcess() throws Exception {
}, 0L);

// Process PUT event for both the keys
containerKeyMapperTask.process(omUpdateEventBatch, Collections.emptyMap());
containerKeyMapperTaskFSO.process(omUpdateEventBatch, Collections.emptyMap());

keyPrefixesForContainer = reconContainerMetadataManager
.getKeyPrefixesForContainer(1);
Expand Down Expand Up @@ -460,7 +460,7 @@ public void testFileTableProcess() throws Exception {
}, 0L);

// Process DELETE event for key2
containerKeyMapperTask.process(omUpdateEventBatch2, Collections.emptyMap());
containerKeyMapperTaskFSO.process(omUpdateEventBatch2, Collections.emptyMap());

keyPrefixesForContainer = reconContainerMetadataManager
.getKeyPrefixesForContainer(1);
Expand Down
Loading