isNull(true) leaves Value in unsafe state for stream mode get

Bug #1081659 reported by Peter Beaman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Akiban Persistit
Fix Released
High
Peter Beaman

Bug Description

akiban persistit r392

The method isNull(boolean) was added in Persistit version 3.2.1. In that version, when isNull(true) actually skips a null in stream mode, the serialized item count is not incremented due to omitted code. This causes subsequent get operations to fail. The following sequence of operations (See com.persistit.unit.ValueTest2) causes an IllegalStateException due to this problem, and the problem was first observed in Akiban Server.

        final Value value = new Value(_persistit);
        value.setStreamMode(true);
        value.put(null);
        value.put(ABC);
        value.put(null);
        value.put(ABC);
        value.setStreamMode(false);
        value.setStreamMode(true);
        assertTrue("Expect null", value.isNull(true));
        assertEquals("Don't expect null", ABC, value.get());
        assertTrue("Expect null", value.isNull(true));
        assertEquals("Expect String", String.class, value.getType());

In the last statement, value.getType() uses a reference to field 1 (count starts at 0), which is the first of two identical instances of ABC in the value. However, because the counter is not incremented, the value cache used to hold previously scanned fields is off by one and the reference to field one contains a null rather than an Object.

Related branches

Peter Beaman (pbeaman)
Changed in akiban-persistit:
assignee: nobody → Peter Beaman (pbeaman)
Peter Beaman (pbeaman)
description: updated
Changed in akiban-persistit:
status: Confirmed → Fix Committed
Peter Beaman (pbeaman)
Changed in akiban-persistit:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.