knock out ReNew if there are no dummies
the operation requires loading the target side, which makes it somewhat expensive in otherwise unidirectional syncs. one could also knock out Flags and Delete if there are no living pairs, but that wouldn't actually save much.
This commit is contained in:
parent
1d433b4773
commit
2f4b71c56e
15
src/sync.c
15
src/sync.c
|
@ -680,14 +680,23 @@ box_opened2( sync_vars_t *svars, int t )
|
||||||
if (!lock_state( svars ))
|
if (!lock_state( svars ))
|
||||||
goto bail;
|
goto bail;
|
||||||
|
|
||||||
|
int any_dummies[2] = { 0, 0 };
|
||||||
int any_purges[2] = { 0, 0 };
|
int any_purges[2] = { 0, 0 };
|
||||||
int any_upgrades[2] = { 0, 0 };
|
int any_upgrades[2] = { 0, 0 };
|
||||||
int any_new[2] = { 0, 0 };
|
int any_new[2] = { 0, 0 };
|
||||||
int any_tuids[2] = { 0, 0 };
|
int any_tuids[2] = { 0, 0 };
|
||||||
if (svars->replayed) {
|
if (svars->replayed || ((chan->ops[F] | chan->ops[N]) & OP_RENEW)) {
|
||||||
for (srec = svars->srecs; srec; srec = srec->next) {
|
for (srec = svars->srecs; srec; srec = srec->next) {
|
||||||
if (srec->status & S_DEAD)
|
if (srec->status & S_DEAD)
|
||||||
continue;
|
continue;
|
||||||
|
if (srec->status & S_DUMMY(F))
|
||||||
|
any_dummies[F]++;
|
||||||
|
else if (srec->status & S_DUMMY(N))
|
||||||
|
any_dummies[N]++;
|
||||||
|
else if (srec->status & S_SKIPPED)
|
||||||
|
any_dummies[!srec->uid[F] ? F : N]++;
|
||||||
|
if (!svars->replayed)
|
||||||
|
continue;
|
||||||
if (srec->status & S_PURGE) {
|
if (srec->status & S_PURGE) {
|
||||||
any_purges[srec->uid[F] ? F : N]++;
|
any_purges[srec->uid[F] ? F : N]++;
|
||||||
} else if (srec->status & S_PENDING) {
|
} else if (srec->status & S_PENDING) {
|
||||||
|
@ -721,6 +730,10 @@ box_opened2( sync_vars_t *svars, int t )
|
||||||
if (chan->ops[t] & OP_FLAGS)
|
if (chan->ops[t] & OP_FLAGS)
|
||||||
opts[t^1] |= OPEN_FLAGS;
|
opts[t^1] |= OPEN_FLAGS;
|
||||||
}
|
}
|
||||||
|
if (!any_dummies[t] && (chan->ops[t] & OP_RENEW)) {
|
||||||
|
chan->ops[t] &= ~OP_RENEW;
|
||||||
|
debug( "no %s dummies; masking ReNew\n", str_fn[t] );
|
||||||
|
}
|
||||||
if ((chan->ops[t] & (OP_NEW | OP_RENEW)) || any_new[t] || any_upgrades[t]) {
|
if ((chan->ops[t] & (OP_NEW | OP_RENEW)) || any_new[t] || any_upgrades[t]) {
|
||||||
opts[t] |= OPEN_APPEND;
|
opts[t] |= OPEN_APPEND;
|
||||||
if ((chan->ops[t] & OP_NEW) || any_new[t]) {
|
if ((chan->ops[t] & OP_NEW) || any_new[t]) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user