Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

database split logic is corrupted (Trac #1996) #1996

Closed
elgg-gitbot opened this issue Feb 16, 2013 · 2 comments
Closed

database split logic is corrupted (Trac #1996) #1996

elgg-gitbot opened this issue Feb 16, 2013 · 2 comments

Comments

@elgg-gitbot
Copy link

Original ticket http://trac.elgg.org/ticket/1996 on 40214568-08-20 by trac user bios, assigned to unknown.

Elgg version: 1.7

Despite the fact that logic for splitting DB reads/writes is laid in settings.php and database.php (by $CONFIG->db->split = true; key in settings), core does not supports this feature correctly.

There is next logic in file "/engine/lib/database.php" at lines 30-52:

if ($dblinkname != "readwrite" && isset($CONFIG->db[$dblinkname])) {
        if (is_array($CONFIG->db[$dblinkname])) {
            $index = rand(0,sizeof($CONFIG->db[$dblinkname]));
            $dbhost = $CONFIG->db[$dblinkname][$index]->dbhost;
            $dbuser = $CONFIG->db[$dblinkname][$index]->dbuser;
            $dbpass = $CONFIG->db[$dblinkname][$index]->dbpass;
            $dbname = $CONFIG->db[$dblinkname][$index]->dbname;
        } else {
            $dbhost = $CONFIG->db[$dblinkname]->dbhost;
            $dbuser = $CONFIG->db[$dblinkname]->dbuser;
            $dbpass = $CONFIG->db[$dblinkname]->dbpass;
            $dbname = $CONFIG->db[$dblinkname]->dbname;
        }
    } else {
        $dbhost = $CONFIG->dbhost;
        $dbuser = $CONFIG->dbuser;
        $dbpass = $CONFIG->dbpass;
        $dbname = $CONFIG->dbname;
    }

    // Connect to database
    if (!$dblink[$dblinkname] = mysql_connect($CONFIG->dbhost, $CONFIG->dbuser, $CONFIG->dbpass, true)) {

Despite that connection settings are prepared in variables $dbhost, $dbuser, etc. correctly, those variables are not used and connection established using direct values from $CONFIG.

Same situation can be seen in file "/simplecache/view.php" at line 25:

if ($mysql_dblink = mysql_connect($CONFIG->dbhost,$CONFIG->dbuser,$CONFIG->dbpass, true)) {

split logic isn`t used at all.

@elgg-gitbot
Copy link
Author

cash wrote on 40215128-12-16

This ticket is a duplicate of #1349 - split table support has not been added to Elgg - we should add some documentation so that people don't misinterpret what's there as full support.

@elgg-gitbot
Copy link
Author

Milestone changed to Unscheduled by cash on 40215128-12-16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant