Commit Graph

101 Commits

Author SHA1 Message Date
leak 14cb6e4235 Resolve shutdown crash/leak if MySQL server is not running
Fixes #12734
2014-08-10 22:43:48 +02:00
DDuarte a394205eca Core/Server: Add missing overrides 2014-08-09 20:17:40 +01:00
Shauren e1c400250c Added comments to 6961f957c9 to make sure noone decides that storing the result in a variable is unneccessary 2014-07-26 16:14:18 +02:00
Shauren 6961f957c9 Core/DBLayer: Fixed possible crashes with async queries retrieving result
Closes #12655
2014-07-26 16:10:05 +02:00
leak 5b0898b33c Core/DatabaseWorkerPool: Delete PCQ in dtor rather than in Close() and cancel queue properly before doing so 2014-07-21 20:12:44 +02:00
Subv 87b72f41ca Fixed login and some errors 2014-07-02 21:56:40 -05:00
leak 029bad6698 Replaced all remaining ACE based Singletons
Replaced ACE base AutoPtr class with shared_ptr
Note: worldserver currently broken due to MapUpdater threading failure (ACE ofc, what else could it be)
2014-07-01 00:54:09 +02:00
leak d39a013b6b Replaced ACE_Task_Base based DatabaseWorker with PCQ
Note: Not exactly sure how shutdown should be handled, currently the queue clears itself out before shutting down
This might need to be changed if the queue should be fully processed before being deleted
2014-06-30 18:37:23 +02:00
Subv f03d49705d Core/Databases: Removed ACE dependencies on some of the database handling code. 2014-06-24 13:17:41 -05:00
Aokromes 4ec84fd1ec Core/Database: Update log for incorrect db structure 2014-06-07 22:13:42 +02:00
jackpoz 03f16d2e90 Shared/Database: Increase Database Worker Pool queue size
Increase DatabaseWorkerPool queue size from the default 16KB to 8MB to avoid blocking the caller thread when queuing an async statement/transaction.
2014-05-17 23:48:32 +02:00
Shauren 0f5632c70e Core/Misc: Fixed some -Weffc++ warnings 2014-04-20 16:48:35 +02:00
jackpoz 6dcd8c8545 Core/Misc: Fix some static analysis issues
Fix some static analysis issues about:
- uninitialized values, most of which are false positives, always initialized before being accessed
- unchecked return values
- dead code never executed
- bad formatting leading to wrong behavior

Please ensure EventMap is never used with event id set to 0 or those events will never execute.
2014-03-22 14:54:32 +01:00
Vincent_Michael 20004050bc Update copyright note for 2014.
Happy new year.
2014-01-01 00:07:53 +01:00
Spp 94e2b9332a Core/Logging: Remove LOG_FILTER_XXX defines with it's value (remember logger names are case-sensitive) 2013-11-08 10:50:51 +01:00
jackpoz 9c336cc32e Core/DB: Make a26a24a consistent with Trinity code style
Change DatabaseWorkerPool<T>::DirectExecute() to handle PreparedStatement disposal in the same way of DatabaseWorkerPool<T>::Query() , thanks Joschiwald for patch.
2013-09-21 17:45:46 +02:00
Spp d1677b2db0 Core/Logging: Performance-related tweaks to logging system
All sLog->out* functions (except outCommand atm) are replaced with TC_LOG_* macros.
    Memleak fix
2013-05-13 15:07:36 +02:00
Spp 1a6a23ec96 Core/Misc: Minor optimizations (+code changes to reduce differences with 4.3.4 branch)
Core/Logging: Create new logger type "Cheat". Will be used to log all cheat attempts
2013-03-25 13:26:48 +01:00
Nefarion 49fd11ab5a First step of comment style refactoring to doxygen-style. 2013-03-08 21:55:37 +01:00
Shauren 6a5c9bc5e3 Core/DBLayer: Made connection types consistent in DatabaseWorkerPool 2013-02-25 17:43:04 +01:00
Nay f902362ad1 Core/DBLayer: Avoid a crash when calling mysql_get_server_version if connection was not open 2013-02-08 23:06:25 +00:00
Mislav Blažević 3034db9296 Core/DBLayer: Fixed required version definitions 2013-01-24 11:05:36 +01:00
Machiavelli fd967ba4c6 Tools/mmaps_generator: Multithreading optimisations. Should save some time generating mmaps. 2013-01-24 01:20:25 +01:00
Machiavelli 1c0239ea98 Core/DBLayer: Drop support for MySQL versions <5.1
Both server and client libraries must be up to date in order to run TC.
2013-01-23 22:56:56 +01:00
Vincent_Michael cc65aba789 Update copyright note for 2013.
Happy new year.
2013-01-01 00:41:01 +01:00
Spp 2251d1bfae Core/Misc: Set mode 0644 for files 2012-11-27 13:03:12 +01:00
Spp 358c6a26d6 Core: Warning fixes (Also some -pedantic under game folder) 2012-09-10 13:04:31 +02:00
Shauren 43cbb1e105 Core/DBLayer: Fixed memory leaks when query returned empty result set 2012-08-26 21:24:15 +02:00
Spp 97c4b92eb0 Core/Logging: Try to simplify configuration of loggers and appenders
Changed multiple lines to a simple format:
- Logger.name=Type,LogLevel,Flags,AppenderList
- Appender.name=Type,LogLevel,Flags,optional1,optional2
  * Type = File: optional1 = File name, optiona2 = Mode
  * Type = Console: optional1 = Colors

Created a default set of loggers and appenders.
- Root logger defaults to Error, that means you will see nothing on console by default (not even loading)
- You need to add the loggers to Loggers options if you want to enable them, otherwise Root logger will be used for all types

Restored outSQLDriver (LOG_FILTER_SQL_DRIVER), outSQLDev (LOG_FILTER_SQL_DEV), outArena (LOG_FILTER_ARENA) and outChar (LOG_FILTER_CHARACTER) functionality by creating new types (LOG_FILTER_CHARACTER is a rename of LOG_FILTER_DELETE.

Note: You need to update your config file... again (yeah sorry... trying to make it simpler)
2012-08-06 12:10:33 +02:00
Spp 55ce180f28 Core/Logging: Add Asyncronous logging with Loggers ("What to log") and Appenders ("Where to log") system. Will allow to select to full log some parts of core while others are not even logged.
- Logging System is asyncronous to improve performance.
- Each msg and Logger has a Log Type and Log Level assigned. Each msg is assigned the Logger of same Log Type or "root" Logger is selected if there is no Logger configured for the given Log Type
- Loggers have a list of Appenders to send the msg to. The Msg in the Logger is not sent to Appenders if the msg LogLevel is lower than Logger LogLevel.
- There are three (at the moment) types of Appenders: Console, File or DB (this is WIP, not working ATM). Msg is not written to the resource if msg LogLevel is lower than Appender LogLevel.
- Appender and Console Log levels can be changed while server is active with command '.set loglevel (a/l) name level'

Explanation of use with Sample config:

Appender.Console.Type=1       (1 = Console)
Appender.Console.Level=2      (2 = Debug)

Appender.Server.Type=2        (2 = File)
Appender.Server.Level=3       (3 = Info)
Appender.Server.File=Server.log

Appender.SQL.Type=2           (2 = File)
Appender.SQL.Level=1          (1 = Trace)
Appender.SQL.File=sql.log

Appenders=Console Server      (NOTE: SQL has not been included here... that will make core ignore the config for "SQL" as it's not in this list)

Logger.root.Type=0            (0 = Default - if it's not created by config, server will create it with LogLevel = DISABLED)
Logger.root.Level=5           (5 = Error)
Logger.root.Appenders=Console

Logger.SQL.Type=26            (26 = SQL)
Logger.SQL.Level=3            (2 = Debug)
Logger.SQL.Appenders=Console Server SQL

Logger.SomeRandomName.Type=24 (24 = Guild)
Logger.SomeRandomName.Level=5 (5 = Error)
Loggers=root SQL SomeRandomName

* At loading Appender SQL will be ignored, as it's not present on "Appenders"

* sLog->outDebug(LOG_FILTER_GUILD, "Some log msg related to Guilds")
  - Msg is sent to Logger of Type LOG_FILTER_GUILD (24). Logger with name SomeRandomName is found but it's LogLevel = 5 and Msg LogLevel=2... Msg is not logged

* sLog->outError(LOG_FILTER_GUILD, "Some error log msg related to Guilds")
  - Msg is sent to Logger of Type LOG_FILTER_GUILD (24). Logger with name SomeRandomeName is found with proper LogLevel but Logger does not have any Appenders assigned to that logger... Msg is not logged

* sLog->outDebug(LOG_FILTER_SQL, "Some msg related to SQLs")
  - Msg is sent to Logger SQL (matches type), as it matches LogLevel the msg is sent to Appenders Console, Server and SQL
    - Appender Console has lower Log Level: Msg is logged to Console
    - Appender Server has higher Log Level: Msg is not logged to file
    - Appender SQL has lower Log Level: Msg is logged to file sql.log

* sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Some msg related to Battelgrounds")
  - Msg is sent to Logger root (Type 0) as no Logger was found with Type LOG_FILTER_BATTLEGROUND (13). As Logger has higher LogLevel msg is not sent to any appender

* sLog->outError(LOG_FILTER_BATTLEGROUND, "Some error msg related to Battelgrounds")
  - Msg is sent to Logger root (Type 0) as no Logger was found with Type LOG_FILTER_BATTLEGROUND (13). Msg has lower LogLevel and is sent to Appender Console
    - Appender Console has lower LogLevel: Msg is logged to Console
2012-08-03 14:20:18 +02:00
Shauren c055a8617d Scripts/Icecrown Citadel
* Fixed Professor Putricide Tear Gas stunning himself
* Fixed visual of Unstable Experiment
* Fixed oozes not picking new targets after hitting old
* Fixed Gas Cloud not using melee attack
* Removed ooze summon position hack

Closes #4301
Closes #2726
Closes #5119
Closes #4464
Closes #2874
Closes #4407
Closes #2421
Closes #4899
2012-04-13 19:56:00 +02:00
faramir118 f9ae8e6810 Core/DBLayer: incorrect use of va_start
Signed-off-by: Machiavelli <machiavelli.trinity@gmail.com>
2012-04-11 19:51:26 +02:00
Machiavelli 88d81d27cf Core/DB Layer: - Fix "Thread #1 unlocked a not-locked lock at 0x6D56E90" helgrind error (thanks to Aokromes for logs). Cause was unlocking MySQL connection on shutdown, but concurrent access at this point is not required.
- Remove redundant locking in PingOperation. Since these are delayed to async threads with their own MySQL connection, no concurrent access here either.
- Codestyle cleanup
- Documentation refining
2012-03-27 11:50:03 +02:00
Machiavelli e960016dc4 Partial revert of "Core/DB Layer: Fix a memory leak.", mysql library related stuff. Original memory leak fix is still in place. 2012-03-26 13:33:47 +02:00
Machiavelli 70ee37f3b4 Core/DB Layer: Fix a memory leak for synchronously executed prepared statements. 2012-03-26 08:58:21 +02:00
Machiavelli 43048afc7e Core/DB Layer: Fix a memory leak. 2012-03-26 08:29:41 +02:00
leak 4665d5bfc4 Core/DBLayer: Remnant cleanups 2012-03-19 18:09:14 +01:00
kiper 8299627ed9 Update headers for 2012. HAPPY NEW YEAR!!! 2012-01-01 00:32:13 +01:00
leak 64a2a29506 Core/DBLayer: Convert Execute() queries to prepared statements 2011-12-25 02:22:10 +01:00
Machiavelli 392baafed4 Core/DBLayer: Documentation update 2011-12-19 11:11:25 +01:00
Shauren 8305b0240b Core/DB: Fixed a crash on shutdown under msvc compiler 2011-09-30 18:42:26 +02:00
Spp- e9aa72cc7b Cosmetic: rename function escape_string to EscapeString 2011-06-30 14:52:44 +02:00
Machiavelli 0df059d5a2 Core/DBLayer: Don't lock a connection when doing mysql_real_escape_string as it doesn't need to interact with the server. 2011-06-22 15:04:13 +02:00
Machiavelli 402198c5ff Core/DBLayer: Proper core-side handling of MySQL errno 1213 to prevent a snowballeffect (until innodb_lock_wait_timeout) 2011-05-23 16:33:33 +02:00
leak 1003f30448 Add spaces after commas 2011-04-29 20:47:02 +02:00
Azazel 4db04b63dd Core/DBLayer: make use of return result of Connection::Open method and allow core to output all the errors in prepared statements instead of aborting on first error. 2011-04-07 15:30:38 +06:00
leak 57f85ab7da Core/DBLayer: Replace prepared statement arrays with a map to avoid asynchronous indexes at query logging or error output
- Add values to prepared statement query log messages
- Killed a bit Engrish and trailing white whitespaces
2011-01-26 00:41:55 +01:00
Machiavelli 7f3375b8f9 Core/DBLayer: Fix another possible crash on shutdown. This should be the last of them caused by this area of the core. 2011-01-16 13:33:47 +01:00
Machiavelli bd85914d92 Core/DBLayer: Properly manage mysql library initialization and shutdown in authserver and worldserver. Prevent multiple calls and make it more elegant. 2011-01-13 21:30:37 +01:00
Machiavelli 4c15ebe09d Core/DBLayer: Properly deallocate SQLOperation objects from Databaseworkerpool queue. 2011-01-13 20:28:40 +01:00