@@ -974,60 +974,53 @@ void exercise_limits(bool direct) {
974974 const auto * found = core.event_at (no::EventId{core.identity (), ordinals[kJournalChunk ]});
975975 CHECK (found && full_fold::value (*found) == values[kJournalChunk ]);
976976 }
977- for (const auto label_bytes : {over_label,
978- 2 * kJournalSpillPageBytes - accepted_bytes - 1 ,
979- 2 * kJournalSpillPageBytes - accepted_bytes,
980- 2 * kJournalSpillPageBytes - accepted_bytes + 1 }) {
981- no::WorkingRequestCore core{no::RunIdentity{" journal-continuation" , 1 }};
982- core.reset (no::RunIdentity{" journal-continuation" , 1 });
977+ {
978+ no::WorkingRequestCore core{no::RunIdentity{" x08-limits-refuse" , 1 }};
979+ core.reset (no::RunIdentity{" x08-limits-refuse" , 1 });
983980 core.reserve (kJournalMaxResident + 64 );
984981 std::uint64_t incarnation = 1 , ordinal = 1 ;
985- const no::Request over{no::Transact{1.0 }, std::string (label_bytes , ' o' ), " " };
982+ const no::Request over{no::Transact{1.0 }, std::string (over_label , ' o' ), " " };
986983 const auto accepted = submit_limit_case (core, over, incarnation, ordinal, direct);
987984 CHECK (accepted.status == no::SubmitStatus::Accepted);
988985 while (core.history_end () < kJournalMaxResident )
989986 CHECK (submit_limit_case (core, filler, incarnation, ordinal, direct).status
990987 == no::SubmitStatus::Rejected);
988+ const auto before = full_fold::core_value (core);
991989 const auto before_end = core.history_end ();
992990 const auto before_incarnation = incarnation, before_ordinal = ordinal;
993- const auto expected = full_fold::value (core.history_at (0 ));
994991 std::array<std::uintptr_t , kJournalChunk > addresses{};
995992 for (std::size_t index = 0 ; index < addresses.size (); ++index)
996993 addresses[index] = reinterpret_cast <std::uintptr_t >(&core.history_at (index));
997- // The first event size is one byte beyond a page; the others straddle
998- // two full transfer chunks. Before continuation support the first
999- // append below throws EFBIG: CHECK(appended) is the runtime red.
994+ // The event is already resident; the next append reaches the spill
995+ // refusal in reserve_plan/seal_direct. Retry also must publish nothing.
1000996 for (unsigned attempt = 0 ; attempt < 2 ; ++attempt) {
1001- bool appended = false ;
997+ bool refused = false ;
1002998 try {
1003- appended = submit_limit_case (core, filler, incarnation, ordinal, direct).status
1004- == no::SubmitStatus::Rejected;
999+ (void )submit_limit_case (core, filler, incarnation, ordinal, direct);
10051000 } catch (const detail::ScratchIoError& error) {
1006- std::fprintf (stderr, " oversized journal append: %s (errno=%d)\n " ,
1007- error.what (), error.code ().value ());
1001+ refused = true ;
1002+ CHECK (error.code () == std::error_code (EFBIG , std::generic_category ()));
1003+ CHECK (std::string (error.what ()).find (
1004+ " native o1 journal event exceeds the spill page byte bound" )
1005+ != std::string::npos);
10081006 }
1009- CHECK (appended );
1010- if (!appended) return ;
1011- CHECK (core. history_end () == before_end + attempt + 1 && core. history_base () == 0 );
1012- CHECK (incarnation == before_incarnation && ordinal == before_ordinal + attempt + 1 );
1013- CHECK ( full_fold::value (core. history_at ( 0 )) == expected);
1014- CHECK (std::get<no::AcceptedEvent>( core.history_at (0 )). request (). label == over. label );
1007+ CHECK (refused );
1008+ CHECK (core. history_end () == before_end && core. history_base () == 0 ) ;
1009+ CHECK (incarnation == before_incarnation && ordinal == before_ordinal );
1010+ CHECK (full_fold::core_value (core) == before );
1011+ for (std:: size_t index = 0 ; index < addresses. size (); ++index)
1012+ CHECK (reinterpret_cast < std::uintptr_t >(& core.history_at (index)) == addresses[index] );
10151013 }
1016- CHECK (reinterpret_cast <std::uintptr_t >(&core.history_at (0 )) != addresses[0 ]);
1017- // Retiring just the continued event leaves a partial chunk/page. Its
1018- // surviving prefix still reads back and the ordinal lookup agrees.
1014+ // Removing only the oversized event leaves a partial resident chunk.
1015+ // The following appends must still spill/read its surviving prefix.
10191016 const auto survivor = full_fold::value (core.history_at (1 ));
10201017 CHECK (core.retire_history (accepted.event_ordinal ) == 1 );
10211018 for (unsigned index = 0 ; index < 2 ; ++index)
10221019 CHECK (submit_limit_case (core, filler, incarnation, ordinal, direct).status
10231020 == no::SubmitStatus::Rejected);
1024- CHECK (core.history_base () == 1 && core.history_end () == before_end + 4 );
1021+ CHECK (core.history_base () == 1 && core.history_end () == before_end + 2 );
10251022 CHECK (reinterpret_cast <std::uintptr_t >(&core.history_at (1 )) != addresses[1 ]);
10261023 CHECK (full_fold::value (core.history_at (1 )) == survivor);
1027- const auto survivor_ordinal = std::visit (
1028- [](const auto & row) { return row.ordinal ; }, core.history_at (1 ));
1029- const auto * found = core.event_at (no::EventId{core.identity (), survivor_ordinal});
1030- CHECK (found && full_fold::value (*found) == survivor);
10311024 }
10321025 std::printf (" X08 limits direct=%d page_bytes=%zu accepted_fixed_bytes=%zu "
10331026 " under_label=%zu exact_label=%zu over_label=%zu\n " ,
@@ -1067,13 +1060,7 @@ void invalid_cause(bool direct) {
10671060}
10681061} // namespace
10691062
1070- int main (int argc, char ** argv) {
1071- if (argc == 2 && std::string (argv[1 ]) == " --journal-limits-only" ) {
1072- exercise_limits (false );
1073- exercise_limits (true );
1074- std::printf (" journal spill boundaries: %d failures\n " , failures);
1075- return failures ? 1 : 0 ;
1076- }
1063+ int main () {
10771064 for (const bool direct : {true , false }) {
10781065 exercise (64 , Shape::Wide, direct);
10791066 exercise (512 , Shape::Wide, direct);
0 commit comments