@@ -824,6 +824,88 @@ Y_UNIT_TEST_SUITE(TGRpcNewClient) {
824
824
client.CreateSession ().Apply (createSessionHandler).Wait ();
825
825
UNIT_ASSERT (done);
826
826
}
827
+
828
+ Y_UNIT_TEST (InMemoryTables) {
829
+ // KeepInMemory
830
+ TKikimrWithGrpcAndRootSchemaNoSystemViews server;
831
+ server.Server_ ->GetRuntime ()->GetAppData ().FeatureFlags .SetEnablePublicApiKeepInMemory (true );
832
+ // InitConfigs(server);
833
+
834
+ ui16 grpc = server.GetPort ();
835
+ TString location = TStringBuilder () << " localhost:" << grpc;
836
+
837
+ auto connection = NYdb::TDriver (
838
+ TDriverConfig ()
839
+ .SetEndpoint (location));
840
+
841
+ auto client = NYdb::NTable::TTableClient (connection);
842
+ auto createSessionResult = client.CreateSession ().ExtractValueSync ();
843
+ UNIT_ASSERT (!createSessionResult.IsTransportError ());
844
+ auto session = createSessionResult.GetSession ();
845
+
846
+ auto createTableResult = session.CreateTable (" /Root/Table" , client.GetTableBuilder ()
847
+ .AddNullableColumn (" Key" , EPrimitiveType::Int32)
848
+ .AddNullableColumn (" Value" , EPrimitiveType::String)
849
+ .SetPrimaryKeyColumn (" Key" )
850
+ .BeginStorageSettings ()
851
+ .SetTabletCommitLog0 (" ssd" )
852
+ .SetTabletCommitLog1 (" ssd" )
853
+ .EndStorageSettings ()
854
+ .BeginColumnFamily (" default" )
855
+ .SetData (" ssd" )
856
+ .SetKeepInMemory (true )
857
+ .EndColumnFamily ()
858
+ .Build ()).ExtractValueSync ();
859
+ UNIT_ASSERT_C (createTableResult.IsSuccess (), (NYdb::TStatus&)createTableResult);
860
+
861
+ {
862
+ auto describeTableResult = session.DescribeTable (" /Root/Table" ).ExtractValueSync ();
863
+ UNIT_ASSERT_C (describeTableResult.IsSuccess (), (NYdb::TStatus&)describeTableResult);
864
+ auto desc = describeTableResult.GetTableDescription ();
865
+ auto families = desc.GetColumnFamilies ();
866
+ UNIT_ASSERT_VALUES_EQUAL (families.size (), 1u );
867
+ auto family = families.at (0 );
868
+ UNIT_ASSERT_VALUES_EQUAL (family.GetKeepInMemory (), true );
869
+ }
870
+
871
+ {
872
+ auto alterTableResult = session.AlterTable (" /Root/Table" , NYdb::NTable::TAlterTableSettings ()
873
+ .BeginAlterColumnFamily (" default" )
874
+ .SetKeepInMemory (false )
875
+ .EndAlterColumnFamily ()).ExtractValueSync ();
876
+ UNIT_ASSERT_C (alterTableResult.IsSuccess (), (NYdb::TStatus&)alterTableResult);
877
+ }
878
+
879
+ {
880
+ auto describeTableResult = session.DescribeTable (" /Root/Table" ).ExtractValueSync ();
881
+ UNIT_ASSERT_C (describeTableResult.IsSuccess (), (NYdb::TStatus&)describeTableResult);
882
+ auto desc = describeTableResult.GetTableDescription ();
883
+ auto families = desc.GetColumnFamilies ();
884
+ UNIT_ASSERT_VALUES_EQUAL (families.size (), 1u );
885
+ auto family = families.at (0 );
886
+ // Note: server cannot currently distinguish between implicitly
887
+ // unset and explicitly disabled, so it returns the former.
888
+ UNIT_ASSERT_VALUES_EQUAL (family.GetKeepInMemory (), Nothing ());
889
+ }
890
+
891
+ {
892
+ auto alterTableResult = session.AlterTable (" /Root/Table" , NYdb::NTable::TAlterTableSettings ()
893
+ .BeginAlterColumnFamily (" default" )
894
+ .SetKeepInMemory (true )
895
+ .EndAlterColumnFamily ()).ExtractValueSync ();
896
+ UNIT_ASSERT_C (alterTableResult.IsSuccess (), (NYdb::TStatus&)alterTableResult);
897
+ }
898
+
899
+ {
900
+ auto describeTableResult = session.DescribeTable (" /Root/Table" ).ExtractValueSync ();
901
+ UNIT_ASSERT_C (describeTableResult.IsSuccess (), (NYdb::TStatus&)describeTableResult);
902
+ auto desc = describeTableResult.GetTableDescription ();
903
+ auto families = desc.GetColumnFamilies ();
904
+ UNIT_ASSERT_VALUES_EQUAL (families.size (), 1u );
905
+ auto family = families.at (0 );
906
+ UNIT_ASSERT_VALUES_EQUAL (family.GetKeepInMemory (), true );
907
+ }
908
+ }
827
909
}
828
910
829
911
static TString CreateSession (std::shared_ptr<grpc::Channel> channel) {
0 commit comments