HBASE-24974: Provide a flexibility to print only row key and filter for multiple tables in the WALPrettyPrinter#2345
Conversation
…or multiple tables in the WALPrettyPrinter
|
@bharathv can you review this since you last touched this file? |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
wchevreuil
left a comment
There was a problem hiding this comment.
Overall, looks good, just some minor nits.
One additional thought I have here, on cases where same row had several puts in same wal (either overriding ones or because the row has several cells), output can become very repetitive. Maybe for another jira, we can think of a functionality where user can combine the set of info he would like to be displayed?
hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALPrettyPrinter.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
nit: for clarity, shouldn't we name it as tableSet instead of tableList? Or maybe better to use List/ArrayList.
There was a problem hiding this comment.
+1, and this should be final too.
There was a problem hiding this comment.
I used Set since every WALEntry is going to search in the Set which is optimal for search.
as @virajjasani pointed out in another comment
hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALPrettyPrinter.java
Outdated
Show resolved
Hide resolved
hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALPrettyPrinter.java
Outdated
Show resolved
Hide resolved
virajjasani
left a comment
There was a problem hiding this comment.
Left few comments. Overall looks good.
There was a problem hiding this comment.
This can be replaced with:
Collections.addAll(tableList, tableListWithDelimiter.split(","));
There was a problem hiding this comment.
Looks like this efficient search with contains() is the reason behind using Set instead of List.
Btw, (TableName) is redundant cast here.
There was a problem hiding this comment.
+1, and this should be final too.
bharathv
left a comment
There was a problem hiding this comment.
While we are here, does it make sense to make the table filter a regex? (ex: for dumping all entries for tables in a namespace etc).
|
@bharathv Initially though of that but regex evaluation for each WALEntry is going to be an expensive operation? On the other hand searching is HashSet is O(1). What do you think? |
|
Fine by me. |
|
@virajjasani @wchevreuil Addressed your comments and tested it locally. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
| long writeTime = key.getWriteTime(); | ||
| // check output filters | ||
| if (table != null && !((TableName) txn.get("table")).toString().equals(table)) { | ||
| if (!tableSet.isEmpty() && |
There was a problem hiding this comment.
nit: I think the second condition covers the first one.
There was a problem hiding this comment.
I think we need the first one where we don't pass -t param and set is Empty. In that case, the second one will always skip all the tables. @bharathv
|
@wchevreuil You have any more comments on this ? |
wchevreuil
left a comment
There was a problem hiding this comment.
+1 (Sorry for the late reply, this fell off my radar somehow)
Provide flexibility to print only row key from WALPrettyPrinter and filter for multiple tables in the WALPrettyPrinter