diff --git a/src/bin/pg_resetxlog/pg_resetxlog.c b/src/bin/pg_resetxlog/pg_resetxlog.c
index 54cc5b0..a094490 100644
--- a/src/bin/pg_resetxlog/pg_resetxlog.c
+++ b/src/bin/pg_resetxlog/pg_resetxlog.c
@@ -74,6 +74,7 @@ static void KillExistingXLOG(void);
 static void KillExistingArchiveStatus(void);
 static void WriteEmptyXLOG(void);
 static void usage(void);
+static void ensure_multi(MultiXactId multi);
 
 
 int
@@ -325,7 +326,10 @@ main(int argc, char *argv[])
 		ControlFile.checkPointCopy.nextOid = set_oid;
 
 	if (set_mxid != 0)
+	{
 		ControlFile.checkPointCopy.nextMulti = set_mxid;
+		ensure_multi(set_mxid);
+	}
 
 	if (set_mxoff != -1)
 		ControlFile.checkPointCopy.nextMultiOffset = set_mxoff;
@@ -1013,6 +1017,43 @@ WriteEmptyXLOG(void)
 	close(fd);
 }
 
+static void
+ensure_multi(MultiXactId multi)
+{
+	char	path[MAXPGPATH];
+	int		fd;
+	char	abyte;
+	int		offset;
+
+#define SLRU_PAGES_PER_SEGMENT	32
+#define MULTIXACT_OFFSETS_PER_PAGE	(BLCKSZ / sizeof(MultiXactOffset))
+#define MultiXactIdToOffsetPage(xid) \
+	((xid) / (MultiXactOffset) MULTIXACT_OFFSETS_PER_PAGE)
+
+	snprintf(path, MAXPGPATH, "pg_multixact/offsets/%04X",
+			 MultiXactIdToOffsetPage(multi) / SLRU_PAGES_PER_SEGMENT);
+	if ((fd = open(path, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR)) < 0)
+	{
+		fprintf(stderr, _("%s: could not open file \"%s\" for writing: %s\n"),
+				progname, path, strerror(errno));
+		exit(1);
+	}
+	offset = (((multi % (SLRU_PAGES_PER_SEGMENT * MULTIXACT_OFFSETS_PER_PAGE)) / MULTIXACT_OFFSETS_PER_PAGE) + 1) * BLCKSZ - 1;
+	if (lseek(fd, offset, SEEK_SET) < 0)
+	{
+		fprintf(stderr, _("%s: could not seek in file \"%s\" to offset %u: %s\n"),
+				progname, path, offset, strerror(errno));
+		exit(1);
+	}
+	abyte = '\0';
+	if (write(fd, &abyte, 1) != 1)
+	{
+		fprintf(stderr, _("%s: could not write one byte in file \"%s\": %s\n"),
+				progname, path, strerror(errno));
+		exit(1);
+	}
+	close(fd);
+}
 
 static void
 usage(void)
