[ejabberd] pubsub_item.DAT getting big

Stephan Maihöfer sma at turtle-entertainment.de
Thu Oct 2 16:19:00 MSD 2008


hi,

thanks for picking up on me again, if you want to
discuss this off-list dont bother to answer me in
personal or suggest some other means of communication.

> Le 2 oct. 08 à 13:37, Stephan Maihöfer a écrit :
> >
> > looks like it does, or not? how is 0 interpreted in erlang is it 
> > false?
> >
> In erlang false is false and 0 is 0, and are not equivalent.

yeah, i thought so, weird thing is, when configure my node
like this:

<iq type="set"
      from="user at example.com"
      to="pubsub.example.com"
      id="config2">
 <pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
  <configure node="/examplenode/3509130" >
   <x xmlns="jabber:x:data" type="submit" >
    <field type="hidden" label="" var="FORM_TYPE" >
     <value>http://jabber.org/protocol/pubsub#node_config</value>
    </field>
    [...]
    <field var="pubsub#persist_items" ><value>false</value></field>
    <field var="pubsub#max_items" ><value>2</value></field>
    [...]
   </x>
  </configure>
 </pubsub>
</iq>

and immediately afterwards ask for the configuration form of the node,
i get this:

<iq from="pubsub.example.com" type="result" to="user at example.com" id="config1" >
<pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
<configure node="/examplenode/3509130" >
<x xmlns="jabber:x:data" type="form" >
<field type="hidden" label="" var="FORM_TYPE" >
<value>http://jabber.org/protocol/pubsub#node_config</value>
</field>
[...]
<field type="boolean" label="Persist items to storage" var="pubsub#persist_items" >
<value>0</value>
</field>
<field type="text-single" label="Max # of items to persist" var="pubsub#max_items" >
<value>2</value>
</field>
[...]
</x>
</configure>
</pubsub>
</iq>

so either it does not accept my config or the "false" get's translated into
a 0...that's why i was confused.

> The removing of items is only done when a new item has been published.

yes, still i can keep publishing items to the node and nothing changes,
items get appended and it is as if #persist_items and #max_items
is not being respected at all:

<iq from="pubsub.example.com" type="result" to="user at example.com" id="items1" >
<query xmlns="http://jabber.org/protocol/disco#items" node="/www.esl.eu/de/cs/gather/3509130" >
<item node="/examplenode/3509130!4C6E76799CB56" name="4C6E76799CB56" jid="pubsub.example.com" />
<item node="/examplenode/3509130!4C6E77AE3F49" name="4C6E77AE3F49" jid="pubsub.example.com" />
<item node="/examplenode/3509130!4C6E779F3D5C2" name="4C6E779F3D5C2" jid="pubsub.example.com" />
<item node="/examplenode/3509130!4C6E77A9A1D38" name="4C6E77A9A1D38" jid="pubsub.example.com" />
<item node="/examplenode/3509130!4C6E79F7872F2" name="4C6E79F7872F2" jid="pubsub.example.com" />
<item node="/examplenode/3509130!4C6E77B9B7DB1" name="4C6E77B9B7DB1" jid="pubsub.example.com" />
<item node="/examplenode/3509130!4C6E77B4C7411" name="4C6E77B4C7411" jid="pubsub.example.com" />
</query>
</iq>
 
> publish_item calls remove_extra_items which actually deletes 
> the items.
> Changing the setting without publishing a new item on the 
> node does nothing.

yeah, i figured that from remove_extra_items only being called
from publish_item in mod_pubsub.erl

> Also make sure that the max_items value stored in the 
> pubsub_nodes mnesia table are also set to the value you want 
> and not set to unlimited.

how can i check that?

> You have a custom node ?
> Maybe you could send the code over, or at least the relevant 
> bits (publish_item and remove_extra_items)

you can check the code of out node plugin here:

  http://dev.esl.eu/blog/wp-content/uploads/2008/07/node_flat.erl

relevant functions only delegate to node_default.erl:

publish_item(Host, Node, Publisher, Model, MaxItems, ItemId, Payload) ->
    node_default:publish_item(Host, Node, Publisher, Model, MaxItems, ItemId, Payload).

remove_extra_items(Host, Node, MaxItems, ItemIds) ->
    node_default:remove_extra_items(Host, Node, MaxItems, ItemIds).

thanks for taking the time,
stephan


More information about the ejabberd mailing list