rpuch commented on code in PR #7101:
URL: https://github.com/apache/ignite-3/pull/7101#discussion_r2598684750
##########
modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/segstore/SegmentInfo.java:
##########
@@ -56,13 +58,23 @@ ArrayWithSize add(int element) {
return new ArrayWithSize(array, size + 1);
}
- ArrayWithSize truncate(int newSize) {
+ ArrayWithSize truncateSuffix(int newSize) {
+ return truncate(0, newSize);
+ }
+
+ ArrayWithSize truncatePrefix(int newSize) {
+ int srcPos = size - newSize;
+
+ return truncate(srcPos, newSize);
+ }
+
+ private ArrayWithSize truncate(int srcPos, int newSize) {
assert newSize <= size
: String.format("Array must shrink on truncation, current
size: %d, size after truncation: %d", size, newSize);
- int[] newArray = new int[size];
+ int[] newArray = new int[array.length];
Review Comment:
Could you please leave a comment on this?
--
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]