Only 100 msgs stored in table msg_history

shir Hu
Added almost 4 years ago


When I try to send 100,000 msgs to offline users, I found that there wad only 100 msgs in table msg_history. Can you tell me if need to change config to store all offline msgs? Thanks.

Replies (4)

Added by Wojciech Kapcia TigaseTeam almost 4 years ago

yes, this can be configured via:


Added by Luca Stucchi almost 4 years ago

Hi Wojciech,

this is true, but I found out a "not so nice" implication related with this message count. Before each insert we have a select

select count(*) from msg_history where receiver_uid = 3 and sender_uid = 1

insert into msg_history ( expired, sender_uid, receiver_uid, message) values (\'2015-11-02 08:00:00.0\', 1, 3, \'<message id=\"t8NHK-12790\" from=\"\" xmlns=\"jabber:client\" to=\"\"><subject>subject</subject><body>Flooding is good, from time to time</body><request xmlns=\"urn:xmpp:receipts\"/><amp xmlns=\"\"><rule condition=\"expire-at\" value=\"2015-11-02T08:00:00Z\" action=\"error\"/><rule condition=\"match-resource\" value=\"other\" action=\"error\"/></amp><delay from=\"\" xmlns=\"urn:xmpp:delay\" stamp=\"2015-02-16T15:14:18.985Z\">Offline Storage</delay></message>\')'

This line of action strikes badly on performance, especially on systems that make extensive use of AMP storage. What if I wanted to skip this check and just proceed to insert the row, trusting that there will be space on the storage device and being aware that once connected, the device could be flooded ?

My question, to be more precise, is:

How do you guys feel about inserting the OPTIONAL possibility of skipping this check with a dedicated component property ? For my project, I think I'll have to implement this logic: In case you think this could be useful for all the tigase users , I'd like to implement this and propose it to incorporated in the official tigase code... we all love open source ! Would it be OK for you ?



Added by Wojciech Kapcia TigaseTeam almost 4 years ago

We are all open for extensibility, having this as an option (maybe something like @amp/store-limit[S]=0@, to disable limit) can be a good idea. You can submit a patch as the issue with the Source Code Disclaimer and we can then incorporate it.

Added by Luca Stucchi almost 4 years ago

Hi Wojciech,

I just submitted a patch that you can find on

As you suggested, if I set the store_limit to 0 tigase will just ignore the limit, won't perform the select and proceed to store the message.

Let me know if the patch that I attached is OK.

All the best,