summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Rumbaugh <dbr4@psu.edu>2023-12-21 17:05:30 -0500
committerDouglas Rumbaugh <dbr4@psu.edu>2023-12-21 17:05:30 -0500
commit46dfe1e0f3bb05016da14b39b2e35babbba4027a (patch)
tree9a7da1d5a92ba3fb9211a56114a4b734f7a5282a
parent24a42e300c96e2815bf20be3f6cce3efee1c4303 (diff)
downloaddynamic-extension-46dfe1e0f3bb05016da14b39b2e35babbba4027a.tar.gz
InternalLevel: appending an empty level is a no-op
The existing reconstruction logic will occasionally attempt to append an empty level to another empty level, for some reason. While the underlying cause of this needs to be looked into, this special case should prevent shard constructors being called with a shard count of 0 under tiering, reducing the error handling overhead of shard code.
-rw-r--r--include/framework/structure/InternalLevel.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/framework/structure/InternalLevel.h b/include/framework/structure/InternalLevel.h
index e70ed76..ee85cb3 100644
--- a/include/framework/structure/InternalLevel.h
+++ b/include/framework/structure/InternalLevel.h
@@ -68,6 +68,13 @@ public:
* No changes are made to the level provided as an argument.
*/
void append_level(InternalLevel* level) {
+ // FIXME: that this is happening probably means that
+ // something is going terribly wrong earlier in the
+ // reconstruction logic.
+ if (level->get_shard_count() == 0) {
+ return;
+ }
+
Shard *shards[level->m_shard_cnt];
for (size_t i=0; i<level->m_shard_cnt; i++) {
shards[i] = level->m_shards[i].get();