All of lore.kernel.org
 help / color / mirror / Atom feed
* output file not truncated
@ 2011-09-08  4:13 Henry C Chang
  2011-09-08  4:41 ` Sage Weil
  0 siblings, 1 reply; 3+ messages in thread
From: Henry C Chang @ 2011-09-08  4:13 UTC (permalink / raw)
  To: ceph-devel

Hi,

Finally got some time to play around ceph.
I found that: when I dumped osd status by: ceph osd dump -o
/tmp/dump.json --format=json, I got some garbage data in the end of
file.
Thus, I checked the code. I noticed that the output file was not
truncated in ceph_tool_cli_input:

  // Write to a file. Don't truncate the file.
  int fd = TEMP_FAILURE_RETRY(::open(outfile, O_WRONLY|O_CREAT|O_TRUNC, 0644));

Since it seems intended, I was wondering why. After all, in my case, I
found it causing problems.

Henry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: output file not truncated
  2011-09-08  4:13 output file not truncated Henry C Chang
@ 2011-09-08  4:41 ` Sage Weil
  2011-09-08  4:50   ` Henry C Chang
  0 siblings, 1 reply; 3+ messages in thread
From: Sage Weil @ 2011-09-08  4:41 UTC (permalink / raw)
  To: Henry C Chang; +Cc: ceph-devel

On Thu, 8 Sep 2011, Henry C Chang wrote:
> Hi,
> 
> Finally got some time to play around ceph.
> I found that: when I dumped osd status by: ceph osd dump -o
> /tmp/dump.json --format=json, I got some garbage data in the end of
> file.
> Thus, I checked the code. I noticed that the output file was not
> truncated in ceph_tool_cli_input:
> 
>   // Write to a file. Don't truncate the file.
>   int fd = TEMP_FAILURE_RETRY(::open(outfile, O_WRONLY|O_CREAT|O_TRUNC, 0644));
> 
> Since it seems intended, I was wondering why. After all, in my case, I
> found it causing problems.

There was a recent change that lets you stack up commands, separated 
by ';':

 $ ceph pg stat \; osd stat

Basically we were lazy and reopened the output file inside the loop.

Just pushed a patch cleaning it up some!

sage


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: output file not truncated
  2011-09-08  4:41 ` Sage Weil
@ 2011-09-08  4:50   ` Henry C Chang
  0 siblings, 0 replies; 3+ messages in thread
From: Henry C Chang @ 2011-09-08  4:50 UTC (permalink / raw)
  To: Sage Weil; +Cc: ceph-devel

2011/9/8 Sage Weil <sage@newdream.net>:
> On Thu, 8 Sep 2011, Henry C Chang wrote:
>> Hi,
>>
>> Finally got some time to play around ceph.
>> I found that: when I dumped osd status by: ceph osd dump -o
>> /tmp/dump.json --format=json, I got some garbage data in the end of
>> file.
>> Thus, I checked the code. I noticed that the output file was not
>> truncated in ceph_tool_cli_input:
>>
>>   // Write to a file. Don't truncate the file.
>>   int fd = TEMP_FAILURE_RETRY(::open(outfile, O_WRONLY|O_CREAT|O_TRUNC, 0644));
>>
>> Since it seems intended, I was wondering why. After all, in my case, I
>> found it causing problems.
>
> There was a recent change that lets you stack up commands, separated
> by ';':
>
>  $ ceph pg stat \; osd stat

Cool. It's quite useful.

>
> Basically we were lazy and reopened the output file inside the loop.
>
> Just pushed a patch cleaning it up some!
>

Thanks.

Henry
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-09-08  4:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-08  4:13 output file not truncated Henry C Chang
2011-09-08  4:41 ` Sage Weil
2011-09-08  4:50   ` Henry C Chang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.