• [series] several points for go to use defer function


    Summary You must have used the defer function. It will not be executed immediately when it is declared, but after the function return. Its main application scenarios include exception handling, logging, data cleaning, resource releasing, etc. This article is not to share the application scenario of defer, but to share the points that need attention […]

  • The “pit” you don’t know in MySQL master-slave synchronization architecture (I)


    The following actions are for specifying an unsynchronized Library Binlog format = row mode View the binlog mode of the master and slave mysql> show slave status\G *********************** 1. row ************************* Slave_IO_State: Waiting for master to send event Master_Host: Master_User: rep Master_Port: 3306 Connect_Retry: 60 Master_Log_File: master-bin.000004 Read_Master_Log_Pos: 463 Relay_Log_File: s1.000011 Relay_Log_Pos: 630 Relay_Master_Log_File: […]

  • Efficiency comparison of three ways of mass inserting data in mybatis


    The database is mysql. 1. For loop insert long start = System.currentTimeMillis(); for(int i = 0 ;i < 100000; i++) { User user = new User(); user.setId(“id” + i); user.setName(“name” + i); user.setPassword(“password” + i); userMapper.insert(user); } long end = System.currentTimeMillis(); System.out.println(“—————” + (start – end) + “—————“); <insert id=”insert”> INSERT INTO t_user (id, name, […]

  • Kafka compression details (first draft)


    Kafka compression Generalization If you need to understand Kafka compression, you need to understand Kafka’s storage format Kafka storage format RecordBatch baseOffset: int64 batchLength: int32 partitionLeaderEpoch: int32 magic: int8 (current magic value is 2) crc: int32 attributes: int16 bit 0~2: 0: no compression 1: gzip 2: snappy 3: lz4 4: zstd bit 3: timestampType bit […]

  • Iterator of Python syntax


    Iteratable object: the value can be repeated, and each value is based on the previous result. Any object that has a ﹐ ITER ﹐ method inside is an iterative object. Iterator objects : the return value obtained from the sequence type. 65104; ITER ﹐ is the iterator object. Iteration method:Print (iterator object Internal principle of […]