Няма описание

010-patch.4.7.25.1.patch 1.5KB

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