业务中需要以读取快照的方式读取hbase表,刚开始会重新创建快照,但是遭遇了以下的异常:
rg.apache.hadoop.hbase.snapshot.SnapshotCreationException: org.apache.hadoop.hbase.snapshot.SnapshotCreationException: Rejected taking { ss=snapshotB table=tableA type=FLUSH } because we are a
lready running another snapshot on the same table { ss=snapshotA table=tableA type=FLUSH }
at org.apache.hadoop.hbase.master.snapshot.SnapshotManager.prepareToTakeSnapshot(SnapshotManager.java:433)
at org.apache.hadoop.hbase.master.snapshot.SnapshotManager.snapshotEnabledTable(SnapshotManager.java:495)
at org.apache.hadoop.hbase.master.snapshot.SnapshotManager.takeSnapshot(SnapshotManager.java:593)
at org.apache.hadoop.hbase.master.MasterRpcServices.snapshot(MasterRpcServices.java:1336)
at org.apache.hadoop.hbase.protobuf.generated.MasterProtos$MasterService$2.callBlockingMethod(MasterProtos.java:55708)
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2183)
at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:112)
at org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:183)
at org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:163)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.apache.hadoop.ipc.RemoteException.instantiateException(RemoteException.java:106)
at org.apache.hadoop.ipc.RemoteException.unwrapRemoteException(RemoteException.java:95)
at org.apache.hadoop.hbase.client.RpcRetryingCaller.translateException(RpcRetryingCaller.java:236)
at org.apache.hadoop.hbase.client.RpcRetryingCaller.translateException(RpcRetryingCaller.java:254)
at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:150)
at org.apache.hadoop.hbase.client.HBaseAdmin.executeCallable(HBaseAdmin.java:4313)
at org.apache.hadoop.hbase.client.HBaseAdmin.executeCallable(HBaseAdmin.java:4305)
at org.apache.hadoop.hbase.client.HBaseAdmin.takeSnapshotAsync(HBaseAdmin.java:3667)
at org.apache.hadoop.hbase.client.HBaseAdmin.snapshot(HBaseAdmin.java:3611)
at org.apache.hadoop.hbase.client.HBaseAdmin.snapshot(HBaseAdmin.java:3569)
at org.apache.hadoop.hbase.client.HBaseAdmin.snapshot(HBaseAdmin.java:3482)
at com.chinalife.distributable.commonUtils.HbaseUtils$.makeSnapshot(HbaseUtils.scala:71)
at com.chinalife.distributable.CntrStatementJob$.main(CntrStatementJob.scala:39)
at com.chinalife.distributable.CntrStatementJob.main(CntrStatementJob.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.spark.deploy.yarn.ApplicationMaster$$anon$2.run(ApplicationMaster.scala:552)
Caused by: org.apache.hadoop.hbase.ipc.RemoteWithExtrasException(org.apache.hadoop.hbase.snapshot.SnapshotCreationException): org.apache.hadoop.hbase.snapshot.SnapshotCreationException: Rejected taking { ss=snapshotB table=tableA type=FLUSH } because we are already running another snapshot on the same table { ss=snapshotA table=tableA type=FLUSH }
at org.apache.hadoop.hbase.master.snapshot.SnapshotManager.prepareToTakeSnapshot(SnapshotManager.java:433)
at org.apache.hadoop.hbase.master.snapshot.SnapshotManager.snapshotEnabledTable(SnapshotManager.java:495)
at org.apache.hadoop.hbase.master.snapshot.SnapshotManager.takeSnapshot(SnapshotManager.java:593)
at org.apache.hadoop.hbase.master.MasterRpcServices.snapshot(MasterRpcServices.java:1336)
at org.apache.hadoop.hbase.protobuf.generated.MasterProtos$MasterService$2.callBlockingMethod(MasterProtos.java:55708)
at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2183)
at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:112)
at org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:183)
at org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:163)
at org.apache.hadoop.hbase.ipc.RpcClientImpl.call(RpcClientImpl.java:1269)
at org.apache.hadoop.hbase.ipc.AbstractRpcClient.callBlockingMethod(AbstractRpcClient.java:227)
at org.apache.hadoop.hbase.ipc.AbstractRpcClient$BlockingRpcChannelImplementation.callBlockingMethod(AbstractRpcClient.java:336)
at org.apache.hadoop.hbase.protobuf.generated.MasterProtos$MasterService$BlockingStub.snapshot(MasterProtos.java:58707)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation$5.snapshot(ConnectionManager.java:2039)
at org.apache.hadoop.hbase.client.HBaseAdmin$43.call(HBaseAdmin.java:3672)
at org.apache.hadoop.hbase.client.HBaseAdmin$43.call(HBaseAdmin.java:3667)
at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:136)
... 14 more
首次见到该异常,不知其意,只能翻看源码,找到SnapshotManager类的prepareToTakeSnapshot方法:
直接看源码中注释就可以理解:对同一个表不能够同时创建快照,或者创建一个已存在的快照也是不可以的;