Re: Atomic UPSERT on indexed tables

2018-06-11 Thread James Taylor
It's possible that local indexes could be allowed for atomic upserts, but
global indexes are problematic (in that under load your cluster would
probably die). The reason is that there'd be a cross RS call made for each
row being atomically upserted. If the call hangs due to the RS hosting the
data being down, it ties up the handler thread which can lead to a
cascading effect when writes fail.

Not sure what your timeframe is, but support for Omid transactions is
getting close to being committed. It's on the omid2 feature branch. They
play well with HBase replication, so perhaps that's an option.

On Fri, Jun 8, 2018 at 12:01 PM, Miles Spielberg  wrote:

> This represents a serious shortcoming for our use case. We require some
> level of same-row atomic update capability on tables we'd also like to have
> global indices on. Our understanding is that running under Tephra doesn't
> play well with HBase replication, which we've been intending to use for
> disaster recovery.
>
> Our workload is read-dominated, so we think we're willing to accept the
> row-locking and write time performance penalties. Is this something that
> could be put under an option? Are there other significant shortcomings to
> combining ON DUPLICATE KEY with global indices?
>
> PHOENIX-3925 mentions "service protection," but I'm clear on what that's
> referring to.
>
> Miles Spielberg
> Staff Software Engineer
>
>
> O. 650.485.1102
> 900 Jefferson Ave
> 
> Redwood City, CA 94063
> 
>
> On Mon, Jun 4, 2018 at 7:14 PM, Sergey Soldatov 
> wrote:
>
>> Yes, the documentation doesn't reflect the recent changes. Please see
>> https://issues.apache.org/jira/browse/PHOENIX-3925
>>
>> Thanks,
>> Sergey
>>
>> On Fri, Jun 1, 2018 at 5:39 PM, Miles Spielberg  wrote:
>>
>>> From https://phoenix.apache.org/atomic_upsert.html:
>>>
>>> Although global indexes on columns being atomically updated are
 supported, it’s not recommended as a potentially a separate RPC across the
 wire would be made while the row is under lock to maintain the secondary
 index.
>>>
>>>
>>> But the parser on 4.13.1 doesn't seem to agree:
>>>
>>> 0: jdbc:phoenix:thin:url=http://192.168.99.10> CREATE TABLE T1 (A
>>> VARCHAR PRIMARY KEY, B VARCHAR);
>>>
>>> No rows affected (1.299 seconds)
>>>
>>> 0: jdbc:phoenix:thin:url=http://192.168.99.10> CREATE INDEX T1_B ON
>>> T1(B);
>>>
>>> No rows affected (6.285 seconds)
>>>
>>> 0: jdbc:phoenix:thin:url=http://192.168.99.10> UPSERT INTO T1(A,B)
>>> VALUES('hello', 'world') ON DUPLICATE KEY IGNORE;
>>>
>>> Error: Error -1 (0) : Error while executing SQL "UPSERT INTO T1(A,B)
>>> VALUES('hello', 'world') ON DUPLICATE KEY IGNORE": Remote driver error:
>>> RuntimeException: java.sql.SQLException: ERROR 1224 (42Z24): The ON
>>> DUPLICATE KEY clause may not be used when a table has a global index.
>>> tableName=T1 -> SQLException: ERROR 1224 (42Z24): The ON DUPLICATE KEY
>>> clause may not be used when a table has a global index. tableName=T1
>>> (state=0,code=-1)
>>>
>>> 0: jdbc:phoenix:thin:url=http://192.168.99.10>
>>>
>>> Am I doing something wrong here? Is the documentation inaccurate?
>>>
>>>
>>> Miles Spielberg
>>> Staff Software Engineer
>>>
>>>
>>> O. 650.485.1102
>>> 900 Jefferson Ave
>>> 
>>> Redwood City, CA 94063
>>> 
>>>
>>
>>
>


[ANNOUNCE] Apache Phoenix 4.14 released

