8.3 KiB
layout | description |
---|---|
default | WAL Access API |
WAL Access API
The WAL Access API is used from 3.3 onwards to facilitate faster and
more reliable asynchronous replication. The API offers access to the
write-ahead log or operations log of the ArangoDB server. As a public
API it is only supported to access these REST endpoints on a single-server
instance. While these APIs are also available on DBServer instances, accessing them
as a user is not supported. This API replaces some of the APIs in /_api/replication
.
{% docublock get_api_wal_access_range %} {% docublock get_api_wal_access_last_tick %} {% docublock get_api_wal_access_tail %}
Operation Types
There are several different operation types thar an ArangoDB server might print.
All operations include a tick
value which identified their place in the operations log.
The numeric fields tick and tid always contain stringified numbers to avoid problems with
drivers where numbers in JSON might be mishandled.
The following operation types are used in ArangoDB:
Create Database (1100)
Create a database. Contains the field db with the database name and the field data, contains the database definition.
{
"tick": "2103",
"type": 1100,
"db": "test",
"data": {
"database": 337,
"id": "337",
"name": "test"
}
}
Drop Database (1100)
Drop a database. Contains the field db with the database name.
{
"tick": "3453",
"type": 1101,
"db": "test"
}
Create Collection (2000)
Create a collection. Contains the field db with the database name, and cuid with the globally unique id to identify this collection. The data attribute contains the collection definition.
{
"tick": "3702",
"db": "_system",
"cuid": "hC0CF79DA83B4/555",
"type": 2000,
"data": {
"allowUserKeys": true,
"cacheEnabled": false,
"cid": "555",
"deleted": false,
"globallyUniqueId": "hC0CF79DA83B4/555",
"id": "555",
"indexes": [],
"isSystem": false,
"keyOptions": {
"allowUserKeys": true,
"lastValue": 0,
"type": "traditional"
},
"name": "test"
}
}
Drop Collection (2001)
Drop a collection. Contains the field db with the database name, and cuid with the globally unique id to identify this collection.
{
"tick": "154",
"type": 2001,
"db": "_system",
"cuid": "hD15F8FE99859/555"
}
Rename Collection (2002)
Rename a collection. Contains the field db with the database name, and cuid with the globally unique id to identify this collection. The data field contains the name field with the new name
{
"tick": "385",
"db": "_system",
"cuid": "hD15F8FE99859/135",
"type": 2002,
"data": {
"name": "other"
}
}
Change Collection (2003)
Change collection properties. Contains the field db with the database name, and cuid with the globally unique id to identify this collection. The data attribute contains the updated collection definition.
{
"tick": "154",
"type": 2003,
"db": "_system",
"cuid": "hD15F8FE99859/555",
"data": {
"waitForSync": true
}
}
Truncate Collection (2004)
Truncate a collection. Contains the field db with the database name, and cuid with the globally unique id to identify this collection.
{
"tick": "154",
"type": 2004,
"db": "_system",
"cuid": "hD15F8FE99859/555"
}
Create Index (2100)
Create an index. Contains the field db with the database name, and cuid with the globally unique id to identify this collection. The field data contains the index definition.
{
"tick": "1327",
"type": 2100,
"db": "_system",
"cuid": "hD15F8FE99859/555",
"data": {
"deduplicate": true,
"fields": [
"value"
],
"id": "260",
"selectivityEstimate": 1,
"sparse": false,
"type": "skiplist",
"unique": false
}
}
Drop Index (2101)
Drop an index. Contains the field db with the database name, and cuid with the globally unique id to identify this collection. The field data contains the field id with the index id.
{
"tick": "1522",
"type": 2101,
"db": "_system",
"cuid": "hD15F8FE99859/555",
"data": {
"id": "260"
}
}
Create View (2110)
Create a view. Contains the field db with the database name, and cuid with the globally unique id to identify this view. The field data contains the view definition
{
"tick": "1833",
"type": 2110,
"db": "_system",
"cuid": "hD15F8FE99859/322",
"data": {
"cleanupIntervalStep": 10,
"collections": [],
"commitIntervalMsec": 60000,
"consolidate": {
"segmentThreshold": 300,
"threshold": 0.8500000238418579,
"type": "bytes_accum"
},
"deleted": false,
"globallyUniqueId": "hD15F8FE99859/322",
"id": "322",
"isSystem": false,
"locale": "C",
"name": "myview",
"type": "arangosearch"
}
}
Drop View (2111)
Drop a view. Contains the field db with the database name, and cuid with the globally unique id to identify this view.
{
"tick": "3113",
"type": 2111,
"db": "_system",
"cuid": "hD15F8FE99859/322"
}
Change View (2112)
Change view properties (including the name). Contains the field db with the database name and cuid with the globally unique id to identify this view. The data attribute contain the updated properties.
{
"tick": "3014",
"type": 2112,
"db": "_system",
"cuid": "hD15F8FE99859/457",
"data": {
"cleanupIntervalStep": 10,
"collections": [
135
],
"commitIntervalMsec": 60000,
"consolidate": {
"segmentThreshold": 300,
"threshold": 0.8500000238418579,
"type": "bytes_accum"
},
"deleted": false,
"globallyUniqueId": "hD15F8FE99859/457",
"id": "457",
"isSystem": false,
"locale": "C",
"name": "renamedview",
"type": "arangosearch"
}
}
Start Transaction (2200)
Mark the beginning of a transaction. Contains the field db with the database name and the field tid for the transaction id. This log entry might be followed by zero or more document operations and then either one commit or an abort operation (i.e. types 2300, 2302 and 2201 / 2202) with the same tid value.
{
"tick": "3651",
"type": 2200,
"db": "_system",
"tid": "556"
}
Commit Transaction (2201)
Mark the successful end of a transaction. Contains the field db with the database name and the field tid for the transaction id.
{
"tick": "3652",
"type": 2201,
"db": "_system",
"tid": "556"
}
Abort Transaction (2202)
Mark the abortion of a transaction. Contains the field db with the database name and the field tid for the transaction id.
{
"tick": "3654",
"type": 2202,
"db": "_system",
"tid": "556"
}
Insert / Replace Document (2300)
Insert or replace a document. Contains the field db with the database name, cuid with the globally unique id to identify the collection and the field tid for the transaction id. The field tid might contain the value "0" to identify a single operation that is not part of a multi-document transaction. The field data contains the document. If the field _rev exists the client can choose to perform a revision check against a locally available version of the document to ensure consistency.
{
"tick": "196",
"type": 2300,
"db": "_system",
"tid": "0",
"cuid": "hE0E3D7BE511D/119",
"data": {
"_id": "users/194",
"_key": "194",
"_rev": "_XUJFD3C---",
"value": "test"
}
}
Remove Document (2302)
Remove a document. Contains the field db with the database name, cuid with the globally unique id to identify the collection and the field tid for the transaction id. The field tid might contain the value "0" to identify a single operation that is not part of a multi-document transaction. The field data contains the _key and _rev of the removed document. The client can choose to perform a revision check against a locally available version of the document to ensure consistency.
{
"cuid": "hE0E3D7BE511D/119",
"data": {
"_key": "194",
"_rev": "_XUJIbS---_"
},
"db": "_system",
"tick": "397",
"tid": "0",
"type": 2302
}