Enable advisory locks

Hi, I’m struggling to get advisory locks enabled and I can’t work out why.

I have set up a 3 nodes that I’m starting using the following Makefile

.PHONY: start

stop:
	yugabyted stop --base_dir /tmp/data1
	yugabyted stop --base_dir /tmp/data2
	yugabyted stop --base_dir /tmp/data3

start:
	yugabyted start --cloud_location macbook.local.rack1 --base_dir /tmp/data1 --advertise_address 127.0.0.1 --master_flags="allowed_preview_flags_csv={ysql_yb_enable_advisory_locks},ysql_yb_enable_advisory_locks=true" 
	yugabyted start --cloud_location macbook.local.rack1 --base_dir /tmp/data2 --advertise_address 127.0.0.2 --join 127.0.0.1 --tserver_flags="allowed_preview_flags_csv={ysql_yb_enable_advisory_locks},ysql_yb_enable_advisory_locks=true"
	yugabyted start --cloud_location macbook.local.rack1 --base_dir /tmp/data3 --advertise_address 127.0.0.3 --join 127.0.0.1 --tserver_flags="allowed_preview_flags_csv={ysql_yb_enable_advisory_locks},ysql_yb_enable_advisory_locks=true"

when run the make file the master keeps dying in a loop.

I feel like the master_flags are not set correctly but I’m strugging to see whats wrong.

Can anyone offer any sugestions ?

Thanks

Dan

Hello Dan,

You’ll need to set the flags on both master and the tserver. Also, you could check for error logs in files master.err/tserver.err and see if there’s something else going on.

@Dan what version are you on? Advisory locks is available in 2025.1 and above.

Also like @Basava_Kolagani mentioned you need to set the flag on master and tserver on every node, since YugabyteD starts both master and tserver processes internally.

Can you try this?

cat version_metadata.json
Make sure you are using a recent version.

yugabyted start --cloud_location macbook.local.rack1 --base_dir /tmp/data1 --advertise_address 127.0.0.1 --master_flags="allowed_preview_flags_csv={ysql_yb_enable_advisory_locks},ysql_yb_enable_advisory_locks=true" --tserver_flags="allowed_preview_flags_csv={ysql_yb_enable_advisory_locks},ysql_yb_enable_advisory_locks=true"

yugabyted start --cloud_location macbook.local.rack1 --base_dir /tmp/data2 --advertise_address 127.0.0.2 --join 127.0.0.1 --master_flags="allowed_preview_flags_csv={ysql_yb_enable_advisory_locks},ysql_yb_enable_advisory_locks=true" --tserver_flags="allowed_preview_flags_csv={ysql_yb_enable_advisory_locks},ysql_yb_enable_advisory_locks=true"

yugabyted start --cloud_location macbook.local.rack1 --base_dir /tmp/data3 --advertise_address 127.0.0.3 --join 127.0.0.1 --master_flags="allowed_preview_flags_csv={ysql_yb_enable_advisory_locks},ysql_yb_enable_advisory_locks=true" --tserver_flags="allowed_preview_flags_csv={ysql_yb_enable_advisory_locks},ysql_yb_enable_advisory_locks=true"

@Hari_yb @Basava_Kolagani

Thanks - I appear to have it going.

FYI im using 2025.1.0.1-b3

somewhat embarasingly the root cause was that the M2 mac I was working on had the x86 version of yugabyte installed and was causing a segmentation fault when the tserver was starting.

I think i missed this because the UI was available so on the surface it looked ok.

I guess the mac was trying to run it under rosetta and not quite managing it.

I’ve updated the make file to include the changes from @Hari_yb and reinstalled yugabyte and now up and runing

thank you so much for your help.

Makefile included incase it’s usefull to anyone finding this thread later

.PHONY: start

stop:
	yugabyted stop --base_dir /tmp/data1
	yugabyted stop --base_dir /tmp/data2
	yugabyted stop --base_dir /tmp/data3

start:
	yugabyted start --cloud_location macbook.local.rack1 --base_dir /tmp/data1 --advertise_address 127.0.0.1 --master_flags="allowed_preview_flags_csv={ysql_yb_enable_advisory_locks},ysql_yb_enable_advisory_locks=true" --tserver_flags="allowed_preview_flags_csv={ysql_yb_enable_advisory_locks},ysql_yb_enable_advisory_locks=true"
	yugabyted start --cloud_location macbook.local.rack1 --base_dir /tmp/data2 --advertise_address 127.0.0.2 --join 127.0.0.1 --master_flags="allowed_preview_flags_csv={ysql_yb_enable_advisory_locks},ysql_yb_enable_advisory_locks=true" --tserver_flags="allowed_preview_flags_csv={ysql_yb_enable_advisory_locks},ysql_yb_enable_advisory_locks=true"
	yugabyted start --cloud_location macbook.local.rack1 --base_dir /tmp/data3 --advertise_address 127.0.0.3 --join 127.0.0.1 --master_flags="allowed_preview_flags_csv={ysql_yb_enable_advisory_locks},ysql_yb_enable_advisory_locks=true" --tserver_flags="allowed_preview_flags_csv={ysql_yb_enable_advisory_locks},ysql_yb_enable_advisory_locks=true"

1 Like

Glad to see that you got it to work.

I have filed a GH to make it easier to detect and handle such errors:

@Dan , In 2025.1 version, Advisory locks is generally available and on by default, You no longer need to set the gflag - ysql_yb_enable_advisory_locks explicitly.

1 Like