Index: tool/sqlite3_rsync.c ================================================================== --- tool/sqlite3_rsync.c +++ tool/sqlite3_rsync.c @@ -33,10 +33,11 @@ " --exe PATH Name of the sqlite3_rsync program on the remote side\n" " --help Show this help screen\n" " --ssh PATH Name of the SSH program used to reach the remote side\n" " -v Verbose. Multiple v's for increasing output\n" " --version Show detailed version information\n" + " --wal-only Do not sync unless both databases are in WAL mode\n" ; typedef unsigned char u8; /* Context for the run */ @@ -55,10 +56,11 @@ u8 bCommCheck; /* True to debug the communication protocol */ u8 isRemote; /* On the remote side of a connection */ u8 isReplica; /* True if running on the replica side */ u8 iProtocol; /* Protocol version number */ u8 wrongEncoding; /* ATTACH failed due to wrong encoding */ + u8 bWalOnly; /* Require WAL mode */ sqlite3_uint64 nOut; /* Bytes transmitted */ sqlite3_uint64 nIn; /* Bytes received */ unsigned int nPage; /* Total number of pages in the database */ unsigned int szPage; /* Database page size */ unsigned int nHashSent; /* Hashes sent (replica to origin) */ @@ -1235,13 +1237,15 @@ closeDb(p); return; } hashRegister(p->db); runSql(p, "BEGIN"); - runSqlReturnText(p, buf, "PRAGMA journal_mode"); - if( sqlite3_stricmp(buf,"wal")!=0 ){ - reportError(p, "Origin database is not in WAL mode"); + if( p->bWalOnly ){ + runSqlReturnText(p, buf, "PRAGMA journal_mode"); + if( sqlite3_stricmp(buf,"wal")!=0 ){ + reportError(p, "Origin database is not in WAL mode"); + } } runSqlReturnUInt(p, &nPage, "PRAGMA page_count"); runSqlReturnUInt(p, &szPg, "PRAGMA page_size"); if( p->nErr==0 ){ @@ -1461,14 +1465,16 @@ runSql(p, "PRAGMA replica.page_size=%u", szOPage); runSql(p, "PRAGMA replica.journal_mode=WAL"); runSql(p, "SELECT * FROM replica.sqlite_schema"); } runSql(p, "BEGIN IMMEDIATE"); - runSqlReturnText(p, buf, "PRAGMA replica.journal_mode"); - if( strcmp(buf, "wal")!=0 ){ - reportError(p, "replica is not in WAL mode"); - break; + if( p->bWalOnly ){ + runSqlReturnText(p, buf, "PRAGMA replica.journal_mode"); + if( strcmp(buf, "wal")!=0 ){ + reportError(p, "replica is not in WAL mode"); + break; + } } runSqlReturnUInt(p, &nRPage, "PRAGMA replica.page_count"); runSqlReturnUInt(p, &szRPage, "PRAGMA replica.page_size"); if( szRPage!=szOPage ){ reportError(p, "page size mismatch; origin is %d bytes and " @@ -1667,31 +1673,32 @@ #define cli_opt_val cmdline_option_value(argc, argv, ++i) memset(&ctx, 0, sizeof(ctx)); for(i=1; i=2 ) printf("%s\n", zCmd); if( popen2(zCmd, &ctx.pIn, &ctx.pOut, &childPid, 0) ){