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

ReadOnlyTableException occurs when we map Phoenix view to an existing HBase table with Namespace Mapping enabled

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 4.12.0
    • None
    • None

    Description

      Firstly, I created a namespace and a table in hbase shell:

      hbase> create_namespace "NS"
      hbase> create "NS:TBL", "CF"
      

      After that, I tried to create a phoenix view for this existing hbase table in phoenix-sqlline:

      phoenix> CREATE VIEW ns.tbl (pk VARCHAR PRIMARY KEY, cf.col VARCHAR);
      

      However, I encountered the following error and I was not able to create the view:

      org.apache.phoenix.schema.ReadOnlyTableException: ERROR 505 (42000): Table is read only.
      	at org.apache.phoenix.query.ConnectionQueryServicesImpl.ensureTableCreated(ConnectionQueryServicesImpl.java:1072)
      	at org.apache.phoenix.query.ConnectionQueryServicesImpl.createTable(ConnectionQueryServicesImpl.java:1434)
      	at org.apache.phoenix.schema.MetaDataClient.createTableInternal(MetaDataClient.java:2624)
      	at org.apache.phoenix.schema.MetaDataClient.createTable(MetaDataClient.java:1040)
      	at org.apache.phoenix.compile.CreateTableCompiler$2.execute(CreateTableCompiler.java:212)
      	at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:393)
      	at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:376)
      	at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
      	at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:375)
      	at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:363)
      	at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1707)
      	at org.apache.PhoenixTest.main(PhoenixTest.java:55)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
      

      Attachments

        1. PHOENIX-3944.patch
          8 kB
          Ankit Singhal
        2. PHOENIX-3944_v2.patch
          32 kB
          Ankit Singhal
        3. PHOENIX-3944_v3.patch
          32 kB
          Ankit Singhal
        4. PHOENIX-3944_v3_4.x_HBase-1.2.patch
          32 kB
          Ankit Singhal
        5. PHOENIX-3944_v4.patch
          37 kB
          Toshihiro Suzuki
        6. PHOENIX-3944_v4_4.x_HBase-1.2.patch
          38 kB
          Toshihiro Suzuki

        Issue Links

          Activity

            People

              brfrn169 Toshihiro Suzuki
              brfrn169 Toshihiro Suzuki
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: