You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.6 KiB

  1. diff -ruN db-4.7.25.NC/sequence/sequence.c db-4.7.25.NC.new/sequence/sequence.c
  2. --- db-4.7.25.NC/sequence/sequence.c 2008-05-05 22:25:09.000000000 +0200
  3. +++ db-4.7.25.NC.new/sequence/sequence.c 2009-11-08 12:50:27.000000000 +0100
  4. @@ -187,7 +187,11 @@
  5. if ((ret = __db_get_flags(dbp, &tflags)) != 0)
  6. goto err;
  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 @@
  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. rp = &seq->seq_record;
  27. @@ -296,7 +305,12 @@
  28. */
  29. rp = seq->seq_data.data;
  30. if (rp->seq_version == DB_SEQUENCE_OLDVER) {
  31. -oldver: rp->seq_version = DB_SEQUENCE_VERSION;
  32. +oldver: if (IS_REP_CLIENT(env) &&
  33. + !F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
  34. + ret = __db_rdonly(env, "DB_SEQUENCE->open");
  35. + goto err;
  36. + }
  37. + rp->seq_version = DB_SEQUENCE_VERSION;
  38. if (!F_ISSET(env, ENV_LITTLEENDIAN)) {
  39. if (IS_DB_AUTO_COMMIT(dbp, txn)) {
  40. if ((ret =
  41. @@ -707,6 +721,13 @@
  42. MUTEX_LOCK(env, seq->mtx_seq);
  43. + if (handle_check && IS_REP_CLIENT(env) &&
  44. + !F_ISSET(dbp, DB_AM_NOT_DURABLE)) {
  45. + ret = __db_rdonly(env, "DB_SEQUENCE->get");
  46. + goto err;
  47. + }
  48. +
  49. +
  50. if (rp->seq_min + delta > rp->seq_max) {
  51. __db_errx(env, "Sequence overflow");
  52. ret = EINVAL;