FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » FUDforum Suggestions » DB storage problems
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
DB storage problems [message #30220] Sat, 11 February 2006 23:50 Go to next message
willy is currently offline  willy   Hungary
Messages: 24
Registered: March 2005
Karma: 0
Junior Member
Hello,

I testing 2.7.4 DB storage, but this have some problem with this.
I never understand why better filesystem storage for fudforum, and this new db storage method make me happy:)

File storage weeknes:
If only one character loss from message file, all offsets will be wrong.
SQL server is needed... file storage is not dependency reduce way.
PHP fopen model not a secure way.
Fulltext indexing is faster, more space saver,maintaince cost smaller than separate index table. (i understand this is can't used parallel with current file storage method)

DB storage good way.

But, 2.7.4 relese has some bugs:

Private message db handling is very strange, pmsg length field used to link pmsg body(in the msg_store table) to pmsg table. This is works, some minor problems appeared:

pmsg_view and pmsg check DB storage at read_pmsg_body if DB storage activated, check offset != 1 but if pmsg stored in DB offset is always -1 (check write_pmsg_body)
This problem correcting is simple in the code. (make offset check
to == -1)

But have another problem:
pmsg folder size checker summarize pmsg $length (it is contains ralations to msg_store table) this cause 34141% space usage.
Patch not simple, need to rewrite relations pmsg and msg_store table.

Another problem, if i try rebuild search index(needed), rebuild failed with following reason:
/html/adm/indexdb.php:75
) 1100: Table 'fud_msg_store' was not locked with LOCK TABLES
Query: SELECT data FROM fud_msg_store WHERE id=281792


Have any idea how to solve this problem?

Thanks,

Willy




Re: DB storage problems [message #30234 is a reply to message #30220] Sun, 12 February 2006 19:03 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Apply this patch:
http://cvs.prohost.org/c/index.cgi/FUDforum/chngview?cn=7544


FUDforum Core Developer
Re: DB storage problems [message #30246 is a reply to message #30234] Sun, 12 February 2006 23:46 Go to previous messageGo to next message
willy is currently offline  willy   Hungary
Messages: 24
Registered: March 2005
Karma: 0
Junior Member
Thanks for your reply, and the patch.

Two other problem still not solved..

First:

pmsg.inc and pmsg_view.inc data query problem:

in read_pmsg_body():
        
        if ($GLOBALS['FUD_OPT_3'] & 32768 && $offset != -1) {
                        return q_singleval('SELECT data FROM fud_msg_store WHERE id='.$length);
        }


but offset is always -1 if $GLOBALS['FUD_OPT_3'] & 32768 because:
in fud_pmsg->add

                if ($GLOBALS['FUD_OPT_3'] & 32768) {
                      $this->foff = $this->length = -1;
                } else {


the first ($GLOBALS['FUD_OPT_3'] & 32768 && $offset != -1) condition never true.

cosmetic patch: change != to == in pmsg.inc and pmsg_view.inc read_pmsg_body, and pmsg body correctly retrieved from db.

Another:
The pmsg connectivity pmsg table length field multiple usage

first: contains length of message if stored on disk
(write_pmsg_body())


second: contains relations to msg_store table if pmsg data stored ind db

inc class fud_pmsg

method add

  if ($GLOBALS['FUD_OPT_3'] & 32768 && $this->body) {
    $fid = db_qid('INSERT INTO fud_msg_store(data) VALUES('._esc($this->body).')');
    q('UPDATE fud_pmsg SET length='.$fid.' WHERE id='.$id);
  }


and the storage query problem:
in pmsg.inc

   
 $disk_usage = q_singleval('SELECT SUM(length) FROM fud_pmsg WHERE duser_id='._uid);
 $percent_full = ceil($disk_usage / $MAX_PMSG_FLDR_SIZE * 100);


if msg is stored in db length field contains msg_store table id-s and
summary is false.

patching this maybe rewrite pmsg data handling similar to msg handling, but
i have not enought experience with your software.

Thanks for help
Re: DB storage problems [message #30256 is a reply to message #30246] Mon, 13 February 2006 15:40 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Thanks for the detailed problem analysis, here is the patch that should address the outlined problems:
http://cvs.prohost.org/c/index.cgi/FUDforum/chngview?cn=7546


FUDforum Core Developer
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: "Warning : you are not logged in" message
Next Topic: Hidden forum
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat May 18 16:51:53 GMT 2024

Total time taken to generate the page: 0.02627 seconds