fluent-plugin-aliyun-odps 0.0.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -1
- data/VERSION +1 -1
- data/lib/fluent/plugin/out_aliyun_odps.rb +30 -40
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24f7ee66fa1af9233ffca9aa110d10c6e74cf4d7
|
4
|
+
data.tar.gz: 7dd141195033863d501c3e2be9ecc0e0e2075c94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 749bc9bfc987581ed7bbbff279ba61a695a3138ddb11a1f8c3d8d3588eee60d1c3c67a0aebb4fffa144215869827dcc9abb029551f6a9b87d75ebc55eaf4ea9e
|
7
|
+
data.tar.gz: 87ab9ea47266abb85bf222195cd64210a6fd9284864cec71964bd405da8fcd53bcfa68cc1802615024642e97ea71281b205a0069c6a22f890eec972cd750c546
|
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
@@ -97,15 +97,6 @@ module Fluent
|
|
97
97
|
@client = OdpsDatahub::StreamClient.new(odpsConfig, config[:project], @table)
|
98
98
|
@client.loadShard(@shard_number)
|
99
99
|
@client.waitForShardLoad
|
100
|
-
partitionMaps=@client.getPartitionList
|
101
|
-
@partitionList=[]
|
102
|
-
for map in partitionMaps do
|
103
|
-
partitionName=''
|
104
|
-
map.each { |k, v|
|
105
|
-
partitionName+=k+"="+v+","
|
106
|
-
}
|
107
|
-
@partitionList<<partitionName.chomp(",")
|
108
|
-
end
|
109
100
|
rescue => e
|
110
101
|
raise "loadShard failed,"+e.message
|
111
102
|
end
|
@@ -180,7 +171,7 @@ module Fluent
|
|
180
171
|
end
|
181
172
|
|
182
173
|
rescue => e
|
183
|
-
raise "Failed to format the data:"+e.backtrace.inspect.to_s
|
174
|
+
raise "Failed to format the data:"+ e.message + " " +e.backtrace.inspect.to_s
|
184
175
|
end
|
185
176
|
}
|
186
177
|
|
@@ -188,19 +179,11 @@ module Fluent
|
|
188
179
|
#multi thread
|
189
180
|
sendThread = Array.new
|
190
181
|
unless @partition.blank? then
|
191
|
-
partitions.each { |k, v|
|
192
|
-
#if the partition is not exist, create one
|
193
|
-
unless @partitionList.include?(k)
|
194
|
-
@client.addPartition(k)
|
195
|
-
@partitionList << k
|
196
|
-
@log.info "add partition "+k
|
197
|
-
end
|
198
|
-
}
|
199
182
|
for thread in 0..@thread_number-1
|
200
183
|
sendThread[thread] = Thread.start(thread) do |threadId|
|
201
|
-
|
202
|
-
|
203
|
-
|
184
|
+
partitions.each { |k, v|
|
185
|
+
retryTime = @retry_time
|
186
|
+
begin
|
204
187
|
sendCount = v.size/@thread_number
|
205
188
|
restCount = 0
|
206
189
|
if threadId == @thread_number-1
|
@@ -208,27 +191,34 @@ module Fluent
|
|
208
191
|
end
|
209
192
|
@client.createStreamArrayWriter().write(v[sendCount*threadId..sendCount*(threadId+1)+restCount-1], k)
|
210
193
|
@log.info "Successfully import "+(sendCount+restCount).to_s+" data to partition:"+k+",table:"+@table+" at threadId:"+threadId.to_s
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
if
|
226
|
-
@log.
|
194
|
+
rescue => e
|
195
|
+
# reload shard
|
196
|
+
if e.message.include? "ShardNotReady" or e.message.include? "InvalidShardId"
|
197
|
+
@log.warn "write failed, msg:" + e.message + ", reload shard."
|
198
|
+
@client.loadShard(@shard_number)
|
199
|
+
@client.waitForShardLoad
|
200
|
+
elsif e.message.include? "NoSuchPartition"
|
201
|
+
begin
|
202
|
+
@client.addPartition(k)
|
203
|
+
@log.info "add partition "+ k
|
204
|
+
rescue => ex
|
205
|
+
@log.error "add partition failed"+ ex.message
|
206
|
+
end
|
207
|
+
end
|
208
|
+
if retryTime > 0
|
209
|
+
@log.warn "Fail to write, retry in " + @retry_interval.to_s + "sec. Error at threadId:"+threadId.to_s+" Msg:"+e.message
|
210
|
+
sleep(@retry_interval)
|
211
|
+
retryTime -= 1
|
212
|
+
retry
|
227
213
|
else
|
228
|
-
|
214
|
+
if (@abandon_mode)
|
215
|
+
@log.error "Retry failed, abandon this pack. Msg:" + e.message
|
216
|
+
else
|
217
|
+
raise e
|
218
|
+
end
|
229
219
|
end
|
230
220
|
end
|
231
|
-
|
221
|
+
}
|
232
222
|
end
|
233
223
|
end
|
234
224
|
else
|
@@ -273,7 +263,7 @@ module Fluent
|
|
273
263
|
end
|
274
264
|
rescue => e
|
275
265
|
# ignore other exceptions to use Fluentd retry
|
276
|
-
raise "write records failed,"+e.backtrace.inspect.to_s
|
266
|
+
raise "write records failed," + e.message + " " +e.backtrace.inspect.to_s
|
277
267
|
end
|
278
268
|
end
|
279
269
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-aliyun-odps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xiao Dong
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-01-
|
12
|
+
date: 2016-01-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|