Blame SOURCES/patch.4.7.25.1

9e325d
*** sequence/sequence.c.orig	2008-05-05 13:25:09.000000000 -0700
9e325d
--- sequence/sequence.c	2008-08-15 09:58:46.000000000 -0700
9e325d
***************
9e325d
*** 187,193 ****
9e325d
  	if ((ret = __db_get_flags(dbp, &tflags)) != 0)
9e325d
  		goto err;
9e325d
  
9e325d
! 	if (DB_IS_READONLY(dbp)) {
9e325d
  		ret = __db_rdonly(dbp->env, "DB_SEQUENCE->open");
9e325d
  		goto err;
9e325d
  	}
9e325d
--- 187,197 ----
9e325d
  	if ((ret = __db_get_flags(dbp, &tflags)) != 0)
9e325d
  		goto err;
9e325d
  
9e325d
! 	/*
9e325d
! 	 * We can let replication clients open sequences, but must
9e325d
! 	 * check later that they do not update them.
9e325d
! 	 */
9e325d
! 	if (F_ISSET(dbp, DB_AM_RDONLY)) {
9e325d
  		ret = __db_rdonly(dbp->env, "DB_SEQUENCE->open");
9e325d
  		goto err;
9e325d
  	}
9e325d
***************
9e325d
*** 244,249 ****
9e325d
--- 248,258 ----
9e325d
  		if ((ret != DB_NOTFOUND && ret != DB_KEYEMPTY) ||
9e325d
  		    !LF_ISSET(DB_CREATE))
9e325d
  			goto err;
9e325d
+ 		if (IS_REP_CLIENT(env) &&
9e325d
+ 		    !F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
9e325d
+ 			ret = __db_rdonly(env, "DB_SEQUENCE->open");
9e325d
+ 			goto err;
9e325d
+ 		}
9e325d
  		ret = 0;
9e325d
  
9e325d
  		rp = &seq->seq_record;
9e325d
***************
9e325d
*** 296,302 ****
9e325d
  	 */
9e325d
  	rp = seq->seq_data.data;
9e325d
  	if (rp->seq_version == DB_SEQUENCE_OLDVER) {
9e325d
! oldver:		rp->seq_version = DB_SEQUENCE_VERSION;
9e325d
  		if (!F_ISSET(env, ENV_LITTLEENDIAN)) {
9e325d
  			if (IS_DB_AUTO_COMMIT(dbp, txn)) {
9e325d
  				if ((ret =
9e325d
--- 305,316 ----
9e325d
  	 */
9e325d
  	rp = seq->seq_data.data;
9e325d
  	if (rp->seq_version == DB_SEQUENCE_OLDVER) {
9e325d
! oldver:		if (IS_REP_CLIENT(env) &&
9e325d
! 		    !F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
9e325d
! 			ret = __db_rdonly(env, "DB_SEQUENCE->open");
9e325d
! 			goto err;
9e325d
! 		}
9e325d
! 		rp->seq_version = DB_SEQUENCE_VERSION;
9e325d
  		if (!F_ISSET(env, ENV_LITTLEENDIAN)) {
9e325d
  			if (IS_DB_AUTO_COMMIT(dbp, txn)) {
9e325d
  				if ((ret =
9e325d
***************
9e325d
*** 707,712 ****
9e325d
--- 721,733 ----
9e325d
  
9e325d
  	MUTEX_LOCK(env, seq->mtx_seq);
9e325d
  
9e325d
+ 	if (handle_check && IS_REP_CLIENT(env) &&
9e325d
+ 	    !F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
9e325d
+ 		ret = __db_rdonly(env, "DB_SEQUENCE->get");
9e325d
+ 		goto err;
9e325d
+ 	}
9e325d
+ 
9e325d
+ 
9e325d
  	if (rp->seq_min + delta > rp->seq_max) {
9e325d
  		__db_errx(env, "Sequence overflow");
9e325d
  		ret = EINVAL;