Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-5953

Set CurrentSCN value can not write data

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Not A Problem
    • 4.14.0
    • None
    • connectors, core
    • None
    • <dependency>
      <groupId>org.apache.phoenix</groupId>
      <artifactId>phoenix-core</artifactId>
      <version>4.14.0-HBase-1.3</version>
      </dependency>

    Description

      I want to write data to hbase by pheonix, and set data ttl,my code like this:

       

      //代码占位符
      public void getConncetion() throws SQLException {
              Properties info = new Properties();
              if(dataTTL > 0) {
                  info.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(System.currentTimeMillis() - dataTTL));
              }
      
              if (userName != null) {
                  info.put("user", userName);
              }
      
              if (password != null) {
                  info.put("password", password);
              }
              connection = (Connection) DriverManager.getConnection(dbUrl, info);
              connection.setAutoCommit(true);
      
          }
      
      connection.createStatement().execute("UPSERT INTO ZXVMAX.\"waterdrop_phonex_test\"(\"NAME\", \"AGE\") values('test', "+ System.currentTimeMillis() +")");
      

      but it can not write.The Exception :

       info: write to Hbase failed......sql:UPSERT INTO ZXVMAX."waterdrop_phonex_test"("NAME", "AGE") values(?,?)java.sql.SQLException: ERROR 518 (25502): Mutations are not permitted for a read-only connection. at org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:494) at org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:150) at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:383) at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:378) at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1825) at io.github.interestinglab.waterdrop.flink.sink.HBasePhoenixSink.invoke(HBasePhoenixSink.java:100) at io.github.interestinglab.waterdrop.flink.sink.HBasePhoenixSink.invoke(HBasePhoenixSink.java:15) at org.apache.flink.streaming.api.operators.StreamSink.processElement(StreamSink.java:56) at org.apache.flink.streaming.runtime.tasks.OperatorChain$CopyingChainingOutput.pushToOperator(OperatorChain.java:637) at org.apache.flink.streaming.runtime.tasks.OperatorChain$CopyingChainingOutput.collect(OperatorChain.java:612) at org.apache.flink.streaming.runtime.tasks.OperatorChain$CopyingChainingOutput.collect(OperatorChain.java:592) at org.apache.flink.streaming.api.operators.AbstractStreamOperator$CountingOutput.collect(AbstractStreamOperator.java:727) at org.apache.flink.streaming.api.operators.AbstractStreamOperator$CountingOutput.collect(AbstractStreamOperator.java:705) at org.apache.flink.streaming.api.operators.StreamMap.processElement(StreamMap.java:41)

      .......... 

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            liqi316 liqi316
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: