Commit Graph

2967 Commits

Author SHA1 Message Date
Rsl1122
c60003cda0 Made db field in Transaction private 2019-02-17 23:06:43 +02:00
Rsl1122
e2310e4376 Fixed Patch code failing if a table doesn't exist 2019-02-17 22:57:37 +02:00
Rsl1122
1378d3100e Transaction rollback fail no longer hides original exception 2019-02-17 22:52:30 +02:00
Rsl1122
8870e034e1 All database transactions are now performed by a single thread.
- Added a Database Access Lock object
  - Access log lets OperationCriticalTransactions through
  - Transactions skip query access log check
  - executeTransaction returns a Future to allow easier synchronization
  - ServerInfo waits for the server to be registered. This could lead
    to issues if a new server is registering to old database. It should
    not be too big of an issue since no patches need to be applied
    on first enable of the database.
- Added database states: CLOSED <-> INITIALIZING -> OPEN -> CLOSED

These two changes allow restricting queries to the database until the
database has properly initialized (Schema is in correct format)

- Removed SQLDB as a Patch class variable

Tests use Guava direct thread executor on the database to reduce
concurrency issues during tests. Another option would be to wait for
each transaction.
2019-02-16 20:26:08 +02:00
Rsl1122
2b9e407816 Removed sql Table class 2019-02-16 15:14:20 +02:00
Rsl1122
360e631fc9 Removed PatchTask 2019-02-16 14:58:54 +02:00
Rsl1122
33eec6d990 Moved to using JUnit 5.4 TempDir instead of junitpioneer 2019-02-16 14:55:00 +02:00
Rsl1122
039696910c Removed ProxyAPI and ServerAPI since implementations are the same 2019-02-16 14:48:36 +02:00
Rsl1122
23969192c1 Moved two peak player count queries to TPSQueries class 2019-02-16 14:29:28 +02:00
Rsl1122
f83be34f09 Deprecation javadoc messages to FetchOperations 2019-02-16 14:29:27 +02:00
Rsl1122
738a58edc2 Removed SQLErrorUtil 2019-02-16 14:29:26 +02:00
Rsl1122
328e42a19b Removed Database#fetch usage 2019-02-16 14:29:26 +02:00
Rsl1122
f77750c138 Removed SQLOps class 2019-02-16 14:29:25 +02:00
Rsl1122
463f56f340 TPSTable now static information class:
- Made constructor private
- Removed getter in SQLDB
2019-02-16 14:29:24 +02:00
Rsl1122
ba41952bee Refactored TPSTable#getPlayersOnlineForServers to a query 2019-02-16 14:29:23 +02:00
Rsl1122
6eafce05ba Removed TPSTable#getNetworkOnlineData - not used 2019-02-16 14:29:23 +02:00
Rsl1122
9f1479a65c Refactored TPSTable#getTPSData to a query 2019-02-16 14:29:22 +02:00
Rsl1122
fcdc281219 UserInfoTable is now static information class:
- Made constructor private
- Removed getter in SQLDB
2019-02-16 14:29:21 +02:00
Rsl1122
0c893ea59c Ban and Operator status Transactions:
- Removed SaveOperations
- Removed BanAndOpProcessor, PlayerProcessors
- Removed UserInfoTable#updateOpStatus, UserInfoTable#updateBanStatus
2019-02-16 14:29:20 +02:00
Rsl1122
57695d6e43 Created SessionEndTransaction:
- Removed SaveOperations#session
- Removed DBSystem dependency from SessionCache, so SessionCache does
  not need to be called from async thread. (SessionCache does not save,
  responsibility now with the caller)
2019-02-16 14:29:19 +02:00
Rsl1122
40a62874a3 Created ServerShutdownTransaction 2019-02-16 14:29:18 +02:00
Rsl1122
11369fe62d Fix syntax error in UserIdentifierQueries 2019-02-16 14:29:17 +02:00
Rsl1122
81b9925057 UsersTable now a static information class:
- Made constructor private
- Removed getter in SQLDB
2019-02-16 14:29:17 +02:00
Rsl1122
70e83a12b4 Refactored UsersTable#kicked to a transaction 2019-02-16 14:29:16 +02:00
Rsl1122
4c235b95e2 Refactored UsersTable#getMatchingNames to a query:
- Removed SearchOperations
2019-02-16 14:29:15 +02:00
Rsl1122
de7a1b3286 Refactored UsersTable#getPlayerName to a query 2019-02-16 14:29:14 +02:00
Rsl1122
57f7cb710a Split identifier (UUID, name) related queries to own class. 2019-02-16 14:29:13 +02:00
Rsl1122
c57021a116 Removed UsersTable#getTimesKicked - not used 2019-02-16 14:29:12 +02:00
Rsl1122
30bac0f6ca Refactored UsersTable#getUuidOf to a query 2019-02-16 14:29:12 +02:00
Rsl1122
bb52f29bd4 Refactored UsersTable#getPlayerNames to a query 2019-02-16 14:29:11 +02:00
Rsl1122
e398a53425 Refactored UsersTable#getUserInformation to a query 2019-02-16 14:29:10 +02:00
Rsl1122
ee74fc328e Refactored BukkitImporter to use new db things:
- Refactored UsersTable#getSavedUUIDs to a query
- Removed #getRegisterDates, #updateName, #getAllTimesKicked,
  #getUUIDsAndNamesByID - not used
- Refactored UserInfoTable#getSavedUUIDs to a query
- Removed UserInfoTable#getServerUserInfo - not used
2019-02-16 14:29:09 +02:00
Rsl1122
9616d5b6f0 Fixed possible ExecutorService leak in BukkitImporter 2019-02-16 14:29:08 +02:00
Rsl1122
4f68a59dcb Removed old world removal from UserImportRefiner 2019-02-16 14:29:08 +02:00
Rsl1122
29bd29979a Missing license header added 2019-02-16 14:29:07 +02:00
Rsl1122
8eede58cd6 SessionsTable now static information class:
- Made constructor private
- Removed getter in SQLDB
2019-02-16 14:29:06 +02:00
Rsl1122
2b9199d2e2 Refactored SessionsTable#getIDServerIDRelation to a query 2019-02-16 14:29:06 +02:00
Rsl1122
f4adf4a52c Removed 3 SessionsTable methods - not used:
- getPlaytime, getPlaytimeOfServer, getSessionCount
2019-02-16 14:29:05 +02:00
Rsl1122
57bc5b532e ServerTable now a static information class:
- Made constructor private
- Removed getter in SQLDB
2019-02-16 14:29:04 +02:00
Rsl1122
817d157065 Refactored ServerTable#getServerNames to a query 2019-02-16 14:29:03 +02:00
Rsl1122
240b6cb29e Refactored ServerTable#setAsUninstalled to a transaction 2019-02-16 14:29:02 +02:00
Rsl1122
1810a758f2 Missing license header added 2019-02-16 14:29:01 +02:00
Rsl1122
4cc310f8a6 Removed ServerTable#getServerID - no longer used 2019-02-16 14:29:00 +02:00
Rsl1122
029c1378f3 [#746] Made Server UUID generation random
- Refactored ServerInfo classes a bit in this commit, made them use
  Optional<Server> instead of Optional<Integer> (server id)
- Removed all uses of FetchOperations#getServerId
2019-02-16 14:28:59 +02:00
Rsl1122
f0f32f3ec4 Refactored ServerTable#saveCurrentServerInfo to a transaction 2019-02-16 14:28:58 +02:00
Rsl1122
2e9f6148d6 Fixed Smells, Level Minor (SonarCloud):
- Function<String, String> in GeoInfoStoreTransaction
- Unused throws clause in Version10Patch
- Bad variable name in UsersTable

- Fixed WorldTimesQueries again
2019-02-16 14:28:58 +02:00
Rsl1122
32f3cae7c4 More smells:
- Fixed accidental breakage of a WorldTimes query

Fixed Smells, Level Major (SonarCloud):
- Use of keySet instead of entrySet in LargeStoreQueries
- Unused variable in NicknameQueries now used
- Unused fields removed from UsersTable
- Unused fields removed from PlayerProcessors
- Same variable name as field in WorldMap
2019-02-16 14:28:57 +02:00
Rsl1122
4eb8c6476a Bunch of code smells:
- Sorted out SessionQueries ORDER BY usefulness with a TreeMap

Level Critical (SonarCloud):
- Smell: Duplicated String literals in the Queries: " FROM ", " WHERE ",
  " AND ", etc
- Smell: GeoInfoStoreTransaction static value assignment
- Smell: Patch - Duplicate switch case
- Smell: DataCache - Empty constructor without comment
2019-02-16 14:28:55 +02:00
Rsl1122
23799d303f Moved db init transactions to their own package 2019-02-16 14:28:54 +02:00
Rsl1122
18cc7af151 Optimized CleanTransaction inactive player query
- Removed SessionsTable#getLastSeenForAllPlayers
- Made a test to ensure that the clean transaction does not delete all
  players
- Fixed Peak player count fetch statement
2019-02-16 14:28:53 +02:00