Dbserver: Difference between revisions

From OuroDev
No edit summary
No edit summary
Line 28: Line 28:
The list of values will have a template file, describing the fields that can be in it and their types. This is used to generate SQL statements for reading and writing the container, and to serialise the container for transmission to other servers.
The list of values will have a template file, describing the fields that can be in it and their types. This is used to generate SQL statements for reading and writing the container, and to serialise the container for transmission to other servers.


Some basic foreign key constraints exist on the GroupCon types, but containers do not resemble a relational database. They are usually read and written as an atomic unit, and are an attempt at producing the behaviour of a semi-structed key-value store using an SQL database.
Some basic foreign key constraints exist on the GroupCon types, but containers do not resemble a relational database. They are usually read and written as an atomic unit, and are an attempt at producing the behaviour of a semi-structed key-value store using an SQL database. There is no transactional behaviour, and the dbserver acts as a write-back cache: it holds data in ram and will lose data if it crashes.


= Command line arguments =
= Command line arguments =

Revision as of 14:14, 4 May 2019

A dbserver instance is a "shard", which is known to players as "a server" (Freedom, Defiant, etc). It performs several roles:

  • storing and retrieving containers in the database on behalf of some of the other servers
  • proxying messages between some other servers
  • coordinating player transfers
  • assorted random features that didn't have anywhere else to live

Despite the name, relatively little of dbserver's code is related to managing the database, and it is not the only server which has a database.

Services

dbserver listens on several ports, each one providing a different service. Most services correspond to another server which will connect to dbserver.

Details of the network protocols are on Dbserver-protocols

Containers

Containers are the fundamental abstraction of objects stored in dbserver. Every object is represented by a container, which has a type, a struct representation in dbserver, and a list of values. All of the structs are subtypes of DbContainer. Containers which only have a list of values will be represented by DbContainer directly - these typically represent data which dbserver stores for other servers, but does not interact with.

Some notable container types are:

  • Ents are player characters, represented by EntCon
  • maps are map data, represented by MapCon
  • Teamups, Supergroups, Taskforces, MapGroups, and Leagues contain lists of other containers, represented by GroupCon

Teamups and Leagues will not be written to the database, and will be deleted if present.

The list of values will have a template file, describing the fields that can be in it and their types. This is used to generate SQL statements for reading and writing the container, and to serialise the container for transmission to other servers.

Some basic foreign key constraints exist on the GroupCon types, but containers do not resemble a relational database. They are usually read and written as an atomic unit, and are an attempt at producing the behaviour of a semi-structed key-value store using an SQL database. There is no transactional behaviour, and the dbserver acts as a write-back cache: it holds data in ram and will lose data if it crashes.

Command line arguments

-logserver

Start the dbserver as a logserver instead. (This also happens if the executable name is "logserver".)

-noencrypt

Disable encryption between the client and dbserver.

-productionmode

Enable production mode/disable development mode. Document production mode.

-startall

Start all static non-DontAutoStart maps automatically on startup.

-start <n>

Start up to n static maps on startup.

-verbose

Enable verbose logging.

-testcleanshutdown [n]

Run a database shutdown test on the n first containers and then exit. n is 100 by default.

-perfbench

Run a performance benchmark and then exit.

-perfload [n]

Run a load test of n runs on the database and then exit. n is 0 by default.

-perfdup [n]

Run a duplication test of n runs on the database and then exit. n is 0 by default.

-perfupdate [n]

Run an update test of n runs on the database and then exit. n is 0 by default.

-flattosql

Load the on-disk flat format (.defs or .bins) of Ents, Supergroups, Teamups and Leagues to the database, then exit. Only works in development mode.

-sqltoflat

Dump the database containers of Ents, Supergroups, Teamups and Leagues to the on-disk format, then exit. Only works in development mode.

-importdump <dumpfile> [mappingfile brokenfile progressfile splitnames]

Load a dump file. Defaults:

  • mappingfile: conids.map
  • brokenfile: links.bk
  • progressfile: progress.txt
  • splitnames: 0

-fiximport [mappingfile brokenfile progressfile]

Revisit DB (after import?) and fix broken links. Defaults:

  • mappingfile: conids.map
  • brokenfile: links.bk
  • progressfile: progress.txt

-exportdump <dumpfile>

Export a dump file.

-packetdebug

Enable packet debug info (data type and length). Enabled by default if the build is FULLDEBUG, disabled otherwise.

-memlogecho

Echo logs for the generic memlog instance to the console.

-cod

Pass the -cod option to mapservers launched via the launchers connected to this dbserver.