determinate determinate

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

0 Members and 1 Guest are viewing this topic.

Offline WAJIM

  • Member
  • ***
  • Posts: 41
  • Karma: +3/-5
Optional ignoring of RegBase autosave
« on: January 08, 2010, 03:56:48 pm »
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)

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: Optional ignoring of RegBase autosave
« Reply #1 on: January 08, 2010, 04:24:04 pm »
And if the hub should fail by script or system issues before a save is made all such
changes would be lost. Barring a cleaner, why on earth would you be mass deleting users?
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline Enuri

  • Newbie
  • *
  • Posts: 9
  • Karma: +1/-0
Re: Optional ignoring of RegBase autosave
« Reply #2 on: January 08, 2010, 04:29:17 pm »
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 Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: Optional ignoring of RegBase autosave
« Reply #3 on: January 08, 2010, 04:38:41 pm »
Why would you delete 8000 registered accounts?
I see no practical or reasonable cause for this.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline Enuri

  • Newbie
  • *
  • Posts: 9
  • Karma: +1/-0
Re: Optional ignoring of RegBase autosave
« Reply #4 on: January 08, 2010, 04:48:46 pm »
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 #5 on: January 08, 2010, 04:56:18 pm »
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: January 08, 2010, 04:59:01 pm by WAJIM »

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: Optional ignoring of RegBase autosave
« Reply #6 on: January 08, 2010, 04:57:21 pm »
Well I agree with that, but to dump 8k users at once is foolish.
A proper cleaner ensures users absent for x amount of days
are deleted. In this way only a few users are deleted on any
one cycle. I might be wrong as I have not seen the script
but it would seem your problems and WAJIM's may well be
due to poor scripting methods.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline Enuri

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

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: Optional ignoring of RegBase autosave
« Reply #8 on: January 08, 2010, 05:01:29 pm »
No, every month invokes purging function, that removes unused accounts, ~100-200.  ::)

Well Sir, there is your problem, you don't run a cleaner once a month.
Increase you frequency to at least once a day. Then there will be no
lag or stall in the hub. My own cleaner runs once every hour. :D

The hub shouldn't be recoded to suit poor methods, your script should
be recoded to run properly with respect to the API.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline WAJIM

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

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: Optional ignoring of RegBase autosave
« Reply #10 on: January 08, 2010, 05:05:03 pm »
Yes. But it's first time when i clear my reg base  ;D

So, if some linux user needs this function now:...

So you mod the c++ and recompile over the one time pain from
cleaning an ill maintained registered users database? Add to that the risk
of losing changes made on crash. Is everyone in Russia crazy?  :P
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: Optional ignoring of RegBase autosave
« Reply #11 on: January 08, 2010, 05:08:23 pm »
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.

Well that's the point, properly coded, you would never BE making many DelReg calls.
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?
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline Enuri

  • Newbie
  • *
  • Posts: 9
  • Karma: +1/-0
Re: Optional ignoring of RegBase autosave
« Reply #12 on: January 08, 2010, 05:14:08 pm »
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 #13 on: January 08, 2010, 05:16:19 pm »
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 Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: Optional ignoring of RegBase autosave
« Reply #14 on: January 08, 2010, 05:25:36 pm »
No, simply the hub should process function correctly, instead of through an ass.  :-*
Therefore I have created this topic. For improvement of work with database.
I respectfully submit your scripting methods are what need improvement.
For what purposes there is a function RegMan.Save() ?!  ???
I have asked the very same question. Although I'm not certain it's the same for
the Win32 hub. Moreover source for the Win32 is not available.

After thinking it over, I agree the save function should not be called automatically
for any of the 'Manager' calls. I can only assume PPK was guarding again sloppy script.
So I see both of these as correctable problems. :D
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline WAJIM

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

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 245
  • Karma: +206/-17
  • PtokaX "developer"
Re: Optional ignoring of RegBase autosave
« Reply #16 on: January 08, 2010, 11:16:11 pm »
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: January 08, 2010, 11:20:07 pm by PPK »

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: Optional ignoring of RegBase autosave
« Reply #17 on: January 08, 2010, 11:29:29 pm »
Thank you. I've always wanted enough rope to hang myself. :D
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline WAJIM

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

 

determinate determinate
guestbook