PtokaX forum

PtokaX => Feature Proposals => Topic started by: WAJIM on 08 January, 2010, 15:56:48

Title: Optional ignoring of RegBase autosave
Post by: WAJIM on 08 January, 2010, 15:56:48
After calling RegMan.AddReg/DelReg/ChangeReg funtions HUB automatically call RegMan.Save function to save base on HDD.

When I calling RegMan.DelReg on my HUB with RegBase ~5000 users, removal of Regs works very slowly (~5 Regs/second) because of write of base on a HDD after every DelReg.

I suggest to make optional ignoring of autosave RegBase after RegMan.AddReg/DelReg/ChangeReg funtions.

Example: RegMan.DelReg(sNick, bNoSave) or RegMan.DelRegFast(sNick)
Title: Re: Optional ignoring of RegBase autosave
Post by: Enuri on 08 January, 2010, 16:29:17
Agree with WAJIM. Recently i removed about ~8000 regs, i had use timer to clear reg base on working hub.

Also, i don't want to create a new topic, so how about make a ProfMan.Save() function? Now only shutdown or restart saves profiles.
Title: Re: Optional ignoring of RegBase autosave
Post by: Enuri on 08 January, 2010, 16:48:46
Quote from: Mutor on 08 January, 2010, 16:38:41
Why would you delete 8000 registered accounts?
I see no practical or reasonable cause for this.
Just to delete regs that are not used for a long time... Less regs gives a best performance, i think :)
Title: Re: Optional ignoring of RegBase autosave
Post by: WAJIM on 08 January, 2010, 16:56:18
Quote from: Mutor on 08 January, 2010, 16:38:41
Why would you delete 8000 registered accounts?
No, every month invokes purging function, that removes unused accounts, ~100-300.  ::)

QuoteAnd if the hub should fail by script or system issues before a save is made
These are my problems.  :P
Title: Re: Optional ignoring of RegBase autosave
Post by: Enuri on 08 January, 2010, 16:59:43
Quote from: Mutor on 08 January, 2010, 16:57:21dump 8k users at once is foolish.
Yes. But it's first time when i clear my reg base  ;D

So, if some linux user needs this function now:

0) Create a backup  ;D
1) open src/LuaRegManLib.cpp
2) Find function started with static int DelReg(lua_State * L)
3) Copy this function with new name like static int DelRegFast(lua_State * L)
4) Delete hashRegManager->Save(); in the end of the function
5) Find static const luaL_reg regman_funcs[] =  {
6) Add { "DelRegFast", DelRegFast }, to this array
7) Compile and enjoy :)
Title: Re: Optional ignoring of RegBase autosave
Post by: WAJIM on 08 January, 2010, 17:04:57
Quote from: Mutor on 08 January, 2010, 16:57:21
but it would seem your problems and WAJIM's may well be due to poor scripting methods.
No, I well see, how the size of RegisteredUsers.xml changes in a range from 0 up to 800K many times when I make many RegMan.DelReg calls.
Title: Re: Optional ignoring of RegBase autosave
Post by: Enuri on 08 January, 2010, 17:14:08
Quote from: Mutor on 08 January, 2010, 17:05:03Add to that the risk of losing changes made on crash
Following this logic, why settings and bans aren't saved automatically after calling SetMan.Set... ?

Quote from: Mutor on 08 January, 2010, 17:05:03
. Is everyone in Russia crazy?  :P
Oh, yes  ;D
Title: Re: Optional ignoring of RegBase autosave
Post by: WAJIM on 08 January, 2010, 17:16:19
Quote from: Mutor on 08 January, 2010, 17:08:23
Well that's the point, properly coded, you would never BE making many DelReg calls.
No, simply the hub should process function correctly, instead of through an ass.  :-*

QuoteThe xml file will be the size it needs to be when you're done fucking with it.
Is it any wonder the file size changes when it's being re-written?
Therefore I have created this topic. For improvement of work with database.

For what purposes there is a function RegMan.Save() ?!  ???
Title: Re: Optional ignoring of RegBase autosave
Post by: WAJIM on 08 January, 2010, 17:37:47
Quote from: Enuri on 08 January, 2010, 16:59:43
So, if some linux user needs this function now:
Thanks, but I'm win32 user.  :-\
Title: Re: Optional ignoring of RegBase autosave
Post by: PPK on 08 January, 2010, 23:16:11
Quote from: Mutor on 08 January, 2010, 17:05:03
Is everyone in Russia crazy?  :P
YES! ;D


Problem fixed, removed auto save. From PtokaX 0.4.1.2 it will be scripter responsibility to save regs when it is needed :P
Title: Re: Optional ignoring of RegBase autosave
Post by: WAJIM on 09 January, 2010, 13:51:48
Quote from: PPK on 08 January, 2010, 23:16:11
Problem fixed, removed auto save.
Thanks, PPK!  :D