fa1179c
From bdbbb4be07bb33fe083baef2bd0ef38b91c11120 Mon Sep 17 00:00:00 2001
fa1179c
From: Pavel Zhukov <pzhukov@redhat.com>
fa1179c
Date: Thu, 21 Feb 2019 10:44:06 +0100
fa1179c
Subject: [PATCH 21/28] Load leases DB in non-replay mode only
7c09728
fa1179c
---
fa1179c
 server/confpars.c | 12 ++++++++++--
fa1179c
 1 file changed, 10 insertions(+), 2 deletions(-)
7c09728
3ccf3c8
diff --git a/server/confpars.c b/server/confpars.c
fa1179c
index 5a6396b..6e08ad7 100644
3ccf3c8
--- a/server/confpars.c
3ccf3c8
+++ b/server/confpars.c
3ccf3c8
@@ -134,6 +134,11 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
3ccf3c8
 
3ccf3c8
 	cfile = (struct parse *)0;
3ccf3c8
 #if defined (TRACING)
3ccf3c8
+	// No need to dmalloc huge memory region if we're not going to re-play
b58c84c
+	if (!trace_record()){
3ccf3c8
+		status = new_parse(&cfile, file, NULL, 0, filename, 0);
3ccf3c8
+		goto noreplay;
3ccf3c8
+	};
3ccf3c8
 	flen = lseek (file, (off_t)0, SEEK_END);
3ccf3c8
 	if (flen < 0) {
3ccf3c8
 	      boom:
b58c84c
@@ -165,7 +170,6 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
b58c84c
 	if (result != ulen)
b58c84c
 		log_fatal ("%s: short read of %d bytes instead of %d.",
b58c84c
 			   filename, ulen, result);
b58c84c
-	close (file);
b58c84c
       memfile:
b58c84c
 	/* If we're recording, write out the filename and file contents. */
3ccf3c8
 	if (trace_record ())
b58c84c
@@ -174,6 +178,9 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
3ccf3c8
 #else
3ccf3c8
 	status = new_parse(&cfile, file, NULL, 0, filename, 0);
3ccf3c8
 #endif
7c09728
+      noreplay:
b58c84c
+	if (!trace_playback())
b58c84c
+		close (file);
7c09728
 	if (status != ISC_R_SUCCESS || cfile == NULL)
7c09728
 		return status;
7c09728
 
b58c84c
@@ -183,7 +190,8 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
3ccf3c8
 		status = conf_file_subparse (cfile, group, group_type);
3ccf3c8
 	end_parse (&cfile);
b58c84c
 #if defined (TRACING)
3ccf3c8
-	dfree (dbuf, MDL);
b58c84c
+	if (trace_record())
b58c84c
+	    dfree (dbuf, MDL);
b58c84c
 #endif
3ccf3c8
 	return status;
3ccf3c8
 }
fa1179c
-- 
fa1179c
2.35.1
fa1179c