Skip to content

v3.3 Byte Ranges Read and Update

Andrey Kurilov edited this page Mar 26, 2017 · 1 revision

Introduction

In the previous version there was a possibility to specify the fixed byte ranges to be specified for the update operation. That was done in accordance to RFC7233 to make the append mode available for the users.

In the new version it is possible also to specify both random and fixed byte ranges for read operations. Please note that append mode configuration pattern was changed from "-N" to "-N-". The previous variant ("-N") was actually incorrect in terms of RFC7233 as far as means not append but overwrite last "N" bytes. Read operation should support reading last "N" bytes case so the way to configure the append mode was changed.

Limitations

  • Effective only if load type is set to update or read.

Approach

  • Note that combining multiple fixed ranges is also possible and is a valid case.
  • The fixed ranges configuration will be used if both fixed and random ranges are configured (invalid case but should not lead to failure).

Read/Update Behavior Table

Byte Ranges Configuration Effect
No byte ranges configured Error
A random count N Random Byte Ranges Read or Update with new data, N ranges per request. N should be > 0.
Fixed value: "N-" Read/Overwrite the part of the data item with the same data starting from the position of N bytes to the end of the data item. N should be less than data item size.
Fixed value: "-N" Read/Overwrite last N bytes of the data item. N should be less than data item size.
Fixed value: "N1-N2" Read/Overwrite the part of the data tiem with the same data in the range of N1-N2 bytes. N1 should be not more than N2. N2 may be more than data item size.
Fixed value: "-N-" Append N bytes to the data item using the same data source.

CLI examples

Random ranges read example:

java -jar mongoose.jar
	--read
	--item-data-ranges-random=2
	--item-input-file=items.csv
	...

Random ranges update example:

java -jar mongoose.jar
	--update
	--item-data-ranges-random=2
	--item-input-file=items2update.csv
	--item-output-file=items_updated.csv
	...

Partial read of the data items from 2KB to the end:

java -jar mongoose.jar
	--read
	--item-data-ranges-fixed=2KB-
	--item-input-file=items.csv
	...

Overwrite the data items from 2KB to the end:

java -jar mongoose.jar
	--update
	--item-data-ranges-fixed=2KB-
	--item-input-file=items2overwrite_tail2KBs.csv
	--item-output-file=items_with_overwritten_tails.csv
	...

Read the last 1234 bytes of the data items:

java -jar mongoose.jar
	--read
	--item-data-ranges-fixed=-1234
	--item-input-file=items.csv
	...

Overwrite the last 1234 bytes of the data items:

java -jar mongoose.jar
	--update
	--item-data-ranges-fixed=-1234
	--item-input-file=items2overwrite_tail2KBs.csv
	--item-output-file=items_with_overwritten_tails.csv
	...

Partially read the data items each in the range from 2KB to 5KB:

java -jar mongoose.jar
	--read
	--item-data-ranges-fixed=2KB-5KB
	--item-input-file=items.csv
	...

Overwrite the data items in the range from 2KB to 5KB:

java -jar mongoose.jar
	--update
	--item-data-ranges-fixed=2KB-5KB
	--item-input-file=items2overwrite_range.csv
	--item-output-file=items_overwritten_in_the_middle.csv
	...

Append 16KB to the data items:

java -jar mongoose.jar
	--update
	--item-data-ranges-fixed=-16KB-
	--item-input-file=items2append_16KB_tails.csv
	--item-output-file=items_appended.csv
	...

Partially read the data items using multiple fixed ranges configuration:

java -jar mongoose.jar
	--read
	--item-data-ranges-fixed=0-1KB,2KB-5KB,8KB-
	--item-input-file=items.csv
	...

Configuration

  • Update/Read load type should be used to use the feature: --update/--read or --load-type=update/--load-type=read
  • Fixed byte ranges should be specified using the --item-data-ranges-fixed= configuration parameter.
Clone this wiki locally