GBase 8a数据库表空间指定为hdfs存储执行dml报错问题分析
表空间指定为hdfs存储,执行dml报错问题分析
gbase> create table t(a int);
Query OK, 0 rows affected (Elapsed: 00:00:00.58)
gbase> show full tablespaces;
+--------------------+-----------------------------------------+------------+
| Tablespace_in_test | Tablespace_in_test | Is_default |
+--------------------+-----------------------------------------+------------+
| sys_tablespace | hdp://gbase@10.10.0.127:50070/testdata/ | yes |
+--------------------+-----------------------------------------+------------+
1 row in set (Elapsed: 00:00:00.01)
gbase> insert into t values(1);
Query OK, 1 row affected (Elapsed: 00:00:00.42)
--## insert报错
gbase> insert into t values(2);
ERROR 1705 (HY000): gcluster DML error: 10.10.0.127:5050Failed to query in gnode:
DETAIL: (GBA-01EX-700) Gbase general error: save to paxfile error. Open and Create HDFSFile failed : instance/testdata/dbs/dbid/10/tbid/411/data/pid/5192376086697323446124016163618816-w-377-r-0
SQL: INSERT /10.10.0.127_106_7_2023-11-17_14:13:46/ INTO "vc00001_test"."t" VALUES (2)
--##加载报错
load data infile 'ftp://gbase:gbase@10.10.0.127/data/wzx/tbl/lineitem.tbl'into table plist_lineitem45 fields terminated by '|' table_fields 'L_ORDERKEY,L_PARTKEY,L_SUPPKEY,L_LINENUMBER,L_QUANTITY,L_EXTENDEDPRICE,L_DISCOUNT,L_TAX,L_RETURNFLAG,L_LINESTATUS,L_SHIPDATE,L_COMMITDATE,L_RECEIPTDATE,L_SHIPINSTRUCT,L_SHIPMODE,L_COMMENT'--------------
ERROR 1733 (HY000) at line 47: (GBA-01EX-700) Gbase general error: 10.10.0.127:5050Failed to query in gnode:
DETAIL: (GBA-01EX-700) Gbase general error: SaveToPaxFile failedSQL: flush commit vc00001_test
.plist_lineitem45
scn_number 331
排查报错原因:
(1)查看fdb服务是否正常
(2)查看集群节点/etc/hosts文件是否配置了hadoop的主机名信息
(3)查看hadoop服务是否正常
按照以上几种情况进行问题排查,均未发现问题,查看执行节点的express.log日志也未发现其他问题,通过查看hadoop集群的log文件:hadoop-hdfs-namenode-node73.log,有如下内容记录:
org.apache.hadoop.ipc.Server: IPC Server handler 6 on 9000, call org.apache.hadoop.hdfs.protocol.ClientProtocol.create from 10.10.0.127:46280 Call#2065882 Retry#0: org.apache.hadoop.security.AccessControlException: Permission denied: user=gbase, access=WRITE, inode="/testdata":hdfs:hadoop:drwxr-xr-x
排查到问题原因:权限问题,gbase用户没有/testdata的写权限
查看hadoop目录权限
[hdfs@node73 hadoop]$ bin/hdfs dfs -ls /
drwxr-xr-x - hdfs hadoop 0 2023-11-17 13:49 /testdata
解决办法:将/testdata权限修改为
[hdfs@node73 hadoop]$ bin/hdfs dfs -chmod 777 /testdata
[hdfs@node73 hadoop]$ bin/hdfs dfs -ls /
drwxrwxrwx - hdfs hadoop 0 2023-11-17 13:49 /testdata
修改完成后,再执行dml操作成功
gbase> insert into t values(2);
Query OK, 1 row affected (Elapsed: 00:00:00.57)
gbase> insert into t values(3);
Query OK, 1 row affected (Elapsed: 00:00:01.48)
<UMBER,L_QUANTITY,L_EXTENDEDPRICE,L_DISCOUNT,L_TAX,L_RETURNFLAG,L_LINESTATUS,L_SHIPDATE,L_COMMITDATE,L_RECEIPTDATE,L_SHIPINSTRUCT,L_SHIPMODE,L_COMMENT';
Query OK, 60175 rows affected (Elapsed: 01:38:32.92)
Task 30 finished, Loaded 60175 records, Skipped 0 records