comnetwork commented on a change in pull request #3777:
URL: https://github.com/apache/hbase/pull/3777#discussion_r737075750



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactionPipeline.java
##########
@@ -95,7 +103,7 @@ public VersionedSegmentsList getVersionedList() {
 
   public VersionedSegmentsList getVersionedTail() {
     synchronized (pipeline){
-      List<ImmutableSegment> segmentList = new ArrayList<>();
+      LinkedList<ImmutableSegment> segmentList = new LinkedList<>();

Review comment:
       @Apache9 , thank you very much for review,Here I change to `LinkedList 
`because I expect `VersionedSegmentsList.storeSegments` is `LinkedList`, so in 
the following `CompactionPipline.matchAndRemoveSuffixFromPipeline` I could use 
`LinkedList.descendingIterator`  to simplify code.
   I think here change to LinkedList is somwhat ok, because:
   1. Here the returned `VersionedSegmentsList ` has only one tail  element, 
`LinkedList `and `ArrayList `make no difference.
   2. Furthermore, the` CompactionPipeline.pipeline` and 
`CompactionPipeline.readOnlyCopy` which used in` 
CompactionPipeline.getVersionedList` are all LinkedList, that is to say,  
`VersionedSegmentsList.storeSegments` is actually LinkedList in 
fact(`CompactionPipline.getVersionedTail` is only used for test), so here 
change to LinkedList could also make the code looks consistent.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to