2018-06-11 Thread James Taylor
The Apache Phoenix team is pleased to announce the immediate availability
of the 4.14.0 release. Apache Phoenix enables SQL-based OLTP and
operational analytics for Apache Hadoop using Apache HBase as its backing
store and providing integration with other projects in the Apache ecosystem
such as Spark, Hive, Pig, Flume, and MapReduce.

Highlights of the release include:

* Support for HBase 1.4
* Support for CDH 5.11.2, 5.12.2, 5.13.2, and 5.14.2
* Support for GRANT and REVOKE commands
* Secondary index improvements

For more details, visit our blog here [1] and download source and binaries
here [2].

Thanks,
James (on behalf of the Apache Phoenix team)

[1] https://blogs.apache.org/phoenix/entry/announcing-phoenix-4-14-released
[2] http://phoenix.apache.org/download.html


Columns casing in Phoenix tables

2018-06-11 Thread Ali Anwar
I've gotten started with Apache Phoenix by creating some tables and running
some queries. Mostly, I've noticed that Phoenix will uppercase the column
names. However, I have one table with lowercase column names; it is named
'shapes':

[image: image.png]

I am able to run select * queries against it, but I am unable to query any
of the columns:

[image: image.png]

0: jdbc:phoenix:> select shape from shapes;
>
> *Error: ERROR 504 (42703): Undefined column. columnName=SHAPE
> (state=42703,code=504)*org.apache.phoenix.schema.ColumnNotFoundException:
> ERROR 504 (42703): Undefined column. columnName=SHAPE
> at org.apache.phoenix.schema.PTableImpl.getColumn(PTableImpl.java:665)
> at org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.
> resolveColumn(FromCompiler.java:451)
> at org.apache.phoenix.compile.TupleProjectionCompiler$
> ColumnRefVisitor.visit(TupleProjectionCompiler.java:202)
> at org.apache.phoenix.compile.TupleProjectionCompiler$
> ColumnRefVisitor.visit(TupleProjectionCompiler.java:188)
> at org.apache.phoenix.parse.ColumnParseNode.accept(
> ColumnParseNode.java:56)
> at org.apache.phoenix.compile.TupleProjectionCompiler.
> createProjectedTable(TupleProjectionCompiler.java:107)
> at org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(
> QueryCompiler.java:525)
> at org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(
> QueryCompiler.java:504)
> at org.apache.phoenix.compile.QueryCompiler.compileSelect(
> QueryCompiler.java:199)
> at org.apache.phoenix.compile.QueryCompiler.compile(
> QueryCompiler.java:154)
> at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.
> compilePlan(PhoenixStatement.java:404)
> at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.
> compilePlan(PhoenixStatement.java:378)
> at org.apache.phoenix.jdbc.PhoenixStatement$1.call(
> PhoenixStatement.java:271)
> at org.apache.phoenix.jdbc.PhoenixStatement$1.call(
> PhoenixStatement.java:266)
> at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
> at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(
> PhoenixStatement.java:265)
> at org.apache.phoenix.jdbc.PhoenixStatement.execute(
> PhoenixStatement.java:1444)
> at sqlline.Commands.execute(Commands.java:822)
> at sqlline.Commands.sql(Commands.java:732)
> at sqlline.SqlLine.dispatch(SqlLine.java:808)
> at sqlline.SqlLine.begin(SqlLine.java:681)
> at sqlline.SqlLine.start(SqlLine.java:398)
> at sqlline.SqlLine.main(SqlLine.java:292)



Note that I am using phoenix-sqlline, which runs with the following client:

/usr/hdp/2.6.5.0-292/phoenix/phoenix-4.7.0.2.6.5.0-292-client.jar

It seems like this 'shapes' table with lowercase columns is problematic and
can not be queried regardless of the casing of my query.
I am unable to create new tables similar to this existing 'shapes' table,
since any new tables that I attempt to create result in columns with upper
case columns.

Any help or insight into this issue would be appreciated.

Regards,
Ali Anwar