Author Topic: Optional ignoring of RegBase autosave  (Read 6108 times)

0 Members and 1 Guest are viewing this topic.

Offline WAJIM

  • Member
  • ***
  • Posts: 41
  • Karma: +3/-5
Optional ignoring of RegBase autosave
« 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)

PtokaX forum

Optional ignoring of RegBase autosave
« on: 08 January, 2010, 15:56:48 »

Offline Enuri

  • Newbie
  • *
  • Posts: 9
  • Karma: +1/-0
Re: Optional ignoring of RegBase autosave
« Reply #1 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.

Offline Enuri

  • Newbie
  • *
  • Posts: 9
  • Karma: +1/-0
Re: Optional ignoring of RegBase autosave
« Reply #2 on: 08 January, 2010, 16:48:46 »
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 :)

Offline WAJIM

  • Member
  • ***
  • Posts: 41
  • Karma: +3/-5
Re: Optional ignoring of RegBase autosave
« Reply #3 on: 08 January, 2010, 16:56:18 »
Why would you delete 8000 registered accounts?
No, every month invokes purging function, that removes unused accounts, ~100-300.  ::)

Quote
And if the hub should fail by script or system issues before a save is made
These are my problems.  :P
« Last Edit: 08 January, 2010, 16:59:01 by WAJIM »

Offline Enuri

  • Newbie
  • *
  • Posts: 9
  • Karma: +1/-0
Re: Optional ignoring of RegBase autosave
« Reply #4 on: 08 January, 2010, 16:59:43 »
dump 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 :)
« Last Edit: 08 January, 2010, 17:01:26 by Enuri »

Offline WAJIM

  • Member
  • ***
  • Posts: 41
  • Karma: +3/-5
Re: Optional ignoring of RegBase autosave
« Reply #5 on: 08 January, 2010, 17:04:57 »
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.

Offline Enuri

  • Newbie
  • *
  • Posts: 9
  • Karma: +1/-0
Re: Optional ignoring of RegBase autosave
« Reply #6 on: 08 January, 2010, 17:14:08 »
Add 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... ?

. Is everyone in Russia crazy?  :P
Oh, yes  ;D

Offline WAJIM

  • Member
  • ***
  • Posts: 41
  • Karma: +3/-5
Re: Optional ignoring of RegBase autosave
« Reply #7 on: 08 January, 2010, 17:16:19 »
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.  :-*

Quote
The 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() ?!  ???

Offline WAJIM

  • Member
  • ***
  • Posts: 41
  • Karma: +3/-5
Re: Optional ignoring of RegBase autosave
« Reply #8 on: 08 January, 2010, 17:37:47 »
So, if some linux user needs this function now:
Thanks, but I'm win32 user.  :-\

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 478
  • Karma: +209/-22
  • PtokaX developer
Re: Optional ignoring of RegBase autosave
« Reply #9 on: 08 January, 2010, 23:16:11 »
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
« Last Edit: 08 January, 2010, 23:20:07 by PPK »
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

Offline WAJIM

  • Member
  • ***
  • Posts: 41
  • Karma: +3/-5
Re: Optional ignoring of RegBase autosave
« Reply #10 on: 09 January, 2010, 13:51:48 »
Problem fixed, removed auto save.
Thanks, PPK!  :D

PtokaX forum

Re: Optional ignoring of RegBase autosave
« Reply #10 on: 09 January, 2010, 13:51:48 »