Invert order of checks in pgd_append_point(). (#19515)
vkalintiris committed
Jan 28, 2025 at 19:49 UTC
a2df056233a4440afb853657810eb5418e039f8d
1 file changed
+8
-8
src/database/engine/page.c
+8
-8
@@ -792,19 +792,19 @@ ALWAYS_INLINE size_t pgd_append_point(PGD *pg,
792
SN_FLAGS flags,
793
uint32_t expected_slot)
794
{
795
- if (unlikely(pg->used >= pg->slots))
796
- fatal("DBENGINE: attempted to write beyond page size (page type %u, slots %u, used %u)",
797
- pg->type, pg->slots, pg->used /* FIXME:, pg->size */);
795
+ if (pg->states & PGD_STATE_SCHEDULED_FOR_FLUSHING)
796
+ fatal("Data collection on page already scheduled for flushing");
797
+
798
+ if (!(pg->states & PGD_STATE_CREATED_FROM_COLLECTOR))
799
+ fatal("DBENGINE: collection on page not created from a collector");
800
801
if (unlikely(pg->used != expected_slot))
802
fatal("DBENGINE: page is not aligned to expected slot (used %u, expected %u)",
803
pg->used, expected_slot);
804
803
- if (!(pg->states & PGD_STATE_CREATED_FROM_COLLECTOR))
804
- fatal("DBENGINE: collection on page not created from a collector");
805
-
806
- if (pg->states & PGD_STATE_SCHEDULED_FOR_FLUSHING)
807
- fatal("Data collection on page already scheduled for flushing");
805
+ if (unlikely(pg->used >= pg->slots))
806
+ fatal("DBENGINE: attempted to write beyond page size (page type %u, slots %u, used %u)",
807
+ pg->type, pg->slots, pg->used /* FIXME:, pg->size */);
808
809
switch (pg->type) {
810
case RRDENG_PAGE_TYPE_GORILLA_32BIT: {