Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MiqSqlite3DB::MiqSqlite3Cell#getPayload with overflow raises an exception #207

Open
agrare opened this issue Nov 4, 2024 · 0 comments
Open
Labels

Comments

@agrare
Copy link
Member

agrare commented Nov 4, 2024

>> require 'db/MiqSqlite/MiqSqlite3'
=> true
>> db = MiqSqlite3DB::MiqSqlite3.new('/var/lib/rpm/rpmdb.sqlite')
=> 
#<MiqSqlite3DB::MiqSqlite3:0x00007fe1d7587080
...
>> db.getTable('Packages')
=> 
#<MiqSqlite3DB::MiqSqlite3Table:0x00007fe1d74fe398
 @columns=[{"name"=>"blob", "type"=>"blob"}],
 @data=2,
 @db=
  #<MiqSqlite3DB::MiqSqlite3:0x00007fe1d7587080
   @file=#<File:spec/metadata/linux/data/rpm/rpmdb.sqlite>,
   @filename="spec/metadata/linux/data/rpm/rpmdb.sqlite",
   @header=
    #<OpenStruct magic="SQLite format 3\x00", page_size=4096, write_version=2, read_version=2, unused_space=0, max_payload_node_fraction=64, min_payload_node_fraction=32, min_payload_leaf_fraction=32, file_change_counter=14, reserved="\x00\x00\x98\x03", first_freelist_page=5469, number_freelist_pages=25376, meta_values=49>,
   @maxEmbedFrac=64,
   @maxLeaf=4061,
   @maxLocal=1002,
   @minEmbedFrac=32,
   @minLeaf=489,
   @minLeafFrac=32,
   @minLocal=489,
   @nReserve=0,
   @npages=38915,
   @pageSize=4096,
   @pageSizeFixed=true,
   @usableSize=4096>,
 @desc="Packages",
 @fields=
  [{"len"=>5, "type"=>"text", "data"=>"table"},
   {"len"=>8, "type"=>"text", "data"=>"Packages"},
   {"len"=>8, "type"=>"text", "data"=>"Packages"},
   {"len"=>1, "type"=>"integer", "data"=>2},
   {"len"=>83, "type"=>"text", "data"=>"CREATE TABLE 'Packages' (hnum INTEGER PRIMARY KEY AUTOINCREMENT,blob BLOB NOT NULL)"}],
 @key="hnum",
 @name="Packages",
 @pagenum=33,
 @sql="CREATE TABLE 'Packages' (hnum INTEGER PRIMARY KEY AUTOINCREMENT,blob BLOB NOT NULL)",
 @type="table">
>> db.getTable('Packages').each_row {}
/home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Cell.rb:117:in `getPayload': undefined method `usableSize' for nil (NoMethodError)

        surplus   = minLocal + (nPayload - minLocal) % (@db.usableSize - 4)   # Overflow payload available for local storage
                                                           ^^^^^^^^^^^
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Cell.rb:34:in `initialize'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:146:in `new'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:146:in `block in initCells'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:146:in `each'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:146:in `initCells'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:90:in `each_cell'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:83:in `each_child'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:95:in `leaves'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:96:in `block in leaves'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:84:in `block in each_child'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:91:in `block in each_cell'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:91:in `each'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:91:in `each_cell'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:83:in `each_child'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Page.rb:95:in `leaves'
	from /home/grare/adam/src/manageiq/manageiq-smartstate/lib/db/MiqSqlite/MiqSqlite3Table.rb:87:in `each_row'
	... 3 levels...
@agrare agrare added the bug label Nov 4, 2024
@agrare agrare changed the title MiqSqlite3DB::MiqSqlite3Cell#getPayload with overflow raises an exception MiqSqlite3DB::MiqSqlite3Cell#getPayload with overflow raises an exception Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant