innodb_ruby 0.7.6 → 0.7.7

Sign up to get free protection for your applications and to get access to all the features.
data/bin/innodb_space CHANGED
@@ -225,6 +225,10 @@ def space_index_pages_free_plot(space, image, start_page)
225
225
  end
226
226
  end
227
227
 
228
+ def space_extents(space)
229
+ print_xdes_list(space.each_xdes)
230
+ end
231
+
228
232
  def index_fseg_lists(index, fseg_name)
229
233
  unless index.fseg(fseg_name)
230
234
  raise "File segment '#{fseg_name}' doesn't exist"
@@ -414,6 +418,9 @@ The following modes are supported:
414
418
  space-list-iterate
415
419
  Iterate through the contents of a space list.
416
420
 
421
+ space-extents
422
+ Iterate through all extents, printing the extent descriptor bitmap.
423
+
417
424
  index-recurse
418
425
  Recurse an index, starting at the root (which must be provided in the first
419
426
  --page/-p argument), printing the node pages, node pointers (links), leaf
@@ -542,6 +549,8 @@ ARGV.each do |mode|
542
549
  end
543
550
  when "space-indexes"
544
551
  space_indexes(space)
552
+ when "space-extents"
553
+ space_extents(space)
545
554
  when "index-recurse"
546
555
  unless space.record_describer
547
556
  usage 1, "Record describer necessary for index recursion"
data/lib/innodb/space.rb CHANGED
@@ -27,14 +27,25 @@ class Innodb::Space
27
27
  # The number of pages in the space.
28
28
  attr_reader :pages
29
29
 
30
+ # The size (in bytes) of an extent.
31
+ def extent_size
32
+ 1048576
33
+ end
34
+
30
35
  # The number of pages per extent.
31
36
  def pages_per_extent
32
- 64
37
+ extent_size / page_size
33
38
  end
34
39
 
35
- # The size (in bytes) of an extent.
36
- def extent_size
37
- page_size * pages_per_extent
40
+ # The number of pages per FSP_HDR/XDES page. This is crudely mapped to the
41
+ # page size, and works for pages down to 1KiB.
42
+ def pages_per_xdes_page
43
+ page_size
44
+ end
45
+
46
+ # An array of all FSP/XDES page numbers for the space.
47
+ def xdes_page_numbers
48
+ (0..(@pages / pages_per_xdes_page)).map { |n| n * pages_per_xdes_page }
38
49
  end
39
50
 
40
51
  # Get an Innodb::Page object for a specific page by page number.
@@ -86,7 +97,7 @@ class Innodb::Space
86
97
  # and an Innodb::Page object for each one.
87
98
  def each_page(start_page=0)
88
99
  unless block_given?
89
- return enum_for(:each_page)
100
+ return enum_for(:each_page, start_page)
90
101
  end
91
102
 
92
103
  (start_page...@pages).each do |page_number|
@@ -95,6 +106,35 @@ class Innodb::Space
95
106
  end
96
107
  end
97
108
 
109
+ # Iterate through all FSP_HDR/XDES pages, returning an Innodb::Page object
110
+ # for each one.
111
+ def each_xdes_page
112
+ unless block_given?
113
+ return enum_for(:each_xdes_page)
114
+ end
115
+
116
+ xdes_page_numbers.each do |page_number|
117
+ current_page = page(page_number)
118
+ yield current_page if current_page
119
+ end
120
+ end
121
+
122
+ # Iterate through all extent descriptors for the space, returning an
123
+ # Innodb::Xdes object for each one.
124
+ def each_xdes
125
+ unless block_given?
126
+ return enum_for(:each_xdes)
127
+ end
128
+
129
+ each_xdes_page do |xdes_page|
130
+ xdes_page.each_xdes do |xdes|
131
+ # Only return initialized XDES entries; :state will be nil for extents
132
+ # that have not been allocated yet.
133
+ yield xdes if xdes.xdes[:state]
134
+ end
135
+ end
136
+ end
137
+
98
138
  # Iterate through unique regions in the space by page type. This is useful
99
139
  # to achieve an overall view of the space.
100
140
  def each_page_type_region(start_page=0)
@@ -1,3 +1,3 @@
1
1
  module Innodb
2
- VERSION = "0.7.6"
2
+ VERSION = "0.7.7"
3
3
  end
metadata CHANGED
@@ -1,35 +1,48 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: innodb_ruby
3
- version: !ruby/object:Gem::Version
4
- version: 0.7.6
3
+ version: !ruby/object:Gem::Version
4
+ hash: 13
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 7
9
+ - 7
10
+ version: 0.7.7
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Jeremy Cole
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2013-01-05 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2013-01-09 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: bindata
16
- requirement: &70346481414780 !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
17
24
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 13
29
+ segments:
30
+ - 1
31
+ - 4
32
+ - 5
21
33
  version: 1.4.5
22
34
  type: :runtime
23
- prerelease: false
24
- version_requirements: *70346481414780
35
+ version_requirements: *id001
25
36
  description: Library for parsing InnoDB data files in Ruby
26
37
  email: jeremy@jcole.us
27
- executables:
38
+ executables:
28
39
  - innodb_log
29
40
  - innodb_space
30
41
  extensions: []
42
+
31
43
  extra_rdoc_files: []
32
- files:
44
+
45
+ files:
33
46
  - README.md
34
47
  - lib/innodb.rb
35
48
  - lib/innodb/cursor.rb
@@ -52,27 +65,37 @@ files:
52
65
  - bin/innodb_space
53
66
  homepage: http://jcole.us/
54
67
  licenses: []
68
+
55
69
  post_install_message:
56
70
  rdoc_options: []
57
- require_paths:
71
+
72
+ require_paths:
58
73
  - lib
59
- required_ruby_version: !ruby/object:Gem::Requirement
74
+ required_ruby_version: !ruby/object:Gem::Requirement
60
75
  none: false
61
- requirements:
62
- - - ! '>='
63
- - !ruby/object:Gem::Version
64
- version: '0'
65
- required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ hash: 3
80
+ segments:
81
+ - 0
82
+ version: "0"
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
84
  none: false
67
- requirements:
68
- - - ! '>='
69
- - !ruby/object:Gem::Version
70
- version: '0'
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ hash: 3
89
+ segments:
90
+ - 0
91
+ version: "0"
71
92
  requirements: []
93
+
72
94
  rubyforge_project:
73
- rubygems_version: 1.8.6
95
+ rubygems_version: 1.8.10
74
96
  signing_key:
75
97
  specification_version: 3
76
98
  summary: InnoDB data file parser
77
99
  test_files: []
100
+
78
101
  has_rdoc: