fluent-plugin-mysql-appender 0.4.6 → 0.4.7
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7f01fba2e7839e587695ca683f10af45bb0c27c
|
4
|
+
data.tar.gz: 5eb8a58ab97d30ff26f4df88d0aeecb975134389
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8b5697f237ba9fbd22b3d40e4d5eba602e6428c6f7d5be383d88bbd48a7b96c88f47210d4e7dc89ddffc17b449fbc2eaa241c25002dab3b3bd5cc3961c889e4
|
7
|
+
data.tar.gz: 9eb907dc34760b0d12068d43bb9e855a9539741f28154fe9f179510822228593cccc0e9ea8ea21b88fe3ebb5dde7fc8e74ff5417cf74755f4181f4dfae371242
|
@@ -60,10 +60,11 @@ module Fluent
|
|
60
60
|
end
|
61
61
|
|
62
62
|
loop do
|
63
|
+
start_time = Time.now
|
63
64
|
db = get_connection
|
64
65
|
configs.each do |config|
|
66
|
+
rows_count = 0
|
65
67
|
db.query(get_query(config)).each do |row|
|
66
|
-
rows_count = 0
|
67
68
|
if !config['entry_time'].nil? then
|
68
69
|
entry_time = get_time(row[config['entry_time']])
|
69
70
|
if (start_time - config['delay']) < entry_time then
|
@@ -79,8 +80,8 @@ module Fluent
|
|
79
80
|
router.emit(config['tag'], td_time, row)
|
80
81
|
rows_count += 1
|
81
82
|
config['last_id'] = row[config['primary_key']]
|
82
|
-
$log.info "mysql_appender_multi: :tag=>#{config['tag']} :rows_count=>#{rows_count} :last_id=>#{config['last_id']} "
|
83
83
|
end
|
84
|
+
$log.info "mysql_appender_multi: finished execution :tag=>#{config['tag']} :rows_count=>#{rows_count} :last_id=>#{config['last_id']}"
|
84
85
|
end
|
85
86
|
db.close
|
86
87
|
sleep @interval
|
data/setup_sample_db.sql
CHANGED
@@ -12,3 +12,18 @@ insert into test_tbl1 (column1, column2) value ('3','4');
|
|
12
12
|
insert into test_tbl1 (column1, column2) value ('5','6');
|
13
13
|
insert into test_tbl1 (column1, column2) value ('7','8');
|
14
14
|
|
15
|
+
create table test_tbl2 (
|
16
|
+
id int auto_increment,
|
17
|
+
column1 varchar(10),
|
18
|
+
column2 varchar(10),
|
19
|
+
created_at timestamp default current_timestamp,
|
20
|
+
primary key(id)
|
21
|
+
);
|
22
|
+
|
23
|
+
insert into test_tbl2 (column1, column2) value ('A','E');
|
24
|
+
insert into test_tbl2 (column1, column2) value ('B','F');
|
25
|
+
insert into test_tbl2 (column1, column2) value ('C','G');
|
26
|
+
insert into test_tbl2 (column1, column2) value ('D','H');
|
27
|
+
|
28
|
+
|
29
|
+
|
@@ -40,6 +40,19 @@ class MysqlAppenderMultiInputTest < Test::Unit::TestCase
|
|
40
40
|
entry_time: created_at
|
41
41
|
delay: 3h
|
42
42
|
td_database: sample_datasets
|
43
|
+
- table_name: test_tbl2
|
44
|
+
primary_key: id
|
45
|
+
time_column: created_at
|
46
|
+
limit: 1000
|
47
|
+
columns:
|
48
|
+
- id
|
49
|
+
- column1
|
50
|
+
- column2
|
51
|
+
- created_at
|
52
|
+
last_id: -1
|
53
|
+
entry_time: created_at
|
54
|
+
delay: 3h
|
55
|
+
td_database: sample_datasets
|
43
56
|
EOS
|
44
57
|
conf = YAML.load(str)
|
45
58
|
stub(YAML).load_file{conf}
|