diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c
index 1c49c63444..3934978b97 100644
--- a/src/bin/pg_upgrade/pg_upgrade.c
+++ b/src/bin/pg_upgrade/pg_upgrade.c
@@ -857,10 +857,7 @@ copy_xact_xlog_xid(void)
 		pfree(new_path);
 	}
 	else
-		copy_subdir_files(GET_MAJOR_VERSION(old_cluster.major_version) <= 906 ?
-						  "pg_clog" : "pg_xact",
-						  GET_MAJOR_VERSION(new_cluster.major_version) <= 906 ?
-						  "pg_clog" : "pg_xact");
+		copy_subdir_files(GetClogDirName(old_cluster), GetClogDirName(new_cluster));
 
 	prep_status("Setting oldest XID for new cluster");
 	exec_prog(UTILITY_LOG_FILE, NULL, true, true,
