Skip to content
Snippets Groups Projects
Commit 1d2ded45 authored by Moe Jette's avatar Moe Jette
Browse files

Add logic to save high buffer size for state save and eliminate buffer growth and copies

parent 33ef9aea
No related branches found
No related tags found
No related merge requests found
......@@ -280,6 +280,7 @@ static void _delete_job_desc_files(uint32_t job_id)
* RET 0 or error code */
int dump_all_job_state(void)
{
/* Save high-water mark to avoid buffer growth with copies */
static int high_buffer_size = (1024 * 1024);
int error_code = 0, log_fd;
char *old_file, *new_file, *reg_file;
......
......@@ -5,7 +5,7 @@
* configuration list (config_list)
*****************************************************************************
* Copyright (C) 2002-2007 The Regents of the University of California.
* Copyright (C) 2008 Lawrence Livermore National Security.
* Copyright (C) 2008-2009 Lawrence Livermore National Security.
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
* Written by Morris Jette <jette1@llnl.gov>, et. al.
* LLNL-CODE-402394.
......@@ -241,12 +241,14 @@ static int _delete_config_record (void)
/* dump_all_node_state - save the state of all nodes to file */
int dump_all_node_state ( void )
{
/* Save high-water mark to avoid buffer growth with copies */
static int high_buffer_size = (1024 * 1024);
int error_code = 0, inx, log_fd;
char *old_file, *new_file, *reg_file;
/* Locks: Read config and node */
slurmctld_lock_t node_read_lock = { READ_LOCK, NO_LOCK, READ_LOCK,
NO_LOCK };
Buf buffer = init_buf(BUF_SIZE*16);
Buf buffer = init_buf(high_buffer_size);
DEF_TIMERS;
START_TIMER;
......@@ -281,7 +283,7 @@ int dump_all_node_state ( void )
} else {
int pos = 0, nwrite = get_buf_offset(buffer), amount;
char *data = (char *)get_buf_data(buffer);
high_buffer_size = MAX(nwrite, high_buffer_size);
while (nwrite > 0) {
amount = write(log_fd, &data[pos], nwrite);
if ((amount < 0) && (errno != EINTR)) {
......
......@@ -282,6 +282,8 @@ static int _delete_part_record(char *name)
/* dump_all_part_state - save the state of all partitions to file */
int dump_all_part_state(void)
{
/* Save high-water mark to avoid buffer growth with copies */
static int high_buffer_size = BUF_SIZE;
ListIterator part_iterator;
struct part_record *part_ptr;
int error_code = 0, log_fd;
......@@ -289,7 +291,7 @@ int dump_all_part_state(void)
/* Locks: Read partition */
slurmctld_lock_t part_read_lock =
{ READ_LOCK, NO_LOCK, NO_LOCK, READ_LOCK };
Buf buffer = init_buf(BUF_SIZE);
Buf buffer = init_buf(high_buffer_size);
DEF_TIMERS;
START_TIMER;
......@@ -327,7 +329,7 @@ int dump_all_part_state(void)
} else {
int pos = 0, nwrite = get_buf_offset(buffer), amount;
char *data = (char *)get_buf_data(buffer);
high_buffer_size = MAX(nwrite, high_buffer_size);
while (nwrite > 0) {
amount = write(log_fd, &data[pos], nwrite);
if ((amount < 0) && (errno != EINTR)) {
......
......@@ -524,6 +524,7 @@ unpack_error:
}
extern int trigger_state_save(void)
{
/* Save high-water mark to avoid buffer growth with copies */
static int high_buffer_size = (1024 * 1024);
int error_code = 0, log_fd;
char *old_file, *new_file, *reg_file;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment