Dbserver

From OuroDev
Revision as of 10:01, 4 May 2019 by Asuffield (talk | contribs)

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

  • storing and retrieving objects 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. All of these services use the common Network protocol, in TCP-only mode.

account

arena

auction

AuctionServer connects to this service. It can receive the following commands:

AUCTION_SVR_CONNECT (2)

The message has no parameters. dbserver will accept only a single connection, and while it has one, it will respond to all further AUCTION_SVR_CONNECT messages by closing the connection.

dbserver responds with AUCTION_CLIENT_CONNECT (2):

packint(1) protocol_version
string shard_name
bits(1) have_inactive_players
something....

AUCTION_SVR_SEND_INV (3)

autobits entity_id
string inventory

dbserver finds the mapserver for entity_id, and proxies the message there as DBSERVER_AUCTION_SEND_INV

inventory is eventually decoded by AuctionInventory_FromStr in the mapserver, but dbserver proxies it without inspecting its value.

AUCTION_SVR_SEND_HISTORYINFO (4)

autobits entity_id
string identifier
autobits buying_count
autobits selling_count
autobits history_count
repeated history_count times:
  autobits date
  autobits price

dbserver finds the mapserver for entity_id, and proxies the message there as DBSERVER_AUCTION_SEND_HIST.

AUCTION_SVR_BATCH_SEND_ITEMINFO (5)

autobits entity_id
zipped data

dbserver finds the mapserver for entity_id, and proxies the message there as DBSERVER_AUCTION_BATCH_INFO. The zipped data is not inspected by dbserver.

After this output packet has been queued, dbserver sends AUCTION_CLIENT_DATAOK to the AuctioServer, with no both. This is a primitive form of flow control. It does not wait for the message to be sent to the mapserver before doing this.

AUCTION_SVR_XACT_CMD (7)

autobits entity_id
autobits type
XactCmd cmd

dbserver finds the mapserver for entity_id. If there is one, it proxies the message there as DBSERVER_AUCTION_XACT_CMD. If there is no mapserver, then dbserver responds to AuctionServer with AUCTION_CLIENT_XACT_UPDATE, sending:

autobits xid
autobits subid
autobits result

Where *xid* and *subid* are taken from *cmd*, and the result is set to *kXactCmdRes_No*.

AUCTION_SVR_RELAY_CMD_BYENT (9)

packint(1) entity_id
packint(1) force
string msg

dbserver finds the mapserver for entity_id. If there is one, it sends DBSERVER_RELAY_CMD there with *msg* as the body. If there is no mapserver, and force is set to 1, then the message is queued for relaying when the entity is available, and dbserver begins attempting to load the entity into a mapserver.

AUCTION_SVR_THROTTLE_ON (10)

This message has no parameters, and dbserver sends no response. It enables throttling, which prevents some (???) messages from being sent to the AuctionServer.

AUCTION_SVR_THROTTLE_OFF (11)

This message has no parameters, and dbserver sends no response. It disables throttling.

AUCTION_SVR_ACCOUNT_SHARDXFER (12)

OrderId order_id
autobits dbid

dbid is interpreted as an entity_id. dbserver will offline (???) and delete (???) the player, and then send AccountServer an ACCOUNT_CLIENT_SHARDXFER with:

OrderId order_id
autobits SHARDXFER_FULFILL_COMMIT_SRC

beacon

db

Despite the name, this service is used to communicate with MapServer.

launcher

mission

queue

stat

svrmon

turnstile

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.