Skip to content

Conversation

@szetszwo
Copy link
Contributor

What changes were proposed in this pull request?

RocksDatabase already has a non-static columnFamilies which has ColumnFamilyHandle. The static dbNameToCfHandleMap should be removed for better performance and cleaner code.

What is the link to the Apache JIRA

HDDS-10107

How was this patch tested?

By existing tests.

Copy link
Contributor

@hemantk-12 hemantk-12 left a comment

Choose a reason for hiding this comment

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

Thanks @szetszwo for the patch.

Overall looks good to me. Left couple of minor comments.

this.columnFamilyNames = MemoizedSupplier.valueOf(() -> toMap(columnFamilies.values()));
}

private Map<String, ColumnFamily> newMap(List<ColumnFamilyHandle> handles) throws RocksDBException {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: newMap and toMap are very generic names and seem like can be used to create/convert any type of Map.
I think newMap could be toColumnFamilyMap and toMap be toColumnFamilyIdToNameMap or something along the line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, let me rename them.


@VisibleForTesting
public ColumnFamilyHandle getHandle() {
return handle;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: please remove @VisibleForTesting. it is used in src code now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The @VisibleForTesting tag was added by HDDS-8122 since it changed the method from protected to public for a unit test. The getHandle() method is already used many times by in RocksDatabase and a few times in RDBStore.

@szetszwo
Copy link
Contributor Author

@hemantk-12 , thanks a lot for reviewing this! Just have pushed a commit for addressing your comments.

Copy link
Contributor

@hemantk-12 hemantk-12 left a comment

Choose a reason for hiding this comment

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

LGTM.

@szetszwo szetszwo merged commit 0c98e3a into apache:master Jan 16, 2024
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