[
https://issues.apache.org/jira/browse/TS-2471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13864082#comment-13864082
]
James Peach edited comment on TS-2471 at 1/7/14 5:59 PM:
---------------------------------------------------------
RecFileWrite is a wrapper for system call write. the codes as:
{code}
93 int
94 RecFileWrite(RecHandle h_file, char *buf, int size, int *bytes_written)
95 {
96 if ((*bytes_written =::write(h_file, buf, size)) < 0) {
97 *bytes_written = 0;
98 return REC_ERR_FAIL;
99 }
100 return REC_ERR_OKAY;
101 }
{code}
I don't think we should change these codes.
was (Author: happy_fish100):
RecFileWrite is a wrapper for system call write. the codes as:
93 int
94 RecFileWrite(RecHandle h_file, char *buf, int size, int *bytes_written)
95 {
96 if ((*bytes_written =::write(h_file, buf, size)) < 0) {
97 *bytes_written = 0;
98 return REC_ERR_FAIL;
99 }
100 return REC_ERR_OKAY;
101 }
I don't think we should change these codes.
> records.config becomes empty when the disk full
> -----------------------------------------------
>
> Key: TS-2471
> URL: https://issues.apache.org/jira/browse/TS-2471
> Project: Traffic Server
> Issue Type: Bug
> Components: Management
> Reporter: Yu Qing
> Assignee: Yu Qing
> Fix For: 4.2.0
>
> Attachments: 0001-TS-2471-records.config-becomes-empty-V2.patch,
> 0001-TS-2471-records.config-becomes-empty-when-the-disk-f.patch
>
>
> we change the config parameters in cluster then the config file
> records.config becomes empty in race case when the system disk is full.
> in {{lib/records/RecLocal.cc}} and {{lib/records/RecProcess.cc}}:
> records.config maybe empty when the disk is full because we write
> records.config directly. we should write to a temp file, then rename it to
> records.config.
> one of the codes as:
> {code}
> int nbytes;
> RecDebug(DL_Note, "Writing '%s'", g_rec_config_fpath);
> RecHandle h_file = RecFileOpenW(g_rec_config_fpath);
> RecFileWrite(h_file, tb->bufPtr(), tb->spaceUsed(), &nbytes);
> RecFileClose(h_file);
> {code}
> in {{mgmt/Rollback.cc}}: we check the result of write, but do NOT check the
> return code of fsync and close.
> the codes as:
> {code}
> 466 // Write the buffer into the new configuration file
> 467 writeBytes = write(diskFD, buf->bufPtr(), buf->spaceUsed());
> 468 closeFile(diskFD);
> 469 if (writeBytes != buf->spaceUsed()) {
> 470 mgmt_log(stderr, "[Rollback::intrernalUpdate] Unable to write new
> version of %s : %s\n", fileName, strerror(errno));
> 471 returnCode = SYS_CALL_ERROR_ROLLBACK;
> 472 goto UPDATE_CLEANUP;
> 473 }
> {code}
> we should check the result of {{closeFile(diskFD)}}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)