Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FileCopy based bootstrap][FileCopyHandler] Add FCHandler #3035

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

DevenAhluwalia
Copy link
Contributor

@DevenAhluwalia DevenAhluwalia commented Mar 11, 2025

Summary

BUG=AMBRY-13117

Adds support for FileCopyHandler that orchestrates GetMetadata and GetChunk Apis given a Replica and a target peer node.

Testing Done

Test suite WIP

@DevenAhluwalia DevenAhluwalia self-assigned this Mar 11, 2025
@DevenAhluwalia DevenAhluwalia marked this pull request as ready for review March 12, 2025 06:28
* Timeout duration for file chunk operations in minutes.
* After this duration, incomplete chunk operations are considered failed.
*/
public static final String FILECOPY_FILE_CHUNK_TIMEOUT_IN_MINUTES = "filecopy.file.chunk.timeout.in.minutes";
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's Keep the other config. It has better naming conventions for file. Matches with File Copy module names.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fine either way. I matched the file content. Its same.
Seemed 'FileCopyBasedReplicationConfig' is bit of an overkill for this name vs FileCopyConfig.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Update; So AmbryLI has FileCopyBasedReplicationConfig committed and its the deployed code. When I tried testing a jar from this current PR's diff, AmbryLI's server bootstrap failed because it was expecting that class.

With lesser amount of changes required, I am reverting to using this class and delete the other dup FileCopyConfig class.

/**
* Configuration for FileCopyHandler
*/
public class FileCopyHandlerConfig {
Copy link
Contributor

@aga9900 aga9900 Mar 17, 2025

Choose a reason for hiding this comment

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

Should we merge it to File Copy Based Replication Config. Creating separate config classes. will require too many config object to be sent from upstream classes.

@Nonnull ConnectionPool connectionPool,
@Nonnull StoreManager storeManager,
@Nonnull ClusterMap clusterMap,
@Nonnull FileCopyHandlerConfig config) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use File Copy config instead.

* Shutdown the file copy handler. Perform clean up steps in case of a graceful shutdown.
*/
void shutdown() {
connectionPool.shutdown();
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we planning to create a seperate connection pool for File Copy. We should not close it in File Copy Handler if this is a shared connection pool.

* @throws IOException
*/
@Override
public void copy(@Nonnull FileCopyInfo fileCopyInfo) throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we break FileCopyInfo into multiple objects.

  1. To identify replica and other information. That can be sent to file copy handler and it need not have the chunk information.
  2. And other object used for getting chunks. which will be used inside the FileCopy Handler.

Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need to mutate FileCopyinfo on every call.

@@ -37,7 +38,7 @@ public class FileCopyThread implements Runnable {
public void run() {
try {
//TODO add required params for File copy handler
fileCopyHandler.copy();
fileCopyHandler.copy(null);
fileCopyStatusListener.onFileCopySuccess();
} catch (Exception e) {
fileCopyStatusListener.onFileCopyFailure(e);
Copy link
Contributor

Choose a reason for hiding this comment

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

We need Peerfinder and retries in case of failures.

public void testGetFileCopyGetMetaDataResponseExpectConnectionTimeout() throws Exception {
// Arrange: Mock ConnectionPoolTimeoutException
when(handler.getOperationRetryHandler().executeWithRetry(any(), eq(GetMetadataWorkflow.GET_METADATA_OPERATION_NAME)))
.thenThrow(new ConnectionPoolTimeoutException("Timeout"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to override the default timeout set for Connection Pool for File Copy or make it configurable?

Copy link
Contributor

@aga9900 aga9900 left a comment

Choose a reason for hiding this comment

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

Left Comments

* @throws Exception exception
*/
void copy() throws Exception;
void copy(@Nonnull FileCopyInfo fileCopyInfo)
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need FileCopyInfo?

/**
* The hostname of the target node
*/
private final String hostName;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not required seperately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants