I made these modifications and the following compiles, runs, and fails on
geode.
I added the following to RegionVersionVectorJUnitTest:
  @Test
  public void testInitialized() {

    RegionVersionHolder<String> vh1 = new RegionVersionHolder<>("vh1");
    vh1.recordVersion(56);
    vh1.recordVersion(57);
    vh1.recordVersion(58);
    vh1.recordVersion(59);
    vh1.recordVersion(60);
    assertTrue(vh1.contains(57));
    vh1 = vh1.clone();
    assertTrue(vh1.contains(57));
    System.out.println("This node init, vh1="+vh1);

    RegionVersionHolder<String> vh2 = new RegionVersionHolder<>("vh2");
    for(int i=1;i<57;i++) {
      vh2.recordVersion(i);
    }
    vh2 = vh2.clone();
    System.out.println("GII node init, vh2="+vh2);

    vh1.initializeFrom(vh2);
    // assertTrue(vh1.contains(57)); // fails
    vh1 = vh1.clone();
    System.out.println("After initialize, vh1="+vh1);

    vh1.recordVersion(58);
    vh1.recordVersion(59);
    vh1.recordVersion(60);

    System.out.println("After initialize and record version, vh1="+vh1);

    vh1 = vh1.clone();
    vh1.recordVersion(57);
    System.out.println("After initialize and record version after clone,
vh1="+vh1);

    assertTrue(vh1.contains(57)); //FAILS
  }


On Tue, May 23, 2017 at 9:37 AM, Kirk Lund <kl...@apache.org> wrote:

> Are you sure you're using Geode? The signature of
> RegionVersionHolder#recordVersion
> in Geode is:
>
> RegionVersionHolder#recordVersion(long)
>
> I recommend checking out develop branch of Geode, write a test to confirm
> your bug and then submit that test with a Jira ticket.
>
> On Tue, May 23, 2017 at 7:10 AM, Suranjan Kumar <suranjan.ku...@gmail.com>
> wrote:
>
> > Hi Bruce/Dan,
> >
> >  #1. I see some issues due to introduction of special exceptions in the
> > RegionVersionHolder. In some cases, it is leading to RegionVersionHolder
> > data structure corruption causing wrong contains(version) results.
> >
> >  This happens because we set the version to max of currentVersion or
> newly
> > recorded one. But do not try to fix the special exception present if any.
> >
> >  It is easily reproducible even in junit tests.
> > The corruption of holder data stricture causes even future record
> operation
> > to fail.
> > For example the following test fails:
> >
> >  public void testInitialized() {
> >
> >   RegionVersionHolder vh1 = new RegionVersionHolder(member);
> >   vh1.recordVersion(56, null);
> >   vh1.recordVersion(57, null);
> >   vh1.recordVersion(58, null);
> >   vh1.recordVersion(59, null);
> >   vh1.recordVersion(60, null);
> >   vh1 = vh1.clone();
> >   System.out.println("This node init, vh1="+vh1);
> >
> >   RegionVersionHolder vh2 = new RegionVersionHolder(member);
> >   for(int i=1;i<57;i++) {
> >     vh2.recordVersion(i,null);
> >   }
> >   vh2 = vh2.clone();
> >   System.out.println("GII node init, vh2="+vh2);
> >
> >   vh1.initializeFrom(vh2);
> >   vh1 = vh1.clone();
> >   System.out.println("After initialize, vh1="+vh1);
> >
> >
> >   vh1.recordVersion(58,null);
> >   vh1.recordVersion(59,null);
> >   vh1.recordVersion(60,null);
> >
> >   System.out.println("After initialize and record version, vh1="+vh1);
> >
> >   vh1 = vh1.clone();
> >   vh1.recordVersion(57,null);
> >   System.out.println("After initialize and record version after clone,
> > vh1="+vh1);
> >
> >   assertTrue(vh1.contains(57)); //FAILS
> > }
> >
> >
> >  #2. I have observed that
> > RegionVersionHolder#initializeFrom(RegionVersionHolder<T> source)
> > doesn't not record already recorded version in itself contrary to what
> > the comment above the method claims. In fact the junit tests also
> > verifies the same so I couldn't understand the rationale behind it. It
> > just adds an special exception if any higher version was already
> > recorded by self.
> >  Shouldn't the resulting holder after initializing from a source
> > contain records for both the holders? If not then why do we even need
> > special exception.
> >
> > If possible could you please let me know your thoughts on this.
> >
> > Regards,
> > Suranjan Kumar
> >
>

Reply via email to