Github user JamesRTaylor commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/12#discussion_r17709319
--- Diff:
phoenix-core/src/main/java/org/apache/phoenix/schema/PColumnFamilyImpl.java ---
@@ -41,9 +46,19 @@ public int getEstimatedSize() {
}
public PColumnFamilyImpl(PName name, List<PColumn> columns) {
+ this(name, columns, null);
+ }
+
+ public PColumnFamilyImpl(PName name, List<PColumn> columns,
List<byte[]> guidePosts) {
Preconditions.checkNotNull(name);
- long estimatedSize = SizedUtil.OBJECT_SIZE +
SizedUtil.POINTER_SIZE * 4 + SizedUtil.INT_SIZE + name.getEstimatedSize() +
- SizedUtil.sizeOfMap(columns.size()) * 2 +
SizedUtil.sizeOfArrayList(columns.size());
+ // Include guidePosts also in estimating the size
+ int guidePostsSize = 0;
+ if(guidePosts != null) {
+ guidePostsSize = guidePosts.size();
+ }
+ this.guidePosts = guidePosts;
+ long estimatedSize = SizedUtil.OBJECT_SIZE +
SizedUtil.POINTER_SIZE * 5 + SizedUtil.INT_SIZE + name.getEstimatedSize() +
--- End diff --
This is the size in bytes of the PColumnFamily. Just do a +=
SizedUtil.sizeOfList(guideposts.size()) and then loop over the guideposts and
add the byte[].length for each element.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---