@@ -496,74 +496,75 @@ Cas::GcRoundLogger ContentAddressedMetadataStorage::makeGcRoundLogger() const
496496 auto log = ctx->getContentAddressedGarbageCollectionLog ();
497497 if (!log)
498498 return ;
499- ContentAddressedGarbageCollectionLogElement e;
500- const auto now = std::chrono::system_clock::now ();
501- e.event_time = std::chrono::system_clock::to_time_t (now);
502- e.event_time_microseconds = timeInMicroseconds (now);
503- switch (r.event_type )
504- {
505- case Cas::GcRoundLogRecord::EventType::Start:
506- e.event_type = ContentAddressedGarbageCollectionLogElement::START ;
507- break ;
508- case Cas::GcRoundLogRecord::EventType::Finish:
509- e.event_type = ContentAddressedGarbageCollectionLogElement::FINISH ;
510- break ;
511- case Cas::GcRoundLogRecord::EventType::Phase:
512- e.event_type = ContentAddressedGarbageCollectionLogElement::PHASE ;
513- break ;
514- }
515- e.disk_name = r.disk_name .empty () ? disk : r.disk_name ;
516- e.srid = r.srid ;
517- e.gc_id = r.gc_id ;
518- e.trigger = r.trigger == Cas::GcRoundLogRecord::Trigger::Manual
519- ? ContentAddressedGarbageCollectionLogElement::MANUAL
520- : ContentAddressedGarbageCollectionLogElement::SCHEDULED ;
521- switch (r.outcome )
522- {
523- case Cas::GcRoundLogRecord::Outcome::Unknown:
524- e.outcome = ContentAddressedGarbageCollectionLogElement::UNKNOWN ;
525- break ;
526- case Cas::GcRoundLogRecord::Outcome::Success:
527- e.outcome = ContentAddressedGarbageCollectionLogElement::SUCCESS ;
528- break ;
529- case Cas::GcRoundLogRecord::Outcome::NotALeader:
530- e.outcome = ContentAddressedGarbageCollectionLogElement::NOT_A_LEADER ;
531- break ;
532- case Cas::GcRoundLogRecord::Outcome::Failed:
533- e.outcome = ContentAddressedGarbageCollectionLogElement::FAILED ;
534- break ;
535- case Cas::GcRoundLogRecord::Outcome::Deferred:
536- e.outcome = ContentAddressedGarbageCollectionLogElement::DEFERRED ;
537- break ;
538- case Cas::GcRoundLogRecord::Outcome::Aborted:
539- e.outcome = ContentAddressedGarbageCollectionLogElement::ABORTED ;
540- break ;
541- case Cas::GcRoundLogRecord::Outcome::Stopped:
542- e.outcome = ContentAddressedGarbageCollectionLogElement::STOPPED ;
543- break ;
544- }
545- e.round = r.round ;
546- e.candidates_marked = r.candidates_marked ;
547- e.objects_deleted = r.objects_deleted ;
548- e.objects_absent = r.objects_absent ;
549- e.objects_replaced = r.objects_replaced ;
550- e.objects_spared = r.objects_spared ;
551- e.manifests_deleted = r.manifests_deleted ;
552- e.entries_condemned = r.entries_condemned ;
553- e.entries_graduated = r.entries_graduated ;
554- e.entries_redeleted = r.entries_redeleted ;
555- e.fence_outs = r.fence_outs ;
556- e.anomalies = r.anomalies ;
557- e.duration_ms = r.duration_ms ;
558- e.error = r.error ;
559- e.error_code = r.error_code ;
560- e.profile_events = r.profile_events ;
561- e.round_id = r.round_id ;
562- e.phase = r.phase ;
563- e.phase_duration_microseconds = r.phase_duration_microseconds ;
564- e.phase_metrics = r.phase_metrics ;
565499 // / Best-effort: SystemLog::add never blocks GC; a full queue drops the row with a warning.
566- log->add (std::move (e));
500+ log->add ([&](ContentAddressedGarbageCollectionLogElement & e)
501+ {
502+ const auto now = std::chrono::system_clock::now ();
503+ e.event_time = std::chrono::system_clock::to_time_t (now);
504+ e.event_time_microseconds = timeInMicroseconds (now);
505+ switch (r.event_type )
506+ {
507+ case Cas::GcRoundLogRecord::EventType::Start:
508+ e.event_type = ContentAddressedGarbageCollectionLogElement::START ;
509+ break ;
510+ case Cas::GcRoundLogRecord::EventType::Finish:
511+ e.event_type = ContentAddressedGarbageCollectionLogElement::FINISH ;
512+ break ;
513+ case Cas::GcRoundLogRecord::EventType::Phase:
514+ e.event_type = ContentAddressedGarbageCollectionLogElement::PHASE ;
515+ break ;
516+ }
517+ e.disk_name = r.disk_name .empty () ? disk : r.disk_name ;
518+ e.srid = r.srid ;
519+ e.gc_id = r.gc_id ;
520+ e.trigger = r.trigger == Cas::GcRoundLogRecord::Trigger::Manual
521+ ? ContentAddressedGarbageCollectionLogElement::MANUAL
522+ : ContentAddressedGarbageCollectionLogElement::SCHEDULED ;
523+ switch (r.outcome )
524+ {
525+ case Cas::GcRoundLogRecord::Outcome::Unknown:
526+ e.outcome = ContentAddressedGarbageCollectionLogElement::UNKNOWN ;
527+ break ;
528+ case Cas::GcRoundLogRecord::Outcome::Success:
529+ e.outcome = ContentAddressedGarbageCollectionLogElement::SUCCESS ;
530+ break ;
531+ case Cas::GcRoundLogRecord::Outcome::NotALeader:
532+ e.outcome = ContentAddressedGarbageCollectionLogElement::NOT_A_LEADER ;
533+ break ;
534+ case Cas::GcRoundLogRecord::Outcome::Failed:
535+ e.outcome = ContentAddressedGarbageCollectionLogElement::FAILED ;
536+ break ;
537+ case Cas::GcRoundLogRecord::Outcome::Deferred:
538+ e.outcome = ContentAddressedGarbageCollectionLogElement::DEFERRED ;
539+ break ;
540+ case Cas::GcRoundLogRecord::Outcome::Aborted:
541+ e.outcome = ContentAddressedGarbageCollectionLogElement::ABORTED ;
542+ break ;
543+ case Cas::GcRoundLogRecord::Outcome::Stopped:
544+ e.outcome = ContentAddressedGarbageCollectionLogElement::STOPPED ;
545+ break ;
546+ }
547+ e.round = r.round ;
548+ e.candidates_marked = r.candidates_marked ;
549+ e.objects_deleted = r.objects_deleted ;
550+ e.objects_absent = r.objects_absent ;
551+ e.objects_replaced = r.objects_replaced ;
552+ e.objects_spared = r.objects_spared ;
553+ e.manifests_deleted = r.manifests_deleted ;
554+ e.entries_condemned = r.entries_condemned ;
555+ e.entries_graduated = r.entries_graduated ;
556+ e.entries_redeleted = r.entries_redeleted ;
557+ e.fence_outs = r.fence_outs ;
558+ e.anomalies = r.anomalies ;
559+ e.duration_ms = r.duration_ms ;
560+ e.error = r.error ;
561+ e.error_code = r.error_code ;
562+ e.profile_events = r.profile_events ;
563+ e.round_id = r.round_id ;
564+ e.phase = r.phase ;
565+ e.phase_duration_microseconds = r.phase_duration_microseconds ;
566+ e.phase_metrics = r.phase_metrics ;
567+ });
567568 };
568569}
569570
@@ -587,27 +588,28 @@ Cas::CasEventSink ContentAddressedMetadataStorage::makeCasEventSink() const
587588 auto log = ctx->getContentAddressedLog ();
588589 if (!log)
589590 return ;
590- ContentAddressedLogElement e;
591- const auto now = std::chrono::system_clock::now ();
592- e.event_time = std::chrono::system_clock::to_time_t (now);
593- e.event_time_microseconds = timeInMicroseconds (now);
594- e.event_type = toString (ev.type );
595- e.disk_name = disk;
596- e.namespace_ = std::move (ev.namespace_ );
597- e.ref_name = std::move (ev.ref_name );
598- e.object_kind = toString (ev.object_kind );
599- e.object_hash = std::move (ev.object_hash );
600- e.token = std::move (ev.token );
601- e.round = ev.round ;
602- e.gen = ev.gen ;
603- e.at_version = ev.at_version ;
604- e.outcome = std::move (ev.outcome );
605- e.reason = std::move (ev.reason );
606- e.thread_id = getThreadId ();
607- e.query_id = CurrentThread::getQueryId ();
608- e.detail = std::move (ev.detail );
609591 // / Best-effort: SystemLog::add never blocks the Core; a full queue drops the row with a warning.
610- log->add (std::move (e));
592+ log->add ([&](ContentAddressedLogElement & e)
593+ {
594+ const auto now = std::chrono::system_clock::now ();
595+ e.event_time = std::chrono::system_clock::to_time_t (now);
596+ e.event_time_microseconds = timeInMicroseconds (now);
597+ e.event_type = toString (ev.type );
598+ e.disk_name = disk;
599+ e.namespace_ = std::move (ev.namespace_ );
600+ e.ref_name = std::move (ev.ref_name );
601+ e.object_kind = toString (ev.object_kind );
602+ e.object_hash = std::move (ev.object_hash );
603+ e.token = std::move (ev.token );
604+ e.round = ev.round ;
605+ e.gen = ev.gen ;
606+ e.at_version = ev.at_version ;
607+ e.outcome = std::move (ev.outcome );
608+ e.reason = std::move (ev.reason );
609+ e.thread_id = getThreadId ();
610+ e.query_id = CurrentThread::getQueryId ();
611+ e.detail = std::move (ev.detail );
612+ });
611613 };
612614}
613615
0 commit comments