How to obtain information from the async database

Description

async creates a private directory named .private-asp within a sync directory to store a MySQLite database of each async session.

This MySQLite database records the current state of the sync directory, which is used in conjunction with the remote side’s database to determine what action to take when an async session is run.

When troubleshooting async issues, you can use asyncadmin to read information from the database. You can also look at the database directly to try to find the source of the problem.

Note that you should not be editing the database directly, and should only be reading information from it.

Using asyncadmin

The asyncadmin tool prints out helpful information from the async database on the command line. It is recommended to use asyncadmin for troubleshooting the database, then if more information is needed you can look at the database directly.

Useful asyncadmin options

1. To see a list of all async sessions stored for a given directory, run the following:

# asyncadmin -l -d /path/to/directory

2. To list the meta details of an async session, run the following:

# asyncadmin -m -d /path/to/directory -N session_name

Below is some sample output:

Session name: bidi1
Local directory: /Users/janedoe/atest
Remote directory: remote.directory.com:/root/testing
Direction: bidi
Condition: stopped
Inode format: hash
Checksum: sha1-sparse
Start time: 2016-07-13T20:47:57Z
Stop time: 2016-07-13T20:48:00Z

3. To list the number of files in each state, run the following:

# asyncadmin -s -d /path/to/directory -N session_name

Below is some sample output:

Synchronized Paths:  3
Pending Paths:       0
Potential conflicts: 0
Conflict Paths:      1
Error Paths:         0

4. To list the status of all files, run the following:

# asyncadmin -f -d /path/to/directory -N session_name

Below is some sample output:

# --------------------
# State Id             Path
# --------------------
Syncd 1               /
Syncd 4               /example.txt
Syncd 5               /file.txt
Confl 6                /ABC

5. To list the status of only error or conflict files, run the following:

# asyncadmin --bad-files -d /path/to/directory -N session_name

6. To list the changes from the remote site that are cached in the database, run the following:

# asyncadmin -j -d /path/to/directory -N session_name

Below is some sample output:

# --------------------
# Journal op State CV:local peer Rec id Seq no
# --------------------
result_cont syncd 26 28 6 0
resp_cont confl 33 34 6 0

Looking at the database directly

To investigate an async database you need a MySQLite client. There are many free command-line and GUI clients available on the web.

Database Overview

The database is by default named snap.db and is located within each sub-directory named after the async session within .private-asp, unless you specify a custom location in your async command.

Tables within the database to note are the following:

  • sync_snap_counters_table: This table records the counts for the number of files synced, in conflict, in error, pending and unused. When an async session is run, data from this table is returned on the command-line, such as:
    Found/Syncd/Pending/Error/Conflict=4/4/0/0/0
  • sync_snapdb_table: This table records information on every file in the sync directory, including its state, checksum, timestamp, size and other metadata.
  • sync_snapmeta_table: This table records information about the session, including the sync directory, the remote host and directory, the sync direction, and the start and stop time of the last run.

sync_snapdb_table

Below is a reference of the way a file's sync state is represented in the database.

Code(s) Sync State
0 No inode
19 Synced
20 Conflict
21 Error
22 Potential Conflict

SQLite Manager Example

SQLite Manager is a free GUI client and add-on for the Firefox browser. You can download it on the Firefox Add-ons site.

After downloading the add-on, you can open it by going to Tools > SQLite Manager.

Go to Database > Connect Database and go to the the snap.db file for your async session. On the left is listed the tables in the database, and expanding each lists the column names. You can click on each to view the current values in the table.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk