Skip to content

Conversation

@elek
Copy link
Member

@elek elek commented Mar 17, 2021

What changes were proposed in this pull request?

This is the initial patch to support differentiating between multiple container replicas.

With RATIS/Closed containers all the container replicas are exactly the same but with EC they will be different. We need an additional index for each container replicas to know how it should be handled.

This patch is part of bigger effort to show end2end solution for container indexes. The full picture can be found at https://github.com/elek/ozone/tree/ec with all of these improvements:

  • replicaIndexes are introduced in proto files and Pipeline
  • EC repliation type is added
  • SCM allocates datanodes for new EC pipelines (hard coded 1 as of now)
  • Client sends the instanceIndex during chunkWrites (required for container creation)
  • Container files on datanodes persist the instance index
  • ContainerReports contains the instanceIndex
  • SCM adds the new field the ContainerReplica instances
  • RelicationManager is extended to handle EC type containers (with a stub implementation)

This doesn't include all of these modifications, it is just the very first, separated step where the proto files and Pipeline are modified.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-4954

How was this patch tested?

The patch is tested together with the full end2end code (https://github.com/elek/ozone/tree/ec)

Started Ozone cluster and created a key:

./ozone sh key put -t EC /vol1/bucket1/key1 ../README.md

Checked the container yaml file if it contains the instandeIndex.

Checked the SCM log for the message from ReplicationMananger:

2021-03-17 12:30:02,754 INFO  container.ReplicationManager (ReplicationManager.java:processContainer(329)) - TODO: replication management for EC containers are missing. Container #1, 127.0.0.1 #7

@elek elek changed the base branch from master to HDDS-3816-ec March 17, 2021 11:57
@elek elek requested a review from arp7 March 17, 2021 12:31
@elek elek changed the title HDDS-4954. Use instanceIndex between datanodes and SCM HDDS-4954. Add replicaIndex to the RPC protocols Mar 19, 2021
@umamaheswararao
Copy link
Contributor

Thanks for separating the replication type changes into separate JIRA.
Please add the replication index to org.apache.hadoop.hdds.client.BlockID and org.apache.hadoop.hdds.client.ContainerBlockID
This will be needed when we create container from client, we anyway pass blockID to DN. If index available there, then DN know which index.
Current patch seems t be covering the protocols only from SCM and DN. The above change can help to cover client needed changes.

We also discussed yesterday that, let's not make index as the property to chunkInfo. I am more comfortable if we make that as property to ContainerBlockID instead. Thanks for removing them in latest patch.

required DatanodeBlockID blockID = 1;
required ChunkInfo chunkData = 2;
optional bytes data = 3;
optional int32 containerinstanceIndex = 4;
Copy link
Contributor

Choose a reason for hiding this comment

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

containerinstanceIndex -> containerInstanceIndex

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed with moving this field to the DatanodeBlockID

Copy link
Contributor

@umamaheswararao umamaheswararao left a comment

Choose a reason for hiding this comment

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

I understand you may be correcting the formatting issues like organizing imports and other formatting in existing code as well. Could you please check if it's possible to keep only changed lines to be formatted? That way branch code will have less changes and we can avoid conflict issues.

}

public int getReplicaIndex(DatanodeDetails dn) {
return replicaIndexes.getOrDefault(dn, 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add a comment that, returning 0 means, it's just an invalid index and this API for EC. Because mostly we may not use this kind of API in non-EC flow, we may invoke this API in EC flow to get a particular DN index.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I added a detailed javadoc.

@elek
Copy link
Member Author

elek commented Mar 22, 2021

We also discussed yesterday that, let's not make index as the property to chunkInfo. I am more comfortable if we make that as property to ContainerBlockID instead. Thanks for removing them in latest patch.

Sure, I removed it, but during my git rebase it's not fully moved (I manage 10-12 patches today and trying to sync them one-by-one with different PRs)

Now it should be good:

/**
 * Block ID that uniquely identify a block in Datanode.
 */
message DatanodeBlockID {
  required int64 containerID = 1;
  required int64 localID = 2;
  optional uint64 blockCommitSequenceId = 3 [default = 0];
  optional int32 replicaIndex = 4;
}

Please add the replication index to org.apache.hadoop.hdds.client.BlockID and org.apache.hadoop.hdds.client.ContainerBlockID
This will be needed when we create container from client, we anyway pass blockID to DN. If index available there, then DN know which index.

org.apache.hadoop.hdds.client.ContainerBlockID doesn't need any modification as it contains the generic id (which points to the replication set) and pipelines (where each element can have replicaIndex information)

Same is true for BlockID some cases we need this information in some cases we don't I propose to add the information only when it's required. We will see it in the next patches with adding the client side / datanode side changes, and we can extend BlockID and create a BlockInstanceId when required...

@elek
Copy link
Member Author

elek commented Mar 22, 2021

Thanks the review @umamaheswararao, I updated the improved version, PTAL...

@umamaheswararao
Copy link
Contributor

@elek thanks for the update. I will take a look at the latest patch.

pipelines (where each element can have replicaIndex information)

this works as well for me.

@umamaheswararao
Copy link
Contributor

Can we avoid unrelated import organization changes if possible? Otherwise I am +1 on the changes.

@elek
Copy link
Member Author

elek commented Mar 29, 2021

Sorry, I just realized that I didn't push my changes which restored the import orders. Should be there now...

Copy link
Contributor

@umamaheswararao umamaheswararao left a comment

Choose a reason for hiding this comment

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

The latest changes LGTM

+1

Pending CI run

@elek
Copy link
Member Author

elek commented Mar 30, 2021

Merging it as CI is green. Thanks the review @umamaheswararao

@elek elek merged commit a51efc5 into apache:HDDS-3816-ec Mar 30, 2021
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.

2 participants