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

From mongo, transactions become irreversible after ~40 second, not ~3 second! #138

Closed
zhopen opened this issue Nov 13, 2019 · 4 comments
Closed
Labels
enhancement New feature or request

Comments

@zhopen
Copy link

zhopen commented Nov 13, 2019

Image: boscore/bos:v3.0.2
Contracts: v3.0.2
Block producers: 3

I send transaction to contract and get trx_id.
Then, I query the transaction pushed from mongodb. I find: updatedAt - createdAt = 34 seconds.
How to make transaction irreversible in mongdb in 3 seconds.

[root@psn230m2 node]# cl push action ab add '
> {
>     "account": "alice",
>     "name": "lis4",
>     "age":  "22",
>     "phonenumber": 13911113333,
>     "address": "address"
> }' -p alice; cl get info
executed transaction: e8d4dc466178ebaf287a2eefd0b5257430a1063a2eb6ff8ecd8833df7141f311  136 bytes  371 us
#            ab <= ab::add                      {"account":"alice","name":"lis4","age":22,"phonenumber":"13911113333","address":"address"...
warning: transaction executed locally, but may not be confirmed by the network yet         ] 

{
  "server_version": "b24a643a",
  "chain_id": "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f",
  "head_block_num": 12630,
  "last_irreversible_block_num": 12627,
  "last_irreversible_block_id": "00003153c189190ff3581b3ebbb74f7b7342cc6dae2c3dce78d14e14e7c9cd03",
  "head_block_id": "000031565edfffa072fac5cb73117f9b7353aa9523f83a7b9d67b13e78fbab74",
  "head_block_time": "2019-11-13T08:13:39.000",
  "head_block_producer": "prod1",
  "current_view": 2,
  "target_view": 3,
  "last_stable_checkpoint_block_num": 12601,
  "virtual_block_cpu_limit": 200000000,
  "virtual_block_net_limit": 1048576000,
  "block_cpu_limit": 199529,
  "block_net_limit": 1048440,
  "server_version_string": "v3.0.2"
}

> db.transactions.find({"trx_id":"e8d4dc466178ebaf287a2eefd0b5257430a1063a2eb6ff8ecd8833df7141f311"}).pretty()
{
	"_id" : ObjectId("5dcbbb33cc9bc8e1007691b0"),
	"trx_id" : "e8d4dc466178ebaf287a2eefd0b5257430a1063a2eb6ff8ecd8833df7141f311",
	"accepted" : true,
	"actions" : [
		{
			"account" : "ab",
			"name" : "add",
			"authorization" : [
				{
					"actor" : "alice",
					"permission" : "active"
				}
			],
			"data" : {
				"account" : "alice",
				"name" : "lis4",
				"age" : 22,
				"phonenumber" : "13911113333",
				"address" : "address"
			},
			"hex_data" : "0000000000855c34046c6973341675be2a3d0300000012e58c97e4baace5b882e8a5bfe59f8ee58cba"
		}
	],
	"context_free_actions" : [ ],
	"context_free_data" : [ ],
	"createdAt" : ISODate("2019-11-13T08:13:39.511Z"),
	"delay_sec" : 0,
	"expiration" : "2019-11-13T08:14:09",
	"implicit" : false,
	"max_cpu_usage_ms" : 0,
	"max_net_usage_words" : 0,
	"ref_block_num" : 12627,
	"ref_block_prefix" : 1041979635,
	"scheduled" : false,
	"signatures" : [
		"SIG_K1_KWL2aLiwGDxeSz1ztRrYDkLREPXvcAnDXd5ffLuagNqzZ7d7oPe29vF5Uz6etvkPPKKFaDDDUbKz4txELrqb5Px8H4nLdH"
	],
	"signing_keys" : {
		"0" : "EOS7HxPMkfyL69PqLXduP9YfuvVad8e3Nry6ryDGaJ2u8BKB2zUUm"
	},
	"transaction_extensions" : [ ],
	"block_id" : "0000315714cf74bf07cb9f2158e54794f6b30dce2114d91d097dd1199e8c2cd3",
	"block_num" : 12631,
	"irreversible" : true,
	"updatedAt" : ISODate("2019-11-13T08:14:25.030Z")
}
@qianxiaofeng
Copy link

is the head-lib normal in mongodb-plugin enabled node?

@zhopen
Copy link
Author

zhopen commented Nov 19, 2019

is the head-lib normal in mongodb-plugin enabled node?

"head_block_num": 12630,
"last_irreversible_block_num": 12627

head_block_num-last_irreversible_block_num is always around 3.

{
  "server_version": "b24a643a",
  "chain_id": "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f",
  "head_block_num": 12630,
  "last_irreversible_block_num": 12627,
  "last_irreversible_block_id": "00003153c189190ff3581b3ebbb74f7b7342cc6dae2c3dce78d14e14e7c9cd03",
  "head_block_id": "000031565edfffa072fac5cb73117f9b7353aa9523f83a7b9d67b13e78fbab74",
  "head_block_time": "2019-11-13T08:13:39.000",
  "head_block_producer": "prod1",
  "current_view": 2,
  "target_view": 3,
  "last_stable_checkpoint_block_num": 12601,
  "virtual_block_cpu_limit": 200000000,
  "virtual_block_net_limit": 1048576000,
  "block_cpu_limit": 199529,
  "block_net_limit": 1048440,
  "server_version_string": "v3.0.2"
}

@oldcold
Copy link

oldcold commented Nov 26, 2019

In batch-pbft, irreversible_block signals are emitted upon the lscb advancing, and by default, old plugins tend to capture these signals to update their db status. Probably for a better experience, we will introduce a new channel dedicatedly emitting newly applied libs signals.

@oldcold oldcold added the enhancement New feature or request label Nov 26, 2019
@cppfuns
Copy link

cppfuns commented Dec 4, 2019

Expect this issue to be resolved first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants