Forum BigDB Has something broken with updating Indices?

Discussion and help relating to the PlayerIO database solution, BigDB.

Has something broken with updating Indices?

Postby DR Studios » June 5th, 2014, 11:41 am

We have a table which we update from code for storing a list of Key Value Pairs for each platform we are running on so we can customise some options of the game based upon these.

This was working the other week, but now when I upload the keys (which all return success in saving the values) when i do a search using the index which has been created. We get some of the results missing. I went into the web back-end to see what was going wrong and the search results are returning the same as the game receives.

The missing entries had the correct data populated in them and were stored in the Database and if I manually change the value for the attribute on which the search is performed to another value and save then reset its value back to what was stored before, they start appearing in the search results.

So is there a bug which has crept in updating the table indices from the code end? If so could this be effecting our live game?

Here's the code I use to upload the values (with game identifiers removed)

So to connect I use
Code: Select all
        string authenticationId = PlayerIO.CalcAuth("ToolsUser", "xxx");
        PlayerIO.Connect("xxx", "xxx", "ToolsUser", authenticationId, "", null, PlayerIOConnectionComplete, PlayerIOConnectionError);

then upon connection, I build a list of KVP entries to load/update
Code: Select all
    void PlayerIOConnectionComplete(Client client)
    {
        _client = client;

        List<string> keysList = new List<string>();

        for (int index = 0; index < KVPS.Count; index++)
        {
            keysList.Add(Platform + "_" + KVPS[index].key);
        }

        /// Update the values.
        ///
        _client.BigDB.LoadKeysOrCreate("KVPS", keysList.ToArray(), LoadSuccess, LoadError);
    }

Then when the entries are loaded / created i populate them with the correct values
Code: Select all
    void LoadSuccess(DatabaseObject[] kvpObjects)
    {
        int stringOffset = Platform.Length + 1;

        for (int index = 0; index < kvpObjects.Length; index++)
        {
            string key = kvpObjects[index].Key.Substring(stringOffset);

            int kvpIndex = 0;

            for (kvpIndex = 0; kvpIndex < KVPS.Count; kvpIndex++)
            {
                if (KVPS[kvpIndex].key == key)
                {
                    break;   
                }
            }

            kvpObjects[index].Set("Key", key);
            kvpObjects[index].Set("Value", KVPS[kvpIndex].value);
            kvpObjects[index].Set("Experience", KVPS[kvpIndex].experience);
            kvpObjects[index].Set("Enabled", KVPS[kvpIndex].enabled);
            kvpObjects[index].Set("Platform", Platform);
            kvpObjects[index].Save(SaveSuccess, SaveError);
        }
    }

And all the keys come back with success into the function which logs that they were updated.

Code: Select all
   
    void SaveSuccess()
    {
        Debug.Log("Objects Saved");
    }


In the game to load the keys i use

Code: Select all
_client.BigDB.LoadRange("KVPS", "KVPsForPlatform", new object[] { "PC" }, null, null, 100, KVPSLoaded, KVPSError);


Which only returns some of the entries (unless I manually reset the value for the platform to something else and then back)

If you contact me directly I can give you the code/data files used to upload this data, and there is currently some bad data stored in KVPS table for you to look at as to why its not working (on the project for which this issue is occurring)
DR Studios
 
Posts: 9
Joined: February 24th, 2014, 8:10 pm

Return to BigDB



cron