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

Remove AvailabilityForTablet #4728

Merged

Conversation

meatballspaghetti
Copy link
Contributor

@meatballspaghetti meatballspaghetti commented Jul 5, 2024

This PR is meant to delete the AvailabilityForTablet class which was located in public API and only used by 2 integration tests: ImportExportIT and TableOperationsIT. Upon deleting the class, its usages were replaced which maintained the original functionality. This PR also fixes a typo in TableOperationsIT.

The following files have been modified:

  • core/src/main/java/org/apache/accumulo/core/client/admin/AvailabilityForTablet.java: Deleted.
  • test/src/main/java/org/apache/accumulo/test/ImportExportIT.java: Replace usages of List<AvailabilityForTablet> objects with Map<TabletId, TabletAvailability>.
  • test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java: Replace usages of List<AvailabilityForTablet> objects with Map<TabletId, TabletAvailability>. In doing so, changed the assertion on line 742: previously, was an assertEquals assertion that compared the TabletId field of objects in expected/actual Lists; now, is an assertTrue assertion that checks if the (expected) Map<TabletId, TabletAvailability> expectedAvailability contains the same TabletId's as those in the (actual) List<TabletInformation> tabletInfo. Since there is an assertion (line 740) for checking that both structures have the same size, this change can serve the same purpose as the original assertion and ensures that expectedAvailability and tabletInfo contain equal values.
    • UPDATE: verifyTabletAvailabilities on line 735 of TableOperationsIT has been simplified to compare two Maps instead of a Map and a List, resulting in only one Assertion needed.
  • Fix all occurences of typo verifyTabletAvailabilites -> verifyTabletAvailabilities in both ImportExportIT and TableOperationsIT.

Resolves: #4706 "Remove AvailabilityForTablet from public API"

- Delete AvailabiltyForTablet class. It is only being used
  in 2 tests: ImportExportIT and TableOperationsIT.
- In both ImportExportIT and TableOperationsIT, replace
  List<AvailabilityForTablet> objects with
  Map<TabletId, TabletAvailability>.
- Fix typo in TableOperationsIT: verifyTabletAvailabilites ->
                                 verifyTabletAvailabilities.

Resolves: apache#4706 "Remove AvailabilityForTablet from public API"
List<AvailabilityForTablet> expectedAvailability) throws TableNotFoundException {
public static void verifyTabletAvailabilities(AccumuloClient client, String tableName,
Range range, Map<TabletId,TabletAvailability> expectedAvailability)
throws TableNotFoundException {
Copy link
Contributor

Choose a reason for hiding this comment

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

With this new map, may be able to simplify the body of this method to the following.

    Map<TabletId, TabletAvailability> seenAvailability = client.tableOperations()
            .getTabletInformation(tableName, range).collect(Collectors.toMap(TabletInformation::getTabletId, TabletInformation::getTabletAvailability));
    assertEquals(expectedAvailability, seenAvailability);

Copy link
Contributor Author

@meatballspaghetti meatballspaghetti Jul 8, 2024

Choose a reason for hiding this comment

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

Makes sense, just updated.

Copy link
Contributor

@keith-turner keith-turner left a comment

Choose a reason for hiding this comment

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

These changes look good. I like using the map to replace List<AvailabilityForTablet>. Made one comment about further simplification that could be done using the new map, but that does not have to be done.

- Streamline verifyTabletAvailabilities method in TableOperationsIT
  class by comparing two Maps instead of a Map and a List. Cut
  previous two Assertions down to one Assertion.

Resolves: apache#4706 "Remove AvailabilityForTablet from public API"
- Correct formatting in TableOperationsIT which was previously
  causing workflow build to fail.

Resolves: apache#4706 "Remove AvailabilityForTablet from public API"
@keith-turner keith-turner merged commit 275c309 into apache:elasticity Jul 10, 2024
8 checks passed
@keith-turner
Copy link
Contributor

@meatballspaghetti if this your first PR to Accumulo then feel free to make a PR to add yourself as a contributor on the People page.

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

Successfully merging this pull request may close these issues.

Remove AvailabilityForTablet from public API
3 participants