obbinlog searches for clog records before the specified position

Applies to: V4.x

This article describes why obbinlog searches for clog records before the specified position and how to resolve it.

Applicable versions

All versions of obbinlog.

Problem description

A Binlog service is created with timestamp 1739844000000000. Its binlog status is normal, but the Binlog position does not advance. libcdc logs show:

[2025-02-18 10:23:00.616167] ERROR issue_dba_error (ob_log.cpp:1875) [174061][][T0][YA7730A41F204-0000000000000001-0-0] [lt=32][errcode=-4388] Unexpected internal error happen, please checkout the internal errcode(errcode=0, file="ob_log_ls_fetch_ctx.cpp", line_no=933, info="start lsn locate fail")
[2025-02-18 10:23:00.616173] EDIAG [TLOG.FETCHER] locate_lsn_ (ob_log_ls_fetch_ctx.cpp:933) [174061][][T0][YA7730A41F204-0000000000000001-0-0] [lt=5][errcode=0] start lsn locate fail(start_lsn_locate_req={state:2, tls_id:{tenant_id:1018, ls_id:{id:1}}, start_tstamp_ns:1739774776577449000, svr_cnt:3, svr_list_consumed:3, result_svr_list_idx:-1, cur_max_start_lsn:{lsn:18446744073709551615}, cur_max_start_log_tstamp:-1, succ_locate_count:0, svr_list:[{svr:"10.10.10.2:2882", rpc_executed:true, rpc_err:0, svr_err:0, ls_err:-4233, start_lsn:{lsn:18446744073709551615}, start_log_tstamp:18446744073709551615, trace_id:YA7730A41F204-0000000000500651-0-0}, {svr:"10.10.10.1:2882", rpc_executed:true, rpc_err:0, svr_err:0, ls_err:-4233, start_lsn:{lsn:18446744073709551615}, start_log_tstamp:18446744073709551615, trace_id:YA7730A41F204-0000000000600651-0-0}, {svr:"10.10.10.3:2882", rpc_executed:true, rpc_err:0, svr_err:0, ls_err:-4233, start_lsn:{lsn:18446744073709551615}, start_log_tstamp:18446744073709551615, trace_id:YA7730A41F204-0000000000700651-0-0}], fetching_mode:"Integrated Fetching Mode", archive_locate_rs:{start_lsn:{lsn:18446744073709551615}, loc_err:0}}) BACKTRACE:0x1860ef10 0x9c403b5 0x9bf96cd 0x9bf910f 0x9bf904c 0x9bf8e7d 0xc1f8e9f 0xc1f73fb 0xc18233a 0xc181723 0xc180b78 0xc25e86f 0x7f69d8f3dea5 0x7f69d854a8dd

Check the position time specified when creating the Binlog service:

MySQL [oceanbase]> select usec_to_time(1739844000000000);
+--------------------------------+
| usec_to_time(1739844000000000) |
+--------------------------------+
| 2025-02-18 10:00:00.000000     |
+--------------------------------+
1 row in set

Check the position time corresponding to start_tstamp_ns:1739774776577449000 in libcdc logs:

MySQL [oceanbase]> select usec_to_time(1739774776577449000/1000);
+----------------------------------------+
| usec_to_time(1739774776577449000/1000) |
+----------------------------------------+
| 2025-02-17 14:46:16.577449             |
+----------------------------------------+
1 row in set

Cause

Data dictionary mode may be in use. This mode searches for the latest baseline data dictionary. Determine whether this is the cause as follows:

  1. Check whether data dictionary mode is in use.

    [2025-02-18 10:17:36.374751] INFO  [TLOG] init_ob_cluster_version_ (ob_log_instance.cpp:3021) [173939][][T0][Y0-0000000000000000-0-0] [lt=8] [WORK_MODE](refresh_mode="DataDict RefreshMode")
    
  2. Check the time of the latest baseline data dictionary record.

    select * from oceanbase.CDB_OB_DATA_DICTIONARY_IN_LOG;
    

    Output is shown below:

    Output

Solution

Log in to Binlog Server and set obcdc parameter skip_ob_version_compat_check to 1 and meta_data_refresh_mode to online to use online mode.

Note

When synchronizing OceanBase Database V4.2 and later, obcdc ignores user configuration and forces data_dict mode. To use online mode, also set skip_ob_version_compat_check to 1.

  1. Inspect the Binlog instance's binlog_instance.conf file for the value of cdc_config.extra_obcdc_cfg.

    Instance files reside in run. Append the obcdc parameters to change to the value of cdc_config.extra_obcdc_cfg when running the modification command.

Note

If cdc_config.extra_obcdc_cfg already contains the parameter, change its existing value rather than appending another copy to cdc_config.extra_obcdc_cfg.

  1. Log in to Binlog Server.

    mysql -h10.10.10.1 -P2983
    

    The IP address -h and port -P are examples. Replace them with actual values.

  2. Modify the Binlog instance's obcdc parameters.

    ALTER BINLOG INSTANCE binlog3 SET EXTRA_OBCDC_CFG = '<cdc_config.extra_obcdc_cfg> skip_ob_version_compat_check=1 meta_data_refresh_mode=online';
    

    The instance name binlog3 is an example; replace it with the actual name. Also replace <cdc_config.extra_obcdc_cfg> with the actual value of cdc_config.extra_obcdc_cfg.

  3. Restart the Binlog instance.