Blame SOURCES/patch.4.7.25.1

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