You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Swaroopa Kadam (JIRA)" <ji...@apache.org> on 2018/08/21 22:53:00 UTC
[jira] [Updated] (PHOENIX-3178) Row count incorrect for UPSERT
SELECT when auto commit is false
[ https://issues.apache.org/jira/browse/PHOENIX-3178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Swaroopa Kadam updated PHOENIX-3178:
------------------------------------
Description:
To reproduce, use the following test:
{code:java}
@Test
public void testRowCountWithNoAutoCommitOnUpsertSelect() throws Exception {
Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
props.setProperty(QueryServices.MUTATE_BATCH_SIZE_ATTRIB, Integer.toString(3));
props.setProperty(QueryServices.SCAN_CACHE_SIZE_ATTRIB, Integer.toString(3));
props.setProperty(QueryServices.SCAN_RESULT_CHUNK_SIZE, Integer.toString(3));
Connection conn = DriverManager.getConnection(getUrl(), props);
conn.setAutoCommit(false);
conn.createStatement().execute("CREATE SEQUENCE keys");
String tableName = generateRandomString();
conn.createStatement().execute(
"CREATE TABLE " + tableName + " (pk INTEGER PRIMARY KEY, val INTEGER)");
conn.createStatement().execute(
"UPSERT INTO " + tableName + " VALUES (NEXT VALUE FOR keys,1)");
conn.commit();
for (int i=0; i<6; i++) {
Statement stmt = conn.createStatement();
int upsertCount = stmt.executeUpdate(
"UPSERT INTO " + tableName + " SELECT NEXT VALUE FOR keys, val FROM " + tableName);
conn.commit();
assertEquals((int)Math.pow(2, i), upsertCount);
}
conn.close();
}
{code}
was:
To reproduce, use the following test:
{code}
@Test
public void testRowCountWithNoAutoCommitOnUpsertSelect() throws Exception {
Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
props.setProperty(QueryServices.MUTATE_BATCH_SIZE_ATTRIB, Integer.toString(3));
props.setProperty(QueryServices.SCAN_CACHE_SIZE_ATTRIB, Integer.toString(3));
props.setProperty(QueryServices.SCAN_RESULT_CHUNK_SIZE, Integer.toString(3));
Connection conn = DriverManager.getConnection(getUrl(), props);
conn.setAutoCommit(false);
conn.createStatement().execute("CREATE SEQUENCE keys");
String tableName = generateRandomString();
conn.createStatement().execute(
"CREATE TABLE " + tableName + " (pk INTEGER PRIMARY KEY, val INTEGER)");
conn.createStatement().execute(
"UPSERT INTO " + tableName + " VALUES (NEXT VALUE FOR keys,1)");
conn.commit();
for (int i=0; i<6; i++) {
Statement stmt = conn.createStatement();
int upsertCount = stmt.executeUpdate(
"UPSERT INTO " + tableName + " SELECT NEXT VALUE FOR keys, val FROM " + tableName);
conn.commit();
assertEquals((int)Math.pow(2, i), upsertCount);
}
conn.close();
}
{code}
> Row count incorrect for UPSERT SELECT when auto commit is false
> ---------------------------------------------------------------
>
> Key: PHOENIX-3178
> URL: https://issues.apache.org/jira/browse/PHOENIX-3178
> Project: Phoenix
> Issue Type: Bug
> Reporter: James Taylor
> Assignee: Swaroopa Kadam
> Priority: Major
> Labels: newbie
> Fix For: 4.15.0
>
>
> To reproduce, use the following test:
> {code:java}
> @Test
> public void testRowCountWithNoAutoCommitOnUpsertSelect() throws Exception {
> Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
> props.setProperty(QueryServices.MUTATE_BATCH_SIZE_ATTRIB, Integer.toString(3));
> props.setProperty(QueryServices.SCAN_CACHE_SIZE_ATTRIB, Integer.toString(3));
> props.setProperty(QueryServices.SCAN_RESULT_CHUNK_SIZE, Integer.toString(3));
> Connection conn = DriverManager.getConnection(getUrl(), props);
> conn.setAutoCommit(false);
> conn.createStatement().execute("CREATE SEQUENCE keys");
> String tableName = generateRandomString();
> conn.createStatement().execute(
> "CREATE TABLE " + tableName + " (pk INTEGER PRIMARY KEY, val INTEGER)");
> conn.createStatement().execute(
> "UPSERT INTO " + tableName + " VALUES (NEXT VALUE FOR keys,1)");
> conn.commit();
> for (int i=0; i<6; i++) {
> Statement stmt = conn.createStatement();
> int upsertCount = stmt.executeUpdate(
> "UPSERT INTO " + tableName + " SELECT NEXT VALUE FOR keys, val FROM " + tableName);
> conn.commit();
> assertEquals((int)Math.pow(2, i), upsertCount);
> }
> conn.close();
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)