Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions dev-support/pmd/pmd-ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@
PMD Ruleset for Apache Ozone
</description>

<rule ref="category/java/bestpractices.xml/MissingOverride" />

<exclude-pattern>.*/generated-sources/.*</exclude-pattern>
</ruleset>
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public BlockInputStreamFactoryImpl(ByteBufferPool byteBufferPool,
* @param refreshFunction Function to refresh the pipeline if needed
* @return BlockExtendedInputStream of the correct type.
*/
@Override
public BlockExtendedInputStream create(ReplicationConfig repConfig,
BlockLocationInfo blockInfo, Pipeline pipeline,
Token<OzoneBlockTokenIdentifier> token,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ private ECBlockInputStreamFactoryImpl(BlockInputStreamFactory streamFactory,
* @param refreshFunction Function to refresh the pipeline if needed
* @return BlockExtendedInputStream of the correct type.
*/
@Override
public BlockExtendedInputStream create(boolean missingLocations,
List<DatanodeDetails> failedLocations, ReplicationConfig repConfig,
BlockLocationInfo blockInfo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ Node getLeaf(int leafIndex, List<String> excludedScopes,
@Override
HddsProtos.NetworkNode toProtobuf(int clientVersion);

@Override
boolean equals(Object o);

@Override
int hashCode();

static InnerNode fromProtobuf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ public interface ChecksumByteBuffer extends Checksum {
* Upon return, the buffer's position will be equal to its limit.
*
* @param buffer the bytes to update the checksum with
*
* @apiNote {@link Override} annotation is missing since {@link Checksum#update(ByteBuffer)} introduced only in Java9.
* TODO: Remove when Java 1.8 support is dropped.
* TODO: <a href="https://issues.apache.org/jira/browse/HDDS-12366">HDDS-12366</a>
*/
@SuppressWarnings("PMD.MissingOverride")
void update(ByteBuffer buffer);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ default boolean hasRemaining() {
/** Similar to {@link ByteBuffer#clear()}. */
ChunkBuffer clear();

@Override
default void close() {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ public interface BootstrapStateHandler {
/** Bootstrap state handler lock implementation. */
class Lock implements AutoCloseable {
private final Semaphore semaphore = new Semaphore(1);

public Lock lock() throws InterruptedException {
semaphore.acquire();
return this;
}
public void unlock() {
semaphore.release();
}

@Override
public void close() {
unlock();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public void decrementReference() {
}
}

@Override
public boolean cleanup() {
if (getStore() != null && getStore().isClosed()
|| referenceCount.get() == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public Builder getThis() {
return this;
}

@Override
public DbVolume build() throws IOException {
return new DbVolume(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public Builder getThis() {
return this;
}

@Override
public HddsVolume build() throws IOException {
return new HddsVolume(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public Builder getThis() {
return this;
}

@Override
public MetadataVolume build() throws IOException {
return new MetadataVolume(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public enum Mode {
this.name = name;
}

@Override
public String toString() {
return name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1378,11 +1378,13 @@ public void deleteUnreferenced(Container container, long localID)
}
}

@Override
public void addFinalizedBlock(Container container, long localID) {
KeyValueContainer keyValueContainer = (KeyValueContainer)container;
keyValueContainer.getContainerData().addToFinalizedBlockSet(localID);
}

@Override
public boolean isFinalizedBlockExist(Container container, long localID) {
KeyValueContainer keyValueContainer = (KeyValueContainer)container;
return keyValueContainer.getContainerData().isFinalizedBlockExist(localID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public void writeChunk(Container container, BlockID blockID, ChunkInfo info,
.writeChunk(container, blockID, info, data, dispatcherContext);
}

@Override
public String streamInit(Container container, BlockID blockID)
throws StorageContainerException {
return selectHandler(container)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ protected AbstractRDBStore(DEF dbDef, ConfigurationSource config, boolean openRe
start(config);
}

@Override
public void start(ConfigurationSource config)
throws IOException {
if (this.store == null) {
Expand All @@ -81,41 +82,49 @@ public void start(ConfigurationSource config)
protected abstract DBStore initDBStore(DBStoreBuilder dbStoreBuilder, ManagedDBOptions options,
ConfigurationSource config) throws IOException;

@Override
public synchronized void stop() throws Exception {
if (store != null) {
store.close();
store = null;
}
}

@Override
public DBStore getStore() {
return this.store;
}

@Override
public synchronized boolean isClosed() {
if (this.store == null) {
return true;
}
return this.store.isClosed();
}

@Override
public BatchOperationHandler getBatchHandler() {
return this.store;
}

@Override
public void close() throws IOException {
this.store.close();
this.cfOptions.close();
}

@Override
public void flushDB() throws IOException {
store.flushDB();
}

@Override
public void flushLog(boolean sync) throws IOException {
store.flushLog(sync);
}

@Override
public void compactDB() throws IOException {
store.compactDB();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public DBColumnFamilyDefinition<String, Long> getMetadataColumnFamily() {
return DELETE_TRANSACTION;
}

@Override
public DBColumnFamilyDefinition<String, Long> getFinalizeBlocksColumnFamily() {
return FINALIZE_BLOCKS;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ public static File getDumpDir(File metaDir) {
return new File(metaDir, DUMP_DIR);
}

@Override
public void compactionIfNeeded() throws Exception {
// Calculate number of files per level and size per level
RocksDatabase rocksDB = ((RDBStore)getStore()).getDb();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ private static boolean shouldAppendLastChunk(boolean endOfBlock,
return isFullChunk(data.getChunks().get(data.getChunks().size() - 1));
}

@Override
public void putBlockByID(BatchOperation batch, boolean incremental,
long localID, BlockData data, KeyValueContainerData containerData,
boolean endOfBlock) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class CopyContainerResponseStream
super(streamObserver, containerId, bufferSize);
}

@Override
protected void sendPart(boolean eof, int length, ByteString data) {
CopyContainerResponseProto response =
CopyContainerResponseProto.newBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public int hashCode() {
return Objects.hash(getContainerId(), getTarget());
}

@Override
public long getContainerId() {
return cmd.getContainerID();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public XORRawEncoder(ECReplicationConfig ecReplicationConfig) {
super(ecReplicationConfig);
}

@Override
protected void doEncode(ByteBufferEncodingState encodingState) {
CoderUtil.resetOutputBuffers(encodingState.outputs,
encodingState.encodeLength);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ public String getSCMCertificate(ScmNodeDetailsProto scmNodeDetails,
* @return String - pem encoded SCM signed
* certificate.
*/
@Override
public String getSCMCertificate(ScmNodeDetailsProto scmNodeDetails,
String certSignReq, boolean renew) throws IOException {
return getSCMCertChain(scmNodeDetails, certSignReq, renew)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,7 @@ public StatusAndMessages queryUpgradeFinalizationProgress(
status.getMessagesList());
}

@Override
public Token<?> getContainerToken(
ContainerID containerID) throws IOException {
GetContainerTokenRequestProto request =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ private OzoneSecretKey updateCurrentKey(KeyPair keyPair,
return newKey;
}

@Override
public void notifyCertificateRenewed(CertificateClient client,
String oldCertId, String newCertId) {
if (!oldCertId.equals(getCertSerialId())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,7 @@ public Logger getLogger() {
return logger;
}

@Override
public String getComponentName() {
return component;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public SCMCertificateClient(
*
* @return CertificateSignRequest.Builder
*/
@Override
public CertificateSignRequest.Builder configureCSRBuilder()
throws SCMSecurityException {
String subject = SCM_SUB_CA_PREFIX + scmHostname;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,12 @@ public long droppedEvents() {
return dropped.value();
}

@Override
public long longWaitInQueueEvents() {
return longWaitInQueue.value();
}

@Override
public long longTimeExecutionEvents() {
return longTimeExecution.value();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ public interface DumpFileLoader extends Closeable {
/**
* Close this file loader.
*/
@Override
void close();
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public BasicUpgradeFinalizer(V versionManager,
this.finalizationLock = new ReentrantLock();
}

@Override
public StatusAndMessages finalize(String upgradeClientID, T service)
throws IOException {
// In some components, finalization can be driven asynchronously by a
Expand Down Expand Up @@ -114,6 +115,7 @@ public StatusAndMessages finalize(String upgradeClientID, T service)
}
}

@Override
public synchronized StatusAndMessages reportStatus(
String upgradeClientID, boolean takeover) throws UpgradeException {
if (takeover) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class DefaultUpgradeFinalizationExecutor<T>
public DefaultUpgradeFinalizationExecutor() {
}

@Override
public void execute(T component, BasicUpgradeFinalizer<T, ?> finalizer)
throws IOException {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,7 @@ public String getMetadataDir() {

static class NodeComparator
implements Comparator<CompactionNode>, Serializable {
@Override
public int compare(CompactionNode a, CompactionNode b) {
return a.getFileName().compareToIgnoreCase(b.getFileName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public DeletedBlockLogStateManagerImpl(ConfigurationSource conf,
isRatisEnabled ? ConcurrentHashMap.newKeySet() : null;
}

@Override
public TableIterator<Long, TypedTable.KeyValue<Long,
DeletedBlocksTransaction>> getReadOnlyIterator() throws IOException {
return new TableIterator<Long, TypedTable.KeyValue<Long,
Expand Down Expand Up @@ -238,6 +239,7 @@ public int resetRetryCountOfTransactionInDB(ArrayList<Long> txIDs)
return resetCount;
}

@Override
public void onFlush() {
// onFlush() can be invoked only when ratis is enabled.
Preconditions.checkNotNull(deletingTxIDs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ public void close() throws IOException {
}

// Remove this after fixing Recon
@Override
@VisibleForTesting
public ContainerStateManager getContainerStateManager() {
return containerStateManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ public void updateDeleteTransactionId(
}
}

@Override
public ContainerInfo getMatchingContainer(final long size, String owner,
PipelineID pipelineID, NavigableSet<ContainerID> containerIDs) {
if (containerIDs.isEmpty()) {
Expand Down Expand Up @@ -504,6 +505,7 @@ private ContainerInfo findContainerWithSpace(final long size,
}


@Override
public void removeContainer(final HddsProtos.ContainerID id)
throws IOException {
final ContainerID cid = ContainerID.getFromProtobuf(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ public ContainerBalancerTask(StorageContainerManager scm,
/**
* Run the container balancer task.
*/
@Override
public void run() {
try {
if (delayStart) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ private void setLowerLimit(Double lowerLimit) {
/**
* {@inheritDoc}
*/
@Override
public void resetPotentialSources(
@Nonnull Collection<DatanodeDetails> sources) {
List<DatanodeUsageInfo> usageInfos = new ArrayList<>(sources.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public FindTargetGreedyByNetworkTopology(
* network topology.
* @param source the specified source datanode
*/
@Override
@VisibleForTesting
public void sortTargetForSource(DatanodeDetails source) {
Collections.sort(potentialTargets,
Expand Down
Loading