Sync copies pending data from the WAL to the shadow WAL.
(ctx context.Context)
| 1163 | |
| 1164 | // Sync copies pending data from the WAL to the shadow WAL. |
| 1165 | func (db *DB) Sync(ctx context.Context) (err error) { |
| 1166 | db.execMu.Lock() |
| 1167 | defer db.execMu.Unlock() |
| 1168 | db.beginSyncDiag(diagOpSync) |
| 1169 | defer func() { db.finishSyncDiag(err) }() |
| 1170 | |
| 1171 | return db.syncLocked(ctx) |
| 1172 | } |
| 1173 | |
| 1174 | func (db *DB) syncLocked(ctx context.Context) (err error) { |
| 1175 | // Track total sync metrics. |