Just curious... couldn&#39;t you simply build or use one of the existing Database filesystems that work with Fuse?  Then you could mount a filesystem whose backend is Postgres.<div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><a href="http://sourceforge.net/apps/mediawiki/fuse/index.php?title=DatabaseFileSystems">http://sourceforge.net/apps/mediawiki/fuse/index.php?title=DatabaseFileSystems</a></div></blockquote><div><br></div><div>The postgres FUSE project seems to be dead, but these seem to be pretty simple to create.  This would mean that all existing tools such as Cacti would not need any changes and migrating to such a setup would require only a cp /olddirectory/* /sqlbackeddirectory/</div>
<div><br></div><div>I would hope that a database backed filesystem would also be able to take advantage of filesystem caches at the OS-level which might be a free performance gain.</div><div><br></div><div>Good luck,</div>
<div><br></div><div>Anthony</div><div><div><br><div class="gmail_quote">On Tue, Sep 11, 2012 at 7:44 PM, Dustin Fisch <span dir="ltr">&lt;<a href="mailto:fooker@lab.sh" target="_blank">fooker@lab.sh</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
<br>
Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt; wrote:<br>
<br>
&gt; Hi Dustin,<br>
&gt;<br>
&gt; Yesterday Dustin Fisch wrote:<br>
&gt;<br>
&gt; &gt; Hi,<br>
&gt; &gt;<br>
&gt; &gt; I am currently thinking about building an RRD extension for<br>
&gt; &gt; PostgreSQL.<br>
&gt; &gt;<br>
&gt; &gt; The extension will provide a RRD data type which represents a<br>
&gt; &gt; complete database and functions for all the existing functions of<br>
&gt; &gt; the RRD tool, like create, update, first and graph...<br>
&gt; &gt;<br>
&gt; &gt; PostgreSQL has a nice API for LOB, which allows to store the whole<br>
&gt; &gt; RRD database using the PostgreSQL file management.<br>
&gt; &gt;<br>
&gt; &gt; I already have taken a look to the RRD code. As far as I can see,<br>
&gt; &gt; there are functions like rrd_create_r(...) which provides the<br>
&gt; &gt; functionality I need for such an extension.<br>
&gt; &gt;<br>
&gt; &gt; The PostgreSQL LOB API currently provides a file descriptor for the<br>
&gt; &gt; access to the data stored in the LOB.<br>
&gt; &gt;<br>
&gt; &gt; Unfortunately, it looks like the RRD API only allows the usage of a<br>
&gt; &gt; filename.<br>
&gt; &gt;<br>
&gt; &gt; Is there any way to use a file descriptor instead of the filename?<br>
&gt; &gt; Or is there any chance such a patch would be accepted?<br>
&gt;<br>
&gt; if done nicely, I&#39;ll be glad to integrate such a patch ... I guess<br>
&gt; you would have to compile without mmap support ...<br>
</div>I&#39;m not sure about mmap. I think I have to try it.<br>
<br>
The plan for the patch is to refactoring the rrd_*_r methods by moving<br>
out the real work of the method into something called rrd_*_x. The only<br>
thing remaining in the original method are the calls to rrd_open and<br>
rrd_close and the call to the new method.<br>
<br>
The new rrd_*_x methods will mirror the interface of there rrd_*_r<br>
counterparts expect the filename parameter, which will be replaced by<br>
the already opened rrd_file_t.<br>
<div class="im"><br>
&gt;<br>
&gt; how would this pg integration work, would the rrd data be stored in<br>
&gt; a blob ? wouldn&#39;t this get read from disk entirely on every update<br>
&gt; and make things rather slow ?<br>
</div>Right. The idea is to store the RRD data in a BLOB.<br>
<br>
But I don&#39;t see any performance problem with this as a PostgreSQL<br>
extension is allowed to work on the file backing the BLOB directly<br>
using a file descriptor.<br>
<br>
This makes no difference to the way RRDtool currently works. Maybe this<br>
allows to to use the current mmap code, too.<br>
<br>
&gt;<br>
&gt; cheers<br>
&gt; tobi<br>
&gt;<br>
&gt;<br>
<br>
cheers<br>
fooker<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
<a href="http://lab.sh" target="_blank">http://lab.sh</a><br>
</font></span><br>_______________________________________________<br>
rrd-developers mailing list<br>
<a href="mailto:rrd-developers@lists.oetiker.ch">rrd-developers@lists.oetiker.ch</a><br>
<a href="https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers" target="_blank">https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers</a><br>
<br></blockquote></div><br></div></div>