fellow_log: rewrite the log for a clean shutdown

parent fcf13605
......@@ -6110,11 +6110,13 @@ fellow_logwatcher_thread(void *priv)
while (ffd->watcher_running) {
fellow_fd_update_space_stats(ffd);
if (new_log_fdr.size)
if (new_log_fdr.size || ffd->watcher_running == 2)
need = FLW_NEED_REWRITE;
else
need = fellow_logwatcher_need(ffd, NULL);
ffd->watcher_running = 1;
switch (need) {
case FLW_NEED_NONE:
DBG("logwatcher %s", "FLW_NEED_NONE");
......@@ -6140,10 +6142,7 @@ fellow_logwatcher_thread(void *priv)
fellow_logwatcher_flush(ffd, 0);
ffd->watcher_state = FLW_S_REWRITING;
AZ(pthread_mutex_unlock(&ffd->logmtx));
if (new_log_fdr.size ||
fellow_logwatcher_need(ffd, NULL) == need)
fellow_logs_rewrite(ffd, &new_log_fdr,
NULL, NULL);
fellow_logs_rewrite(ffd, &new_log_fdr, NULL, NULL);
AZ(pthread_mutex_lock(&ffd->logmtx));
continue;
default:
......@@ -6221,10 +6220,20 @@ fellow_logwatcher_fini(struct fellow_fd *ffd)
{
CHECK_OBJ_NOTNULL(ffd, FELLOW_FD_MAGIC);
AZ(pthread_mutex_lock(&ffd->logmtx));
ffd->watcher_running = 2;
AZ(pthread_cond_signal(&ffd->watcher_cond));
AZ(pthread_mutex_unlock(&ffd->logmtx));
while (ffd->watcher_running == 2)
(void) usleep (100*1000);
assert(ffd->watcher_running == 1);
AZ(pthread_mutex_lock(&ffd->logmtx));
ffd->watcher_running = 0;
AZ(pthread_cond_signal(&ffd->watcher_cond));
AZ(pthread_mutex_unlock(&ffd->logmtx));
AZ(pthread_join(ffd->watcher_thread, NULL));
AZ(pthread_cond_destroy(&ffd->watcher_cond));
}
......
......@@ -488,7 +488,10 @@ Resizing fellow storage
In general, resizing a fellow storage is supported by restarting
varnishd with different parameters (be it on the command line or in
VCL), but for size reductions, cache contents may be lost, to the
extent of all cache contents. Read this paragraph for details:
extent of all cache contents. Read this paragraph for details.
Before applying any size change, it is strongly recommended to cleanly
shut down fellow using ``varnishadm stop``.
Increasing ``memsize``
......
......@@ -432,7 +432,10 @@ Resizing fellow storage
In general, resizing a fellow storage is supported by restarting
varnishd with different parameters (be it on the command line or in
VCL), but for size reductions, cache contents may be lost, to the
extent of all cache contents. Read this paragraph for details:
extent of all cache contents. Read this paragraph for details.
Before applying any size change, it is strongly recommended to cleanly
shut down fellow using ``varnishadm stop``.
Increasing ``memsize``
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment