summaryrefslogtreecommitdiffstats
path: root/queue.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-01-11 14:48:15 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-01-11 14:48:15 +0000
commitf38f69b82c82ef61ff6d1da748a655e08b43cf53 (patch)
tree7bde3d6287600f4d920240428751a2eb43a694ec /queue.c
parentdd575394dba4f1943a5185a5f40750a4293b7203 (diff)
downloadrsyslog-f38f69b82c82ef61ff6d1da748a655e08b43cf53.tar.gz
rsyslog-f38f69b82c82ef61ff6d1da748a655e08b43cf53.tar.xz
rsyslog-f38f69b82c82ef61ff6d1da748a655e08b43cf53.zip
queue can now persist disk queue information on immediate shutdown
Diffstat (limited to 'queue.c')
-rw-r--r--queue.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/queue.c b/queue.c
index 91d89b06..91ffe18d 100644
--- a/queue.c
+++ b/queue.c
@@ -619,11 +619,15 @@ static rsRetVal queuePersist(queue_t *pThis)
strm_t *psQIF; /* Queue Info File */
uchar pszQIFNam[MAXFNAME];
size_t lenQIFNam;
+ int i;
assert(pThis != NULL);
if(pThis->iQueueSize == 0)
FINALIZE; /* nothing left to do, so be happy */
+ if(pThis->qType != QUEUETYPE_DISK)
+ ABORT_FINALIZE(RS_RET_NOT_IMPLEMENTED); /* TODO: later... */
+
dbgprintf("Queue 0x%lx: persisting queue to disk, %d entries...\n", queueGetID(pThis), pThis->iQueueSize);
/* Construct file name */
lenQIFNam = snprintf((char*)pszQIFNam, sizeof(pszQIFNam) / sizeof(uchar), "%s/%s.qi",
@@ -635,8 +639,18 @@ static rsRetVal queuePersist(queue_t *pThis)
CHKiRet(strmSetFName(psQIF, pszQIFNam, lenQIFNam));
CHKiRet(strmConstructFinalize(psQIF));
- /* first, write the property bag for ourselfs */
+ /* first, write the property bag for ourselfs
+ * And, surprisingly enough, we currently need to persist only the size of the
+ * queue. All the rest is re-created with then-current config parameters when the
+ * queue is re-created. Well, we'll also save the current queue type, just so that
+ * we know when somebody has changed the queue type... -- rgerhards, 2008-01-11
+ */
CHKiRet(objBeginSerializePropBag(psQIF, (obj_t*) pThis));
+ i = 2; /* we serialize the number of properties, so that we know when we read the propbag */
+ objSerializeSCALAR_VAR(psQIF, NumberPropertyBagRecrods, INT, i);
+ i = pThis->qType;
+ objSerializeSCALAR_VAR(psQIF, qType, INT, i);
+ objSerializeSCALAR(psQIF, iQueueSize, INT);
CHKiRet(objEndSerialize(psQIF));
/* this is disk specific and must be moved to a function */