GBase 8a, the China-domestically developed MPP analytical database from GBASE, lets you mark a node unavailable when its data is unrecoverable. In that state the cluster stops recording subsequent primary/standby inconsistency events, the node cannot be switched back to normal directly, and node replacement is the only documented path. But what if you simply marked the wrong node by mistake? This post walks through the manual recovery procedure for a gbase cluster.

Unrecoverable faults include physical disk damage, a failed RAID card, or a corrupted filesystem — cases that require rebuilding the RAID or filesystem and wipe all data on that node.

Risks to Accept Before You Start

  • Once a node is unavailable, inconsistency events are no longer recorded, so the sooner you catch the mistake, the smaller the impact.
  • If some tables changed during that window, later operations on them may produce wrong results or DML errors. If that is strictly unacceptable, node replacement is the only safe choice.
  • If the database was already in readonly, or business workloads (including cron jobs) were stopped with no DDL or DML running, there is no impact.
  • Cluster service must be stopped for the whole operation — decide carefully whether to proceed.

Terminology

  • Management service = gcware
  • Scheduling service = coordinator
  • Data service = gnode + syncserver

The Procedure

  1. Stop all scheduling and data services.
  2. Flush the management-service snapshot twice.
  3. Stop all management services.
  4. Back up all management-service data.
  5. Edit every snapshot under every management service to restore the state.
  6. Restart the management services except on the faulty node, then verify.
  7. Start all scheduling and data services.

Stop All Scheduling and Data Services

gcluster_services all stop 

Flush the Management Snapshot Twice

Write flushstatement.py — note that flush_statemachine is called twice:

import gcware gcware.flush_statemachine() gcware.flush_statemachine() 

Run it:

python flushstatement.py 

Stop All Management Services

gcware_services all stop 

Back Up All Management-Service Data

Back up before editing, to guard against mistakes — do it separately on every node. The data lives at:

INSTALL_DIR/XX.XX.XX.XX/gcware/data/gcware/ 

Edit Every Snapshot to Restore the State

In the two files under each snapshot, change the affected node's nodestate from 3 to 1. There are usually several SNAPSHOT suffix groups — edit all of them:

[gbase@gbase_rh7_005 gcware]$ vi SNAPSHOT.AAA.BBB/statemachine/COORDINATORSTATE [gbase@gbase_rh7_005 gcware]$ vi SNAPSHOT.XXX.YYY/statemachine/COORDINATORSTATE [gbase@gbase_rh7_005 gcware]$ vi SNAPSHOT.AAA.BBB/statemachine/vc00001/DATACLUSTERSTATE [gbase@gbase_rh7_005 gcware]$ vi SNAPSHOT.XXX.YYY/statemachine/vc00001/DATACLUSTERSTATE 

One hint: if the wrongly marked node has no "nodestate":3, you can leave it alone. If several nodes are unavailable, find the block for the matching nodeid and do not change the wrong one — you can get the nodeid for an IP by logging into the cluster with gccli and running show nodes.

COORDINATORSTATE ("nodestate":3 means unavailable):

{ "version":139672312498104, "epoch":139672312498104, "coordinatornodes":[ { "nodeid":1728184330, "nodestate":1, "gclusterstate":1, "gcwarestate":1 }, { "nodeid":1744961546, "nodestate":3, "gclusterstate":2, "gcwarestate":1 }, { "nodeid":1761738762, "nodestate":1, "gclusterstate":1, "gcwarestate":1 } ], "coordinatorlist_entries":3 } 

Change it to 1:

{ "version":139672312498104, "epoch":139672312498104, "coordinatornodes":[ { "nodeid":1728184330, "nodestate":1, "gclusterstate":1, "gcwarestate":1 }, { "nodeid":1744961546, "nodestate":1, "gclusterstate":2, "gcwarestate":1 }, { "nodeid":1761738762, "nodestate":1, "gclusterstate":1, "gcwarestate":1 } ], "coordinatorlist_entries":3 } 

DATACLUSTERSTATE uses the same edit and the same precautions:

{ "version":1, "epoch":0, "dataservernodes":[ { "nodeid":1744961546, "nodestate":3, "gnodestate":2, "syncserverstate":2 }, { "nodeid":1728184330, "nodestate":1, "gnodestate":1, "syncserverstate":1 }, { "nodeid":1761738762, "nodestate":1, "gnodestate":1, "syncserverstate":1 } ], "dataserverlist_entries":3 } 

Restart Management Services and Verify

gcware_services all start 

Scheduling and data services are still down, so CLOSE is the expected healthy state. Finally, start the management service on the wrongly marked node; it will sync data from the others automatically:

gcware_services all start 

If it is still UNAVAILABLE, go back to step 2, flush the snapshot again, and edit once more — most likely a node was missed, or one SNAPSHOT directory was left untouched.

Start All Scheduling and Data Services

Restore the services, and the manual recovery is complete — the database can serve traffic normally again.

Going forward, remember that this procedure flips a state bit inside the gcware snapshots, bypassing the product's intended "replacement only" rule. Confirm that workloads are stopped and the cluster is readonly, and keep a separate backup of each node's gcware data before you begin. If any DML ran during the window, reconciling the data afterward will cost far more than simply doing a proper node replacement in gbase.