Commit Graph

49 Commits

Author SHA1 Message Date
Machiavelli
afcff32e64 Core/DBLayer: Add MySQL errno 1054 to ignored error messages. 2011-01-06 22:32:30 +01:00
Machiavelli
957c69de83 Update copyright note for 2011.
Happy new year.
2011-01-01 15:01:13 +01:00
Shauren
928443d899 Core: Removed more operator workarounds for ACE_Singleton (missed previously because of inconsistent naming)
--HG--
branch : trunk
2010-12-23 23:25:44 +01:00
Machiavelli
60ce3fdbd2 Core/DBLayer: Add MySQL errno´s 1058 and 1062 (related to query-correctness) to handled errno´s (=doesn´t require further actions from the core)
--HG--
branch : trunk
2010-12-19 18:01:06 +01:00
click
9c35e10444 Core:DBLayer: Fix warning on GCC
--HG--
branch : trunk
2010-12-19 16:29:51 +01:00
Machiavelli
dfd82c2fad Core/DBLayer: Use mysql_set_character_set in MySQLConnection::Open instead of explicit string queries
Also possibly fix an absolutely useless warning on GCC

--HG--
branch : trunk
2010-12-19 16:13:45 +01:00
Machiavelli
e2a8dfffbe Core/DBLayer:
- Add generic HandleMySQLErrno() method.
- Add the ability to re-execute a certain statement if errorhandler resolved the situation succesfuly.
- Add support for MySQL errno´s 2006, 2013, 2048, 2055 - fixes automatic reconnection behaviour.
- Cleanup in affected code

NOTE: You should still be smart enough to configure your worldserver and authserver´s MaxPingTime to be lower than your MySQL´s wait_time.

--HG--
branch : trunk
2010-12-19 15:48:55 +01:00
Machiavelli
cb08ec0d74 Core/DBLayer: Don´t prepare asynchronous statements on synchronous connections and vice versa. Prevents allocating RAM that will never be used.
--HG--
branch : trunk
2010-12-17 15:55:16 +01:00
click
2642894342 Core: Add new system for parallelizing client packet processing. Handle WorldSession updates in Map::Update() where we are safe to proceed. Patch by Ambal.
(And clean up tabs and whitespace while rummaging around in there)
Closes issue 5084.

--HG--
branch : trunk
2010-12-13 22:37:56 +01:00
Machiavelli
ea29d87dcc Backed out changeset: 8326a2411148
--HG--
branch : trunk
2010-12-13 09:18:49 +01:00
Machiavelli
f5d6319d4d Core/DBLayer:
- Make the mysql connectionpool shared for async and syncrhonous connections.
- Allow configurable amount of connections for the pool
- Allow configurable amount of delaythreads
Note that delaythreads now only represent in-core threads. Whenever they execute a task they will pick a free connection from the pool instead of using their previously unique assigned connection.
The purpose of this design change is better distribution of SQL requests (no bottlenecks paired with idling) among available resources.
This also prevents a ¨memory waste¨ of preparing async prepared statements on synchronous connections (that were never called) - and vice versa. Now, connections aren´t explicitly async or synchronous, they serve both purposes.

Use at own risk, might cause instabilities.
Don´t forget to update your config files and clear your cmake cache.

--HG--
branch : trunk
2010-12-04 21:50:36 +01:00
Spp
6b5ff1ca25 Core: Fix some warnings
--HG--
branch : trunk
2010-11-22 10:10:46 +01:00
click
67fade84d3 Core/Commands: Enable SQL query logging by config and command )patch by leak)
Closes issue 4853.

--HG--
branch : trunk
2010-11-19 13:13:07 +01:00
click
f0c4241ea4 Remove the accidental additions of CRLF-crap from the header updates
--HG--
branch : trunk
2010-10-07 15:35:36 +02:00
click
a67d7c9afd Copyright header updates - part 3... (and some whitespace cleanups)
--HG--
branch : trunk
2010-10-07 14:00:52 +02:00
click
df66aee929 Yet more copyright header updates
--HG--
branch : trunk
2010-10-07 13:38:35 +02:00
Spp
952d3cf10e Core: Fix couple of warnings
--HG--
branch : trunk
2010-10-01 09:10:07 +02:00
Anubisss
84a29b2d35 Remove const from MySQLConnectionInfo, can't use non const functions in a const struct. This fixes the compile error.
--HG--
branch : trunk
2010-09-30 20:32:09 +02:00
Machiavelli
fcec787e9c Core/DBLayer: Pass connection info down to lower level class MySQLConnection and use relevant data in logging messages in its methods
--HG--
branch : trunk
2010-09-29 15:29:57 +02:00
Machiavelli
d3b30e979a Fix linux compile. Thanks to click, hunshijie and tomkuzyno for spotting the culprits.
--HG--
branch : trunk
2010-09-29 14:59:05 +02:00
Machiavelli
bf72fa749f Core/DBLayer: Store MySQL connection details in a struct and print relevant data in sql driver messages
--HG--
branch : trunk
2010-09-29 08:48:06 +02:00
Machiavelli
7abe69b570 Core/DBLayer: Remove obsolete parameter in PreparedResultSet constructor.
Thanks to Spp for pointing out.

--HG--
branch : trunk
2010-09-28 14:03:35 +02:00
Machiavelli
a9e9a2c884 Core/DBLayer:
- DB Threading model update
* Get rid of ThreadBundleMask and bundled connection
* Implement configurable amount of Synch threads for databasepools
* Use modulus based algorithm to check for free synchronous connections instead of previous ¨get connection by thread key or bundlemask¨ feature
* Locks on mysql context objects are now managed outside the mysql query methods

Fixes issue #4058
Fixes issue #4059
Introduces a ton of more issues. Use at own risk. You were warned. Really.

Don´t forget to update your worldserver.conf

--HG--
branch : trunk
2010-09-27 00:20:56 +02:00
Machiavelli
3c6dc32030 Core/DBLayer:
- Rewrite Field class to be able to store both binary prepared statement data and data from adhoc query resultsets
- Buffer the data of prepared statements using ResultSet and Field classes and let go of mysql c api structures after PreparedResultSet constructor. Fixes a race condition and thus a possible crash/data corruption (issue pointed out to Derex, basic suggestion by raczman)
- Conform PreparedResultSet and ResultSet to the same design standards, and using Field class as data buffer class for both
* NOTE: This means the fetching methods are uniform again, using ¨Field* fields = result->Fetch();¨ and access to elements trough fields[x].
* NOTE: for access to the correct row in prepared statements, ¨Field* fields = result->Fetch();¨ must ALWAYS be called inside the do { }while(result->NextRow()) loop.
* NOTE: This means that Field::GetString() returns std::string object and Field::GetCString() returns const char* pointer.

Still experimental and all that jazz, not recommended for production servers until feedback is given.

--HG--
branch : trunk
2010-09-24 22:16:21 +02:00
Machiavelli
ce2d4e9a20 Core/DBLayer: Correctly print relevant mysql prepared statement creation error to give the end-user an idea of what exactly went wrong (missing SQL updates are the culprit of creation failure 99% of the time)
--HG--
branch : trunk
2010-09-20 20:53:32 +02:00
Machiavelli
0982719f5f Core/DBLayer:
- Declare the datatypes used to determine transaction element data (prepared statement/adhoc query string) on a generic level in SQLOperation.h
- Implement variable SQL element data for SQLQueryHolder class so it can execute both prepared statements and adhoc queries
- Make MySQLConnection::Query for adhoc queries return pointer to type instead of an autopointer, the autopointer is now applied on higher level code just like the function for querying prepared statements

--HG--
branch : trunk
2010-09-19 12:16:29 +02:00
Machiavelli
27dd112c97 Core/DBLayer: Add an assert to trace down when a prepared statement creation has failed (99% it will be because of a bad query) - to prevent crashes at a later stage
--HG--
branch : trunk
2010-09-19 10:36:48 +02:00
click
726e5cf466 Buildsystem/Core: Add new build-flag WITH_SQLDEBUG - adds support for enabling/disabling SQL-query logging
--HG--
branch : trunk
2010-09-17 20:36:29 +02:00
Machiavelli
123163dc41 Core/DBLayer: Check for potential mysql client/server version mismatch. Version mismatch may lead to undefined behaviour with prepared statements.
--HG--
branch : trunk
2010-09-12 15:57:36 +02:00
click
bf664b7a44 Cleanup/Core: Remove whitespace and tabs
--HG--
branch : trunk
2010-09-12 01:40:27 +02:00
Machiavelli
a41e99223e Core/DBLayer:
* Rename QueryResult class to ResultSet
* Rename QueryResult_AutoPtr to QueryResult
* Declare ACE refcounted auto pointer for PreparedResultSet class

--HG--
branch : trunk
2010-09-11 21:10:54 +02:00
Machiavelli
1dce5b78d5 Core/DBLayer: Implement lower level classes for prepared statements with resultsets. (Implementation in upper level code not yet possible)
--HG--
branch : trunk
2010-09-11 09:17:14 +02:00
Machiavelli
1608ebf7bf Core/DBLayer: Move some syncrhonisation error prone methods into the guarded scope in MySQLConnection:Execute(PreparedStatement*)
--HG--
branch : trunk
2010-09-05 10:34:46 +02:00
Machiavelli
5469af3775 Core/DBLayer: Add an assert to detetct calls to invalid prepared statements.
--HG--
branch : trunk
2010-09-03 17:30:23 +02:00
Machiavelli
7982cc0f7d Core/DBLayer:
- A few prepared statement implementations in authsocket as example.
- Add an ASSERT in MySQLConnection::Execute(PreparedStatement*) to catch faulty created statements

--HG--
branch : trunk
2010-09-03 01:00:49 +02:00
Machiavelli
2c1c391597 Core/DBLayer:
- Example implementation of prepared statement in ObjectMgr::SaveCreatureRespawntime
- #include "MYSQLThreading.h" -> #include "MySQLThreading.h" (*really* fixes Linux build)

--HG--
branch : trunk
2010-09-03 00:44:27 +02:00
Machiavelli
39027133e4 Fix Linux build
--HG--
branch : trunk
2010-09-03 00:04:14 +02:00
Machiavelli
1198591bac Core/DBLayer:
- Add basic prepared statement interface (without implementation and thus without testing, without resultset support).
- Based on raczman/Albator´s work on TrinityCore3

Build:
- Add sLog define ¨hack¨ in DatbaseWorkerPool.h to fix some more sLog errors temporarily

FYI: Builds on windows

--HG--
branch : trunk
2010-09-02 20:54:43 +02:00
Machiavelli
175fece073 Core/Logging:
- Implement sLog.outSQLDriver that will log SQL driver related events (non-content related).
- Queries will now be logged into this file as well instead of normal log file (requires debug build).
- Don´t forget to update your authserver.conf and worldserver.conf
Core/build:
- Fix non-PCH build

--HG--
branch : trunk
2010-08-26 21:50:54 +02:00
click
3c027962ba Buildsystem/Core: Adjust MySQL headers on relevant files to use simplified #include <mysql.h> instead of <mysql/mysql.h>
+ add support for compiling under MacOSX (thanks to elegos for the research)
NOTE: G3D requires a redefinition-hack under OSX, please see wiki for this info (dep-sources will not be changed)

--HG--
branch : trunk
2010-08-26 16:40:28 +02:00
Spp
c3343638cb Core: Remove lots warnings:
- All "'xxx' will be initialized after 'yyy' when initialized here"
- Some "unused variable"
- Some "enumeration value 'xxx' not handled in switch"

--HG--
branch : trunk
2010-08-21 20:08:47 +02:00
click
f7ad5b2624 Core/Build: Clean up more nonPCH-issues + fix a warning in Timer.h (unsigned/signed cast)
--HG--
branch : trunk
2010-08-21 09:53:04 +02:00
Machiavelli
a3270e79e3 Return proper MySQL connection for syncrhonous requests based on calling thread instead of bundled connection.
--HG--
branch : trunk
2010-08-20 12:44:08 +02:00
click
24d752e782 Core/Build: Fix non-PCH build, again... :P
--HG--
branch : trunk
2010-08-20 11:48:12 +02:00
Machiavelli
46438f9f92 - Call mysql_thread_end() for every deleted MySQLConnection instance, should fix the ¨Error in my_thread_global_end(): X threads didn't exit¨ issue. (Thanks to Aokromes for testing)
- Add some debug info to help trace down the other causes of the shutdown crash.

--HG--
branch : trunk
2010-08-19 16:35:52 +02:00
Machiavelli
7d915911f9 Properly end mysql connections and libraries on exit.
--HG--
branch : trunk
2010-08-19 15:47:29 +02:00
Machiavelli
3932fc8c83 - Fix Linux build (huge thanks to Aokromes for testing as always)
- Some work towards resolving the crash on shutdown by implementing a shutdown task

--HG--
branch : trunk
2010-08-19 00:13:09 +02:00
click
7d8146f989 Buildsystem/Core: Adjust header locations in CMake for collisions and shared + clean up includes from re26dbe6981
This sorts out issues with non-PCH compiles on supported platforms.

--HG--
branch : trunk
2010-08-18 07:17:04 +02:00
Machiavelli
87218eadcd * HIGHLY EXPERIMENTAL - USE AT OWN RISK *
Database Layer:
- Implement connection pooling: Instead of 1 delay thread per database, you can configure between 1 and 32 worker threads that have a seperate thread in the core and have a seperate connection to the MySQL server (based on raczman/Albator´s database layer for Trinitycore3)
- Implement a configurable thread bundle for synchroneous requests from seperate core threads (see worldserver.conf.dist for more info)
- Every mapupdate thread now has its seperate MySQL connection to the world and characters database
- Drop inconsistent PExecuteLog function - query logging will be implemented CONSISTENTLY later
- Drop current prepared statement interface - this will be done *properly* later
- You´ll need to update your worldserver.conf and authserver.conf
- You´re recommended to make a backup of your databases before using this.
* HIGHLY EXPERIMENTAL - USE AT OWN RISK *
* HIGHLY EXPERIMENTAL - USE AT OWN RISK *
etc.

--HG--
branch : trunk
2010-08-18 02:25:52 +02:00