phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maryann Xue (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (PHOENIX-2647) Duplicate results in reverse scan after running "update statistics"
Date Tue, 02 Feb 2016 03:32:39 GMT

     [ https://issues.apache.org/jira/browse/PHOENIX-2647?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Maryann Xue updated PHOENIX-2647:
---------------------------------
    Description: 
This problem seems to only occur with reverse scan not forward scan. Adding the below tests
and settings in OrderByIT can reproduce the issue. I ended up getting two rows of "ROW7" instead
of one.
{code}
    
    @BeforeClass
    public static void doSetup() throws Exception {
        Map<String,String> props = getDefaultProps();
        props.put(QueryServices.RUN_UPDATE_STATS_ASYNC, Boolean.FALSE.toString());
        props.put(QueryServices.COMMIT_STATS_ASYNC, Boolean.FALSE.toString());
        props.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, Long.toString(1000));
        setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
    }

    @Test
    public void testReverseScan() throws Exception {
        long ts = nextTimestamp();
        String tenantId = getOrganizationId();
        initATableValues(tenantId, getDefaultSplits(tenantId), null, ts);
        String query = "SELECT entity_id FROM aTable ORDER BY organization_id desc";
        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute
at timestamp 2
        Connection conn = DriverManager.getConnection(getUrl(), props);
        conn.createStatement().execute("UPDATE STATISTICS ATABLE");
        conn.commit();
        conn.close();
        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 5)); // Execute
at timestamp 2
        conn = DriverManager.getConnection(getUrl(), props);
        try {
            PreparedStatement statement = conn.prepareStatement(query);
            ResultSet rs = statement.executeQuery();
            assertTrue (rs.next());
            assertEquals(ROW9,rs.getString(1));
            assertTrue (rs.next());
            assertEquals(ROW8,rs.getString(1));
            assertTrue (rs.next());
            assertEquals(ROW7,rs.getString(1));
            assertTrue (rs.next());
            assertEquals(ROW6,rs.getString(1));
            assertTrue (rs.next());
            assertEquals(ROW5,rs.getString(1));
            assertTrue (rs.next());
            assertEquals(ROW4,rs.getString(1));
            assertTrue (rs.next());
            assertEquals(ROW3,rs.getString(1));
            assertTrue (rs.next());
            assertEquals(ROW2,rs.getString(1));
            assertTrue (rs.next());
            assertEquals(ROW1,rs.getString(1));

            assertFalse(rs.next());
        } finally {
            conn.close();
        }
    }
{code}

  was:
This problem seems to only occur with reverse scan not forward scan. Adding the below tests
and settings in OrderByIT can reproduce the issue.
{code}
    
    @BeforeClass
    public static void doSetup() throws Exception {
        Map<String,String> props = getDefaultProps();
        props.put(QueryServices.RUN_UPDATE_STATS_ASYNC, Boolean.FALSE.toString());
        props.put(QueryServices.COMMIT_STATS_ASYNC, Boolean.FALSE.toString());
        props.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, Long.toString(1000));
        setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
    }

    @Test
    public void testReverseScan() throws Exception {
        long ts = nextTimestamp();
        String tenantId = getOrganizationId();
        initATableValues(tenantId, getDefaultSplits(tenantId), null, ts);
        String query = "SELECT entity_id FROM aTable ORDER BY organization_id desc";
        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute
at timestamp 2
        Connection conn = DriverManager.getConnection(getUrl(), props);
        conn.createStatement().execute("UPDATE STATISTICS ATABLE");
        conn.commit();
        conn.close();
        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 5)); // Execute
at timestamp 2
        conn = DriverManager.getConnection(getUrl(), props);
        try {
            PreparedStatement statement = conn.prepareStatement(query);
            ResultSet rs = statement.executeQuery();
            assertTrue (rs.next());
            assertEquals(ROW9,rs.getString(1));
            assertTrue (rs.next());
            assertEquals(ROW8,rs.getString(1));
            assertTrue (rs.next());
            assertEquals(ROW7,rs.getString(1));
            assertTrue (rs.next());
            assertEquals(ROW6,rs.getString(1));
            assertTrue (rs.next());
            assertEquals(ROW5,rs.getString(1));
            assertTrue (rs.next());
            assertEquals(ROW4,rs.getString(1));
            assertTrue (rs.next());
            assertEquals(ROW3,rs.getString(1));
            assertTrue (rs.next());
            assertEquals(ROW2,rs.getString(1));
            assertTrue (rs.next());
            assertEquals(ROW1,rs.getString(1));

            assertFalse(rs.next());
        } finally {
            conn.close();
        }
    }
{code}


> Duplicate results in reverse scan after running "update statistics"
> -------------------------------------------------------------------
>
>                 Key: PHOENIX-2647
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2647
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.7.0
>            Reporter: Maryann Xue
>
> This problem seems to only occur with reverse scan not forward scan. Adding the below
tests and settings in OrderByIT can reproduce the issue. I ended up getting two rows of "ROW7"
instead of one.
> {code}
>     
>     @BeforeClass
>     public static void doSetup() throws Exception {
>         Map<String,String> props = getDefaultProps();
>         props.put(QueryServices.RUN_UPDATE_STATS_ASYNC, Boolean.FALSE.toString());
>         props.put(QueryServices.COMMIT_STATS_ASYNC, Boolean.FALSE.toString());
>         props.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, Long.toString(1000));
>         setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
>     }
>     @Test
>     public void testReverseScan() throws Exception {
>         long ts = nextTimestamp();
>         String tenantId = getOrganizationId();
>         initATableValues(tenantId, getDefaultSplits(tenantId), null, ts);
>         String query = "SELECT entity_id FROM aTable ORDER BY organization_id desc";
>         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
>         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2));
// Execute at timestamp 2
>         Connection conn = DriverManager.getConnection(getUrl(), props);
>         conn.createStatement().execute("UPDATE STATISTICS ATABLE");
>         conn.commit();
>         conn.close();
>         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 5));
// Execute at timestamp 2
>         conn = DriverManager.getConnection(getUrl(), props);
>         try {
>             PreparedStatement statement = conn.prepareStatement(query);
>             ResultSet rs = statement.executeQuery();
>             assertTrue (rs.next());
>             assertEquals(ROW9,rs.getString(1));
>             assertTrue (rs.next());
>             assertEquals(ROW8,rs.getString(1));
>             assertTrue (rs.next());
>             assertEquals(ROW7,rs.getString(1));
>             assertTrue (rs.next());
>             assertEquals(ROW6,rs.getString(1));
>             assertTrue (rs.next());
>             assertEquals(ROW5,rs.getString(1));
>             assertTrue (rs.next());
>             assertEquals(ROW4,rs.getString(1));
>             assertTrue (rs.next());
>             assertEquals(ROW3,rs.getString(1));
>             assertTrue (rs.next());
>             assertEquals(ROW2,rs.getString(1));
>             assertTrue (rs.next());
>             assertEquals(ROW1,rs.getString(1));
>             assertFalse(rs.next());
>         } finally {
>             conn.close();
>         }
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message