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

[WIP] Reorder disks if mounts have been shuffled. #2931

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

Conversation

litingulfs
Copy link
Contributor

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Oct 31, 2024

Codecov Report

Attention: Patch coverage is 1.05263% with 94 lines in your changes missing coverage. Please review.

Project coverage is 31.45%. Comparing base (52ba813) to head (9cb42e2).
Report is 133 commits behind head on master.

Files with missing lines Patch % Lines
.../github/ambry/store/ReplicaPlacementValidator.java 0.00% 41 Missing ⚠️
.../com/github/ambry/clustermap/HelixParticipant.java 0.00% 20 Missing ⚠️
...n/java/com/github/ambry/store/PartitionFinder.java 0.00% 16 Missing ⚠️
...in/java/com/github/ambry/store/StorageManager.java 0.00% 15 Missing and 1 partial ⚠️
...om/github/ambry/clustermap/ClusterParticipant.java 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (52ba813) and HEAD (9cb42e2). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (52ba813) HEAD (9cb42e2)
3 2
Additional details and impacted files
@@              Coverage Diff              @@
##             master    #2931       +/-   ##
=============================================
- Coverage     64.24%   31.45%   -32.79%     
+ Complexity    10398     5432     -4966     
=============================================
  Files           840      867       +27     
  Lines         71755    73754     +1999     
  Branches       8611     8883      +272     
=============================================
- Hits          46099    23201    -22898     
- Misses        23004    48730    +25726     
+ Partials       2652     1823      -829     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

*/
private Set<String> findPartitionsOnDisk(DiskId disk) {
Set<String> partitionDirs = new HashSet<>();
File[] directories = new File(disk.getMountPath()).listFiles(File::isDirectory);
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should probably check if the disk.getMountPath() exists or not. List file on nonexisting directory would throw some exception.

Comment on lines +50 to +52
if(!foundDiskToPartitionMap.get(currentDisk).contains(partitionID)) {
brokenDisks.add(currentDisk);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

If a host got reimaged, and came back with empty disks, then we don't want to think those disks are broken.

Comment on lines +76 to +80
if(foundDisk == null) {
return Collections.emptyMap();
} else {
shuffledDisks.put(currentDisk, foundDisk);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

The empty disk might be covered by these statements.

Comment on lines 467 to 470
if (!dataNodeConfigSource.set(dataNodeConfig)) {
logger.error("Setting disks order failed DataNodeConfig update");
success = false;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should only call dataNodeConfigSource.set once, after for loop.


// Swap the disks in the DataNodeConfig
logger.info("Replacing disk {} with disk {}", oldDisk.getMountPath(), newDisk.getMountPath());
dataNodeConfig.getDiskConfigs().put(oldDisk.getMountPath(), dataNodeConfig.getDiskConfigs().get(newDisk));
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is probably not enough, say disk1 shuffles to disk2 and disk2 shuffle to disk1.

In this case, the newDiskMapping would have {disk1:disk2, disk2:disk1}.
Say we are dealing with disk1:disk2 entry and we are setting disk1 (old) to disk2's config. Now the dataNodeConfig's disk config map would look like {disk1:disk2config, disk2:disk2config}. Disk1config is missing.

I think we have to make a copy of dataNodeConfig's disk config map and use this copied map as temporary reference.

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