MCPcopy Create free account
hub / github.com/apache/trafficserver / RecSyncStatsFile

Function RecSyncStatsFile

src/records/P_RecCore.cc:330–360  ·  view source on GitHub ↗

------------------------------------------------------------------------- RecSyncStatsFile -------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

328// RecSyncStatsFile
329//-------------------------------------------------------------------------
330RecErrT
331RecSyncStatsFile()
332{
333 RecRecord *r;
334 RecMessage *m;
335 int i, num_records;
336 bool sync_to_disk;
337 ats_scoped_str snap_fpath(RecConfigReadPersistentStatsPath());
338
339 m = RecMessageAlloc(RECG_NULL);
340 num_records = g_num_records;
341 sync_to_disk = false;
342 for (i = 0; i < num_records; i++) {
343 r = &(g_records[i]);
344 rec_mutex_acquire(&(r->lock));
345 if (REC_TYPE_IS_STAT(r->rec_type)) {
346 if (r->stat_meta.persist_type == RECP_PERSISTENT) {
347 m = RecMessageMarshal_Realloc(m, r);
348 sync_to_disk = true;
349 }
350 }
351 rec_mutex_release(&(r->lock));
352 }
353 if (sync_to_disk) {
354 RecDebug(DL_Note, "Writing '%s' [%d bytes]", (const char *)snap_fpath, m->o_write - m->o_start + sizeof(RecMessageHdr));
355 RecMessageWriteToDisk(m, snap_fpath);
356 }
357 RecMessageFree(m);
358
359 return REC_ERR_OKAY;
360}
361
362// Consume a parsed record, pushing it into the records hash table.
363static void

Callers 1

syncMethod · 0.85

Calls 7

RecMessageAllocFunction · 0.85
rec_mutex_acquireFunction · 0.85
rec_mutex_releaseFunction · 0.85
RecMessageWriteToDiskFunction · 0.85
RecMessageFreeFunction · 0.85

Tested by

no test coverage detected