Transaction locking out document as non-auth bug? (Test Included) 2.5.2910

26 views
Skip to first unread message

Lee

unread,
Aug 19, 2014, 12:35:51 PM8/19/14
to rav...@googlegroups.com

Below is a test which reproduces an issue that I came across.  If the save which occurs during the commit of the transaction takes the number of requests over the maximum allowed then it appears that any document it has touched as part of that session is locked as non-authoritative for a period of time.

Is this expected?

Raven Version - 2.5.2910

        [Ignore]
        [Test]
        public void Test()
        {
            using (var documentStore = new DocumentStore { ConnectionStringName = "RavenDB", Conventions = { MaxNumberOfRequestsPerSession = 2, }, })
            {
                documentStore.Initialize();

                var id = Guid.NewGuid().ToString();

                using (var session = documentStore.OpenSession())
                {
                    session.Store(new TestClass { Id = id });
                    session.SaveChanges();
                }

                Console.WriteLine("Initial doc created");

                try
                {
                    using (var scope = new TransactionScope())
                    {
                        using (var session = documentStore.OpenSession())
                        {
                            session.Advanced.AllowNonAuthoritativeInformation = false;
                            var doc = session.Load<TestClass>(id);
                            doc.Blah++;
                            session.SaveChanges();
                        }

                        scope.Complete();
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }

                Thread.Sleep(60000);

                Console.WriteLine("Retrieve initial document");
                using (var session = documentStore.OpenSession())
                {
                    session.Advanced.AllowNonAuthoritativeInformation = false;
                    session.Load<TestClass>(id);
                }
            }
        }

        public class TestClass
        {
            public string Id { get; set; }

            public int Blah { get; set; }
        }

Oren Eini (Ayende Rahien)

unread,
Aug 20, 2014, 9:27:51 AM8/20/14
to ravendb
Hi,
Yes, that is surprising, but expected. You exceeded the number of operations allowed, so the transaction failed.
But it didn't roll back, so the documents are locked for 1 minute.

We'll fix this, but the workaround is to increase the max # of ops.



Oren Eini

CEO


Mobile: + 972-52-548-6969

Office:  + 972-4-622-7811

Fax:      + 972-153-4622-7811






--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages