p4 export

Extract journal or checkpoint records.

Syntax

p4 export -c token [-J prefix] [-f] [-l lines] [-F filter]
          [-T tableexcludelist] [-P filterpattern]
          [-s serverID] [-t type]
p4 export -j token [-J prefix] [-f] [-L] [-l lines] [-F filter]
          [-T tableexcludelist] [-P filterpattern]
          [-s serverID] [-t type]
p4 export -j token [-J prefix] -r [-L] [-F filter]
          [-T tableexcludelist] [-P filterpattern]
          [-s serverID] [-t type]
p4 export -j token -s serverID [-t type] -A
p4 export -j token {-i seconds | -I milliseconds} [-J prefix] [-f]
          [-F filter] [-T tableexcludelist] [-P filterpattern]
          [-s serverID] [-t type]

Syntax and naming conventions

Description

This command reports checkpoint and journal metadata from a P4 Server server. With no options, the records are reported in tagged form.

Some fields are added to the tagged output to indicate either transactional consistency, or to indicate the end of the journal.

To filter database tables out of the exported data, use the -T option with a list of tables whose data you wish to exclude. To exclude data from multiple tables, separate the table names by spaces or commas. The table names must begin with "db.", following the naming convention used for database files in the server root directory. If you separate the table exclusion list with spaces, you must enclose the list in quotes.

Run in follow mode

By default, p4 export stops when it reaches the current end of the journal. To keep the connection open and stream new journal records as the server writes them, run the command in follow mode by specifying -i seconds or -I milliseconds. The value sets how often the command checks for new records.

  • If you specify both -i and -I, the -I value is used.
  • An interval of 0 uses the value of the rpl.awaitjnl.interval configurable.
  • An interval shorter than 100 milliseconds is raised to 100 milliseconds.
  • Follow mode has no idle timeout. The command runs until the client disconnects or, if monitor is enabled, an administrator ends it with p4 monitor terminate.
  • You can't use -i or -I with -A, -c, -l, -L, or -r.

Register a journal consumer

An application that reads the journal with p4 export can identify itself with -s serverID and, optionally, -t type. The server then records the application in the server topology when it connects, so it appears in the output of p4 topology. To report how far the application has processed the journal, run p4 export -A with the same server ID and the journal position. That position then appears in the output of p4 servers.

Options

Option Description

-A

Acknowledge a journal position without exporting any records. The position you specify with -j is recorded for the server ID you specify with -s, and appears in the output of p4 servers. Requires -j and -s. You can't use -A with -c, -r, -i, or -I.

-c

Specifies a checkpoint number or position token of the form checkpointnum#byteoffset.

-f

Format the output so that non-textual datatypes are formatted appropriately.

-F filter

Limit output to records that match the specified filter pattern. For example, -F "table = db.configure".

-i seconds

Run in follow mode, checking for new journal records every seconds seconds. See Run in follow mode.

-I milliseconds

Run in follow mode, checking for new journal records every milliseconds milliseconds. If you specify both -i and -I, the -I value is used.

-j

Specify a journal number or position token of the form journalnum/byteoffset.

-J prefix

Specifies a filename prefix for the journal, such as that used with p4d -jc prefix.

-l lines

Limit output to the specified number of lines of journal records.

-L

Limit output to records up to and including the logical end of file (LEOF), which is the highest journal position that the required number of standby replicas have persisted. The required number is set by the rpl.journal.ack and rpl.journal.ack.min configurables. This prevents a journal consumer, such as the notification engine, from reading ahead of the data that those standby replicas have acknowledged. This option has no effect when you export a checkpoint.

-P filterpattern

Limit output to records that match the specified filter pattern. Multiple filter patterns can be specified with multiple -P options.

Each filterpattern begins with two characters and a colon, and specifies either a client filter or a depot filter, as well as whether the pattern is to be included or excluded, using the syntax:

  • -Pic://client/pattern - client records to include
  • -Pxc://client/pattern - client records to exclude
  • -Pif://depot/pattern - depot records to include
  • -Pxf://depot/pattern - depot records to exclude

The first character specifies whether the records are included or excluded ("i" or "x"), the second character specifies whether the records are client workspace-related or depot-file related ("c" or "f"), the colon is a separator, and the remainder of the filterpattern denotes either a client workspace view or a depot file path.

The mechanism by which this filtering is implemented is the same as that which is used by the ClientDataFilter: and RevisionDataFilter fields in the p4 server form.

-r

Display raw journal output; this argument applies to journals only.

-s serverID

Register the caller in the server topology at connect time with the specified server ID, so that it appears in the output of p4 topology. The topology entry is refreshed each time the caller runs p4 export. With -A, identifies the server whose journal position is acknowledged.

-t type

Specify the service type to record in the server topology, which is the name of the application that runs p4 export. Use with -s.

-T tableexcludelist

Supply a list of database tables (for example, db.have and db.client) to exclude from export.

Limit output to records that match the specified filter pattern. For example, -T db.have,db.client or -T "db.have db.client".

g-opts

See Global options.

Usage notes

Can file arguments use revision specifier? Can file arguments use revision range? Minimal access level required

N/A

N/A

super

available to an service user

Compressed journals or checkpoints are not supported.

Examples

p4 export -T "db.have db.working"

Run p4 export, but ignore records in the db.have and db.working tables.

p4 export -j 42 -i 5

Export the records in the current journal, number 42, and keep streaming new records as the server writes them, checking for new records every 5 seconds.

p4 export -j 42/10240 -s indexer-1 -A

Record that the consumer registered as indexer-1 has processed journal 42 up to byte offset 10240, without exporting any records. The position appears in the output of p4 servers -J.

Related commands

To replicate metadata from one server to another

p4 replicate

To pull journal records (and file content) from a target server The immediately upstream server for replica servers, edge servers, standby servers, proxies and brokers. See also 'upstream server' and 'central server'. to a replica server

p4 pull