010-patch.4.7.25.1.patch (1585B)
1 --- a/sequence/sequence.c 2 +++ b/sequence/sequence.c 3 @@ -187,7 +187,11 @@ __seq_open_pp(seq, txn, keyp, flags) 4 if ((ret = __db_get_flags(dbp, &tflags)) != 0) 5 goto err; 6 7 - if (DB_IS_READONLY(dbp)) { 8 + /* 9 + * We can let replication clients open sequences, but must 10 + * check later that they do not update them. 11 + */ 12 + if (F_ISSET(dbp, DB_AM_RDONLY)) { 13 ret = __db_rdonly(dbp->env, "DB_SEQUENCE->open"); 14 goto err; 15 } 16 @@ -244,6 +248,11 @@ retry: if ((ret = __db_get(dbp, ip, 17 if ((ret != DB_NOTFOUND && ret != DB_KEYEMPTY) || 18 !LF_ISSET(DB_CREATE)) 19 goto err; 20 + if (IS_REP_CLIENT(env) && 21 + !F_ISSET(dbp, DB_AM_NOT_DURABLE)) { 22 + ret = __db_rdonly(env, "DB_SEQUENCE->open"); 23 + goto err; 24 + } 25 ret = 0; 26 27 rp = &seq->seq_record; 28 @@ -296,7 +305,12 @@ retry: if ((ret = __db_get(dbp, ip, 29 */ 30 rp = seq->seq_data.data; 31 if (rp->seq_version == DB_SEQUENCE_OLDVER) { 32 -oldver: rp->seq_version = DB_SEQUENCE_VERSION; 33 +oldver: if (IS_REP_CLIENT(env) && 34 + !F_ISSET(dbp, DB_AM_NOT_DURABLE)) { 35 + ret = __db_rdonly(env, "DB_SEQUENCE->open"); 36 + goto err; 37 + } 38 + rp->seq_version = DB_SEQUENCE_VERSION; 39 if (!F_ISSET(env, ENV_LITTLEENDIAN)) { 40 if (IS_DB_AUTO_COMMIT(dbp, txn)) { 41 if ((ret = 42 @@ -707,6 +721,13 @@ __seq_get(seq, txn, delta, retp, flags) 43 44 MUTEX_LOCK(env, seq->mtx_seq); 45 46 + if (handle_check && IS_REP_CLIENT(env) && 47 + !F_ISSET(dbp, DB_AM_NOT_DURABLE)) { 48 + ret = __db_rdonly(env, "DB_SEQUENCE->get"); 49 + goto err; 50 + } 51 + 52 + 53 if (rp->seq_min + delta > rp->seq_max) { 54 __db_errx(env, "Sequence overflow"); 55 ret = EINVAL;